An open-source
discord.js
bot template based on the official discord.js guide to help you start building your own personal Discord bot!
The Discord Bot Template is an open-source discord.js
bot template designed to kickstart your new bot project.
It's a classic JavaScript template that doesn't require any external dependencies, unlike many popular frameworks. (This is not a framework!)
With this template, you can scale any bot project (whether for one or multiple servers). It all depends on your creativity!
This template includes many built-in, useful, and flexible features such as:
- All events are stored in the events folder. You don't need to use
client.on()
in the mainindex.js
file to handle events. - Using a simple event scaffold, you can create as many event files as you want inside the events folder.
- The template comes with a dynamic command handler that makes it very easy to set up and create commands.
- Commands inside the commands folder receive a
ChatInputCommandInteraction
or aContextMenuCommandInteraction
object depending on the command type (slash or context menu). - IMPORTANT: In this template, we register commands to Discord in only one guild. This is because there are two types of commands: guild and global. Guild commands are restricted to one server but update instantly, while global commands can take up to an hour to update. So, use guild commands during development and global commands in production. (You can change this by setting the
devGuildOnly
option in each command file:true
for guild-only,false
for global.)
- This template includes a dynamic button interaction handler to capture and process button interactions.
- Buttons can be organized into different folders.
- This template includes a dynamic select menu interaction handler to capture and process select menu interactions.
- Menus can be organized into different folders.
- Easily handle incoming modal submissions using the template's handler!
- Modals can be organized into different folders.
- Easily handle incoming autocomplete requests using the template's handler!
- Fully dynamic for all your needs!
Using the template is easy and fun — you'll see!
Since the template is written purely in JavaScript with no external dependencies, you can customize it however you want. Your creativity is the limit!
The template is implemented using plain JavaScript without any external dependencies, making it straightforward to extend and adapt to your specific requirements. Its modular architecture allows for full customization based on your project’s needs.
It's yours, you have full control.
npm install
- Rename
.env-sample
to.env
and fill in the required environment variables inside it (e.g., database URI, API tokens, or secrets etc). - Rename
config-example.js
toconfig.js
and fill it with your bot's token, ID, and other values. Extendconfig.js
according to your needs! - REQUIRED VARIABLES:
- DISCORD_TOKEN=your_bot_token_here
- MONGO_URI=your_mongodb-url_connection
- CLIENT_ID=your_bot_client_id
- DEV_GUILD_ID=your_guild_id_for_testing
npm start
The template is actively maintained. If you encounter any issues or have questions about the template, feel free to reach out to me on Discord.
- Github: @GamesTwoLife
Everyone is welcome to contribute and be featured here!
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page. You can also refer to the contribution guide.
Give a ⭐️ if this project helped you! Your support encourages me to keep maintaining it.
Copyright © 2025 GamesTwoLife. This project is licensed under the MIT License.