This repository contains a bot template for discord.js@v14. It use external handler (developped by cleboost djs-core ans some submodule). The bot is designed with a handler to easily create commands, buttons, selections and other fun interactions.
Before using this bot, make sure you have:
- Bun.js (min v18): To run bot. (Djs-core is not compatible with Node.js)
- Clone this repository to your local system.
- Open the project in your IDE.
- Install dependencies with
bun icommand. - Start bot with
bun start.
- Build the project with
bun run build - You can now run the bot with
bun dist/index.js
- 🏓 /ping Displays bot latency (in ms)
- 🔍 /autocomplete Demo command showcasing autocomplete functionality
- Example commands for various options (need update of djs-core but planned)
- Admin category commands are not shown in /help and require being registered (Discord ID) in the
config.jsonowner array 👑 - Commands marked as
devOnly: truerequire being a developer to execute and should be registered in theconfig.jsondev array 💻 - Configurations are cached in the client, accessible by
client.config - DB is cached in the client, accessible by
client.db - Cooldown is in seconds but resets on each bot restart; it's disabled for devOnly commands ⏱️
- You can launch the bot with
npm run dev, in which case the bot restarts with each save you make, otherwise usenode index.jsornpm run start - Buttons and commands can have categories: create a folder and place the file inside (see examples)
- Debug mode enabled by default, configuration in
.env
This projet allow you to create sub command like /command subcommand. To do it, you can check exemple in src/interactions/commands/utils/handler.ts and src/interactions/commands/utils/handler/button.ts
As you can see, you need to create the regitred command where you define name of your command, description, default permission, sub command. In subfolder with same name of your command, you can create subcommand. Subcommand files need to have same name of the subcommand.
This project includes an autocomplete demo command that shows how to implement interactive command options. Check the example in src/interactions/commands/utils/autocomplete.ts to see how to:
- Add string options with
.setAutocomplete(true) - Handle autocomplete interactions with
.autoComplete()method - Provide dynamic suggestions to users as they type
Contributions are welcome! If you want to improve this bot or add new features, feel free to submit a pull request.
This project is licensed under MIT - see the LICENSE link for more details. 📜