Giter Site home page Giter Site logo

schedulerbot-1.0's Introduction

This repository is no longer maintained. The new version of SchedulerBot can be found here.

SchedulerBot

A Discord bot for scheduling events.

This bot uses the Eris library. Reference documentation can be found at https://abal.moe/Eris/docs.

Installation

This project requires NodeJS v7.6 or later, npm, MongoDB and Redis. Install these first before continuing. (NOTE: npm comes with NodeJS.)

To get started, clone the repository:

$ git clone https://github.com/pyrox18/schedulerbot.git
$ cd schedulerbot
$ npm install

Usage

First-time Setup

Before running the bot, you will have to create a Discord Developer App at https://discordapp.com/developers/applications/me.

  1. Create a new app by clicking on 'New App'.
  2. Give it a name (e.g. "SchedulerBot Pyrox"), description and icon.
  3. Create an app bot user for the app.
  4. Uncheck "Public Bot" under the app bot user if you don't want anyone else inviting your bot to the server.
  5. Take note of the app bot user's token, which will be used in the bot's config.

Next, copy .env.example into a new .env file.

$ cp .env.example .env

The following fields in the .env file can be modified:

  • NODE_ENV: Defaults to development for a development environment. No need to change this unless you're deploying the bot on a production environment.
  • BOT_TOKEN: Replace this with your app bot user's token.
  • MONGODB_URI: Defaults to a local MongoDB instance running on port 27017. Replace this if you use a different configuration.
  • SENTRY_DSN: Unless you're in a production environment and use Sentry for error logging, this doesn't have to be configured.
  • REDIS_PORT: Defaults to port 6379 of a local redis-server instance. Replace this if you have a different configuration.

Next, copy src/config/bot-example.config.ts into src/config/bot.config.ts and edit it.

  • prefix: Change this if the default prefix conflicts with other bots on your server.
  • game.name: Modify this if you want to change the bot's status.
  • adminId: Used for admin-only commands. Change it to your ID.

Compile and Run

Before starting the bot, make sure MongoDB is running. The bot will attempt to connect to the address specified by dbConnectionUrl in the config file.

Next, make sure a local Redis server instance is running. The bot will attempt to connect to the port specified by the REDIS_PORT environment variable, or port 6379 by default if none is specified.

Then, you can compile the TypeScript code and start the bot.

$ npm run build
$ npm start

Build tasks are managed and run using Gulp. nodemon is used to run the bot, which will auto-restart the bot when changes are detected in the generated build folder.

Instead of running the build and start commands every time you make a change, you can run

$ npm run dev

to let Gulp observe for changes in the src folder, compile the source files, and restart the bot automatically.

To invite the bot to your server, generate an invite link at https://discordapi.com/permissions.html. To make things easy, just give the bot the Administrator permission so it automatically has the permission to do everything on your server. You can get your bot's client ID from your Discord Developer App page.

Debugging

The npm start script exposes port 5858 for debugging purposes. The build task also generates map files for the JavaScript files as well, so you can debug from your TypeScript code with a compatible debugger. Visual Studio Code debugging configurations are available for this project, should that be your editor of choice.

License

The SchedulerBot source code is distributed under the GNU General Public License v3.0.

Contributing

Refer to the CONTRIBUTING.md file for more information on how to contribute to the development of SchedulerBot.

Discussions

Discuss about the development of SchedulerBot on the #development channel of the SchedulerBot support server. I usually hang around there.

schedulerbot-1.0's People

Contributors

pyrox18 avatar

schedulerbot-1.0's Issues

Updating an event updates all events

They all get the same name and time information.
To replicate, create two events with different names and times, then update one to a new time.

Mongoose VersionErrors when more than one call to Calendar.save is made simultaneously

See this for a potential explanation on why this happens.

This mostly occurs when the event scheduler is attempting to execute multiple jobs that call the save method on the same calendar simultaneously, resulting in some data being improperly formatted or potentially lost.

One way to possibly resolve this issue is to use a mutex-esque attribute in the calendar model. Saves should acquire the mutex first, perform the save, then release the mutex for another save operation to begin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.