Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 2.05 KB

CONTRIBUTING.md

File metadata and controls

28 lines (18 loc) · 2.05 KB

Contributing

The project is built with TypeScript and makes use of both Prettier as well as extensive linting via ESLint.

The project uses semantic commit messages, of the form topic: summary of changes. Examples using the available topics:

  • feat: new feature for the user, not a new feature for build script
  • fix: bug fix for the user, not a fix to a build script
  • refactor: refactoring production code
  • chore: updating build scripts etc; no production code change
  • style: formatting, code style etc; no production code change
  • test: adding missing tests, refactoring tests; no production code change
  • docs: changes to the documentation

The project has a slim CI pipeline via GitHub Actions that checks for formatting and linting errors, as well as ensuring that the tests pass.

Project Structure

The project is built with TypeScript, Node.js, and discord.js. Data, such as configuration and sounds, is persisted in simple JSON file via lowdb.

The main class is SoundBot which is a Client. It sets up event handlers, e.g. for incoming message and voice state updates.

It passes incoming messages to the MessageHandler which checks if it needs to react to a given message, e.g. message not from bot or ignored user. If a message should be acted on, it is passed to the CommandCollection. It holds a map of all the commands and their triggers, which are registered during start up. If a actionable message does not specify a command, the message will be handled by the SoundCommand.

Commands are simple classes that have a run method, which gets the message object and additional parameters for the command. Commands can play sounds, edit configuration, or provide information.

Triggered sounds are saved in a SoundQueue, which takes care of playing each sound in order.