Skip to content

GamesTwoLife/DiscordBot-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord.JS Bot Template — Clean, Scalable and Fully Customizable

Version npm version Documentation Maintained

An open-source discord.js bot template based on the official discord.js guide to help you start building your own personal Discord bot!

Introduction

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!

Features

This template includes many built-in, useful, and flexible features such as:

Dynamic Event Handler:

  • All events are stored in the events folder. You don't need to use client.on() in the main index.js file to handle events.
  • Using a simple event scaffold, you can create as many event files as you want inside the events folder.

Dynamic Command Handler (for both Slash and Context Menu commands):

  • 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 a ContextMenuCommandInteraction 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.)

Dynamic Button Interaction Handler:

  • This template includes a dynamic button interaction handler to capture and process button interactions.
  • Buttons can be organized into different folders.

Dynamic Select Menu Interaction Handler:

  • This template includes a dynamic select menu interaction handler to capture and process select menu interactions.
  • Menus can be organized into different folders.

Dynamic Modal Submit Interaction Handler:

  • Easily handle incoming modal submissions using the template's handler!
  • Modals can be organized into different folders.

Dynamic Autocomplete Interaction Handler:

  • Easily handle incoming autocomplete requests using the template's handler!
  • Fully dynamic for all your needs!

Highly Customizable:

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.

Open-Source and Self-Hosted:

It's yours, you have full control.

Installation

npm install

Configuration

  • 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 to config.js and fill it with your bot's token, ID, and other values. Extend config.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

Run Your Bot

npm start

Support and Documentation

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.

Author

GamesTwoLife

Contributors

Everyone is welcome to contribute and be featured here!

Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check the issues page. You can also refer to the contribution guide.

Show Your Support

Give a ⭐️ if this project helped you! Your support encourages me to keep maintaining it.

License

Copyright © 2025 GamesTwoLife. This project is licensed under the MIT License.