The Discord Bot Template provides a solid foundation for creating feature-rich Discord bots using Discord.js. It includes various managers for handling message commands, buttons, select menus, slash commands, context menus, and modal forms. The template offers customization options, colorful logging, and a simple code structure.
- Fixed Windows Support and SlashCommands & ContextMenus not Registering.
- Added dependency of
simple-json-db
for the cooldown system as i rage quit and can't do it withfs
myself. - Fixed subDirectories not working for commands.
- Latest Discord.js adaptation.
- Following JavaScript Naming Convention.
- Removed
node-recursive-directory
dependency. - Support for
AutoCompleteInteraction
added. - Converted from
CommonJS
toESM Module
. - Improved handling of all events, commands with lower memory usage.
- Main file
bot.ts
has been shifted tosrc
. - Config file has been shifted to
Src
. - Moved from
Collections
toMap
. messageCommandsAliases
has been renamed tomessageCommands_Aliases
Quick.DB
has been removed and instead all cooldowns data will be now stored inCooldownDB.txt
in the root directory usingfs
.- Refactored command options.
chalk
has been replaced withtasai
.- Extended all command options support to interactions.
- All custom types and interfaces are exported from
./src/types.ts
. SlashCommands
andContextMenus
has been seperated into different folders and managed differently.SlashCommands
have been simplified as now instead ofGuilds/<GuildID>/<Files Here>
, you can useguilds: ["GUILD ID"]
- In a slashCommand you do not need to assign the
type: ApplicationCommandType
property as the handler by default assumes it asChatInput
.
For detailed documentation on command options and managers, please refer to the following links:
- ReturnErrors
- Ignore
- AllClientPermissions
- AllowBots
- AllowInDms
- AllUserPermissions
- AnyClientPermissions
- AnyUserPermissions
- ChannelCooldown
- GlobalCooldown
- GuildCooldown
- OnlyChannels
- OnlyGuilds
- OnlyRoles
- OnlyUsers
- OwnerOnly
- Colorful and organized logging.
- Customization options to suit your needs.
- Supports management of message commands, buttons, select menus, slash commands, context menus, and modal forms.
- Includes a variety of commonly used command options (not applicable to events).
- Supports management of custom events.
- Simple and understandable code structure.
- Recommended Node.js version: 16 and above.
- Global slash commands and context menus may take time to refresh as it is controlled by Discord.
- Guild commands may take time to refresh if there are a large number of different guild commands.
- Collections where command and event data is stored and used:
<Client>.messageCommands
: Message commands cache<Client>.messageCommands_Aliases
: Message command aliases cache<Client>.events
: Client events cache<Client>.buttonCommands
: Button interactions cache<Client>.selectMenus
: Select menu interactions cache<Client>.modalForms
: Modal form interactions cache<Client>.slashCommands
: Slash commands cache<Client>.contextMenus
: ContextMenus commands cache
To get started with the Discord Bot Template, follow these steps:
- Clone the repository by downloading it as a ZIP file or running the command
git clone https://github.com/rilecraft/discordbot-template-ts
. - Navigate to the template's directory and run the command
npm install
(make sure npm is installed). - Once all the required modules are installed, open the
src/config.ts
file and fill in the necessary information. - Run the command
npm run build && npm run start
to start the bot.
Contributions to the Discord Bot Template are welcome. To contribute, please follow these guidelines:
- Fork the
Unstable
branch. Important: All changes must be made to the Unstable branch. - Make your changes in your forked repository.
- Open a pull request to the
Unstable
branch, and it will be reviewed promptly. - If everything checks out, the pull request will be merged.