Skip to content

akena-engineering/discord-bot

Repository files navigation

Architecture

Add scripts or event hooks to the /scripts/ folder. These should export an object with two keys:

  • trigger, which is the Event that triggers the script.
  • execute, which is a function that takes in a client and returns a event handler function. For a barebones example of this, check out logged-in.js.

Add cron jobs to the /cron/ folder. These should export the following keys:

  • schedule, which is a cron-formatted string.
  • timezone, which is the english-named timezone like America/New_York.
  • execute, which is a function that takes in a client and returns a function to be run on a cron schedule.

Local Development

  1. Create your own bot using the the discord developer portal.
  2. Make sure your bot has the proper server authorizations.
  3. Create a server, invite the bot to it, and give it a good permissions.
  4. Clone this repo, and set the following environment variables below. I recommend direnv to manage this.
  5. Navigate to this directory.
  6. $ npm ci
  7. $ node index.js
  8. You should be greeted with something that looks like:
Logged in as BotUser#123!
Successfully registered application commands.

Environment Configuration