MilaDog / discord-bot

Codewars Discord Bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codewars Discord Bot

Discord chat CI License MIT code style: prettier

The official Discord bot for Codewars.

Project Status

Early stage. Expect breaking changes.

Feedback is appreciated (Discord or GitHub issues/discussions).

Configuration

The following environment variables are used:

  • BOT_TOKEN (required): The token used to log in.
  • COMMAND_PREFIX: The prefix used to identify commands. Defaults to ?.

Developement Setup

NOTE: Please discuss with us first before adding new features to avoid wasting your time.

Before working on this repo, you should already have set up a bot account and added it to your development server. In order to mimic the Codewars Discord server in your development server, you may also wish to add appropriate roles such as @admin and @mods, as well as common channels such as #help-solve.

Making Changes

After forking this repo and cloning your fork to your local development environment:

  1. Change directory to the root of this repo: $ cd /path/to/your/discord-bot
  2. Install dependencies and compile TypeScript: $ npm install
  3. Start TypeScript compiler process to recompile on change: $ npm run build:watch
  4. In a new terminal session, run the bot with your token: $ BOT_TOKEN=... npm start

After confirming that the bot works as expected, make changes to the local copy of your fork as appropriate and test your changes by restarting the bot.

Adding a new command

Run npx plop command to generate boilerplate. You will be asked to enter the name of the command (lowercase English letters only) which should be a verb and select an associated category.

If your command belongs to a category that does not exist yet, stop the command generation by pressing Ctrl-C, then modify plopfile.ts as appropriate to add your category and re-run npx plop command.

Adding a new message handler

Run npx plop message-handler to generate boilerplate.

Code Style

Prettier is used to ensure consistent style. We use the defaults except for printWidth: 100 because 80 is often too narrow with types.

pre-commit hook to format staged changes is installed automatically when you run npm install, so you don't need to do anything. However, it's recommended to configure your editor to format on save, and forget about formatting.

License

MIT

About

Codewars Discord Bot

License:MIT License


Languages

Language:TypeScript 98.2%Language:Handlebars 1.8%