A template for creating a Discord bot using Discord.js. This template includes command and event handling, database connection, and command deployment.
- Command handling (slash and context commands)
- Event handling
- Command deployment
- Database connection
-
Clone the repository:
git clone https://github.com/jmiccoDev/TemplateDiscordBot.git cd TemplateDiscordBot
-
Install dependencies:
npm install
-
Configure the bot:
- Rename
src/discord-config.example.json
tosrc/discord-config.json
. - Fill in the required fields (
token
,clientId
,guildIds
).
- Rename
-
Run the bot:
node index.js
or
npm run dev
- Add your commands in the
commands
directory. - Add your events in the
events
directory. - The bot will automatically deploy commands and connect to the database on startup.
Contributions are welcome! Feel free to open an issue or submit a pull request for any improvements or new features.
- Create a new file in the
commands
directory (eithercontext
orslash
subdirectory). - Define your command with
data
andexecute
properties. - The bot will automatically load and deploy the new command on the next startup.
- Create a new file in the
events
directory. - Define your event with
name
andexecute
properties. - The bot will automatically load the new event on the next startup.
- Modify the
connectDatabase
function inmodules/database-module.js
to connect to your desired database. - Ensure you have the necessary database configuration in place.
This project is open-source and available under the MIT License.
Feel free to modify and upgrade the project as needed. Any contributions are welcome!