Mookie Bott - A discord.js bot written with TypeScript based on a template.
- Bet (Command)
- Using input from the user, creates a post in a Forum channel that contains what the bet is, who is on each side and what the stakes are
- Pings the users in the bet so they are a part of the post immediately
- Hemomancer Replacement (Trigger)
- Inspired by a popular TikTok, replaces specific words with their "hemomancer" counterpart (i.e. vampire -> hemomancer)
- Hmmmm (Trigger)
- Also inspired by the same TikTok for the Hemomancer Replacement trigger, it sends a specific photo whenever a user sends "hmmmm" in any channel (must have at least 4 'm's to trigger)
- Spelltable Spectate (Trigger)
- Whenever someone sends a Spelltable link in any channel, it will reply with the Spelltable spectator link
- Kermit Month (Job)
- Every July 1st at 8:30am, sets the server into Kermit month (changing server banner and icon)
- Song of the Day (Job)
- Every morning at 9am, it queries a MongoDB database for a random song and posts it to the music channel
- Obtain a bot token.
- You'll need to create a new bot in your Discord Developer Portal.
- See here for detailed instructions.
- At the end you should have a bot token..
- You'll need to create a new bot in your Discord Developer Portal.
- Copy the
example.env
- Rename it
.env
. - Edit the following values:
CLIENT_TOKEN
- Your Discord bot's token.CLIENT_ID
- Your discord bot's user ID.SERVER_ID
- Get the channel ID of the server you are going to test on by ensuring that you have developer mod enabled in the Advanced Discord setting. Then right click on the server icon and selectCopy Server ID
.- Optional if you have a MongoDB instance running
MONGODB_URL
- DB URL usually starting withmongodb://
MUSIC_DB
- The name of the database in MongoDBMUSIC_COLLECTION
- The Mongo collection in the database
- Rename it
- Install packages.
- Ensure that
yarn
is installed. - Navigate into the downloaded directory.
- Change yarn version using
yarn set version berry
. - Run the command
yarn install
to install packages.
- Ensure that
- Register commands.
- In order to use slash commands, they first have to be registered.
- Type
yarn run commands:register
to register the bot's commands.- Run this script any time you change a command name, structure, or add/remove commands.
- This is so Discord knows what your commands look like.
- It may take up to an hour for command changes to appear. In my time working with this bot, it has been very quick to see changes (about a minute if I had to guess)
Commands you can run before starting the bot:
yarn run commands:view
- View all commands registered for the bot
yarn run commands:register
- Register all commands set in the commands list in
src/start-bot.ts
.
- Register all commands set in the commands list in
yarn run commands:rename <OLD_NAME> <NEW_NAME>
- Rename a command
yarn run commands:delete <COMMAND_NAME>
- Delete a specific command
yarn run commands:clear
- Delete all commands
Note: We don't need sharding for this bot since we are making this as a single instance
- Normal Mode
- Type
yarn start
. - Starts a single instance of the bot.
- Type