Discord.js bot template made in TypeScript with minimal dependencies.
- Compatible with the latest version of Discord.js.
- Code properly made using Object Oriented Programming.
- Client Event and Discord API REST Event handlers.
- Text-based Commands handler.
- Slash Commands, Sub-Commands (with Subcommand groups) and Autocompletions Interactions handlers.
- Button Interactions handler.
- Menu Interactions handler.
- Every handler supports subfolders (built-in directory walker).
- Modal Interactions handler.
- Configuration loader.
- Exception catcher (informally known as "anti-crash").
- Built-in reload and eval command.
- Built-in command for refreshing Slash Commands, an option for refreshing them every time the bot joins a new guild and when it starts.
- Custom console logger (with output files).
- Custom presence/status controller.
- Authorization (way to check and respond to unauthorized command executions) and executor (way to connect a slash command and a normal command) architecture.
- Examples of everything above.
- Install Node.js if you don't have it. This template was developed and tested in versions above 18+.
- Clone this repository.
- Install all the required dependencies with
npm install
. - Copy the contents of
example.env
in a new file called.env
and fill in everything that is needed. Then do the same forconfig.example.ts
, in this case the new file has to be calledconfig.ts
. Theexample.env
file contains comments to help you understand what the settings do; same forconfig.example
, but the documentation is located on thesrc/structures/IConfiguration.ts
interface itself. - Build the proyect using
npm run build
. Then runnpm run start:build
to start the bot. - You can also just run
npm run start:dev
to run the proyect using ts-node. - You can also use
npm run start:watch
to run the proyect using ts-node with nodemon.
Important: all commands must be executed in the root directory of the proyect. Avoid running from folders like dist
or src
. It's also recommended to only use the scripts that the proyect has (from package.json
) to build or run it. If you don't do any of these, you can probably get file/module find errors.