Welcome to the Discord Bot Starter Template! This project serves as a foundation for building feature-rich and scalable Discord bots using the Discord.js library. It incorporates modular design, dynamic command loading, error handling, and best practices to streamline bot development.
Organized by categories, making it easy to add or edit commands.
- Slash Commands
/help
,/ping
,/info
, etc. - Prefix Commands
!help
,!ping
, and more. - Moderation Tools Ban, Mute, Timeout, Warn.
- Fun Commands Generate jokes and interactive fun features.
Built-in support for all major Discord events, including custom events.
- Dynamic Command and Event Loading Auto-load commands and events for scalability.
Easily manage settings like bot tokens and prefixes using .env
or JSON config files.
Includes examples for GitHub, RSS feeds, and more.
Pre-built utilities for logging, embed creation, and more to streamline development.
- Utilities Includes logging, error handling, embed builders, and more.
Ready-to-use structure for integrating MongoDB or other databases.
Follows best practices for secure token handling and scalable architecture.
- Error Handling Centralized and robust error management.
Ensure you have the following installed:
- Node.js v16.6.0 or higher.
- npm v7 or higher
- Discord Developer Portal account to create a bot and get your bot token.
Follow these steps to set up the bot on your local machine:
- Clone the repository:
git clone https://github.com/nexoscreation/discord-bot-template.git
cd discord-bot-template
- Install dependencies:
npm install
- Configure environment variables: Create a .env file in the root directory and add:
DISCORD_BOT_TOKEN=
DISCORD_BOT_PREFIX=!
DISCORD_BOT_CLIENT_ID=
DISCORD_BOT_CLIENT_SECRET=
DISCORD_GUILD_ID=
You can run the bot using the following command:
npm run bot:start
Support hot reload:
npm run dev
To deploy all slash commands to your Discord guild, run:
npm run bot:deploy
To delete all the existing slash commands in your Discord guild, run:
npm run bot:delete
This command loads all command files from the commands directory, and then deploys them to your specified guild.
.
βββ basics/ # Prefix-based commands
βββ commands/ # Slash commands
β βββ fun/ # Fun-related commands
β βββ info/ # Informational commands
β βββ moderation/ # Moderation commands
βββ events/ # Bot event handlers
βββ utils/ # Utility functions
βββ .env # Environment variables
βββ index.js # Main entry point
βββ delete-commands.js # Script for deleting all slash commands
βββ deploy-commands.js # Script for deploying slash commands
βββ package.json # Dependencies and metadata
βββ README.md # Project documentation
The bot will go online and listen for both prefix commands (!) and slash commands (/).
Command | Description |
---|---|
/ping |
Responds with "Pong!" |
/github user |
Fetches GitHub user data |
/github repo |
Fetches GitHub repository details |
/help |
Lists all available commands |
/ban |
Bans a user (requires permissions) |
- /ban [user]: Bans a user from the server.
- /mute [user]: Temporarily mutes a user.
- /timeout [user]: Applies a timeout to a user.
- /warn [user]: Issues a warning to a user.
- Embed Builder: Create custom embeds using utils/embedBuilder.js.
- Logger: Log bot activities and errors with different severity levels.
- Error Handler: Centralized error handling for consistency.
Comming Soon!
We welcome contributions from the community! Hereβs how you can help:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Make your changes and test thoroughly.
- Submit a pull request with a detailed description.
This project is licensed under the MIT License. See the LICENSE file for details.
Need help? Have suggestions? Feel free to open an issue or reach out:
- Discord Server: Join Us
- GitHub Issues: Create an Issue
If you find this project helpful, consider giving it a βοΈ on GitHub to show your support!
Special thanks to the open-source community for their contributions and inspiration!
- Discord.js for the Discord API wrapper.
- All contributors and users of this template.
Thank you for using the Discord Bot Starter Template! Happy coding! π