A small discord bot that allows users to set a 15 second sound byte to play when they join a Voice Channel
Find a file
2023-04-07 01:00:19 -04:00
.vscode theme bot fix 2022-09-27 00:01:53 -04:00
bot A 2022-12-30 19:50:27 -05:00
prisma Announcements 2022-10-25 15:47:23 -04:00
scripts theme bot fix 2022-09-27 00:01:53 -04:00
.env.template theme bot fix 2022-09-27 00:01:53 -04:00
.gitattributes Initial commit 2022-02-03 18:29:04 -05:00
.gitignore fix a couple of issues 2022-09-27 14:41:30 -04:00
announcement.txt Announcements 2022-10-25 15:47:23 -04:00
CONTRIBUTING.md theme bot fix 2022-09-27 00:01:53 -04:00
index.ts theme bot fix 2022-09-27 00:01:53 -04:00
LICENSE theme bot fix 2022-09-27 00:01:53 -04:00
package-lock.json blaseball 2022-10-27 17:43:01 -04:00
package.json Apply temp ytdl patch 2023-04-07 01:00:19 -04:00
README.md theme bot fix 2022-09-27 00:01:53 -04:00
tsconfig.json theme bot fix 2022-09-27 00:01:53 -04:00

Discord Bot Template

This template was originally made by me to stop having to rewrite boilerplate code for every bot I make. It's expanded a lot since then, and I've done my best to make it as easy to use as possible.

Table of Contents

Features

  • Command handler
  • Designed to be Modular
  • Custom Command Builder
  • Slash Command Support
  • Context Menu Support
  • Autocomplete support
  • Button, Select Menu, and Modal event handling

Installation

  1. Clone the repository
  2. Run npm install in the root directory
  3. Copy the .env.template file to .env and fill in the values
  4. Run tsc to compile
  5. Run node . to start the bot

How to create a module

node ./scripts/createModule.js <name> <description>

Creating a command

  1. Create a new file in the bot/modules/<module>/commands directory
  2. Use the command snippet

Creating a context menu command

  1. Create a new file in the bot/modules/<module>/commands directory
  2. Use the userContextMenu or messageContextMenu snippet

Registering a button, select menu, or modal


import { bot } from "../../.."; // Import the bot from the root directory


bot.buttonManager.registerButton("customId", async (interaction) => {
  // Do something
});

bot.selectMenuManager.registerSelectMenu("customId", async (interaction) => {
  // Do something
});

bot.modalManager.registerModal("customId", async (interaction) => {
  // Do something
});

Unregistering a button, select menu, or modal


import { bot } from "../../.."; // Import the bot from the root directory

bot.buttonManager.unregisterButton("customId");
bot.selectMenuManager.unregisterSelectMenu("customId");
bot.modalManager.unregisterModal("customId");

Contributing

If you have any suggestions, feel free to open an issue or pull request.

License

This project is licensed under the MIT License.

Credits

  • Discord.js - The Discord API wrapper used
  • Chalk - Used for nice console logging