Discord.js v14 Command Handler - By Captain
π A powerful and customizable command handler for Discord.js v14, made to be both flexible and efficient.
π¨βπ» Created by Captain @toorecap (me ofc), this handler supports message and slash commands, event handling, and advanced bot functionality with ease.
βοΈ If you enjoyed the project, please give it a star by clicking the button at the top right of the page.
π Thank you!
-
Command Handler
- Supports both slash commands and message commands.
- Organize commands in subfolders to define categories.
- Categories include: (can create more categories)
- Fun (for both message and slash commands)
- Info (for both message and slash commands)
- Example Commands:
- Info Category:
help
- Shows all bot's commands.ping
- Check the bot's latency.uptime
- Displays the bot's uptime.
- Fun Category:
pp
- A very advanced command with special features.
- Info Category:
-
Extensive Configuration
- A comprehensive config file with numerous customizable options.
-
Event Handling
- Easily manage events with a structured event handler.
-
Advanced Console Logs
- Uses chalk for colorful and easy-to-read logs.
- Enhanced logging with boxen for better visibility during bot operations.
Customize the behavior of the command handler by adjusting the configuration options in config.js. Below is a summary of each configuration category and its options:
// General Configs
module.exports = {
prefix: `$`,
clientId: ``, // bot id
token: ``, // bot token
ownerID: ``, // your id (cannot add multiple)
guildId: '', // Enter a guild ID for guild-specific commands, or leave it blank to load slash commands globally.
prefix
: The prefix used to trigger commands (default:$
).clientId
: Your bot's ID (required to run the bot).token
: Your bot's token (required to run the bot).ownerID
: Your Discord user ID (only one ID allowed).guildId
: Your Server's ID for Server specific commands, or leave it blank to load slash commands globally.
developerTeam: {
memberIDs: [], // add the user IDs of the developer team (can add multiple)
roleIDs: [], // add the role IDs of the developer team (can add multiple)
},
developerTeam.memberIDs
: An array of user IDs who are part of the developer team (multiple IDs allowed).developerTeam.roleIDs
: An array of role IDs assigned to the developer team (multiple IDs allowed).
// Bot Embed Configs
EmbedConfig: {
embedcolor: `#9b59b6`, // default embed color
},
EmbedConfig.embedcolor
: Default color for embeds (default:#9b59b6
).
// Cooldown Configs
CooldownConfig: {
defaultCooldown: 5, // default cooldown for commands (in seconds)
autoDeleteCooldownMsg: 10 // auto delete the cooldown response (in seconds)
},
CooldownConfig.defaultCooldown
: Default cooldown for commands in seconds (default: 5 seconds).CooldownConfig.autoDeleteCooldownMsg
: Time in seconds before auto-deleting the cooldown message (default: 10 seconds).
// Responses Config
ResponsesConfig: {
botowneronly: {
reply: `This command is restricted to the bot owner.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
serverowneronly: {
reply: `This command is restricted to the server owner.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
developerteamonly: {
reply: `This command is restricted to the developer team.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
nsfw: {
reply: `This command can only be used in NSFW channels.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
memberpermissions: {
reply: `You don't have the necessary permissions to use this command.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
botpermissions: {
reply: `I don't have the necessary permissions to execute this command.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
requiredroles: {
reply: `You don't have the required role(s) to use this command.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
requiredchannels: {
reply: `This command can only be used in specific channels.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
},
alloweduserids: {
reply: `You are not allowed to use this command.`,
autoDelete: 10, // in seconds
shouldAutoDelete: true
}
}
}
-
ResponsesConfig.botowneronly.reply
: Message for commands restricted to the bot owner. -
ResponsesConfig.botowneronly.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.botowneronly.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.serverowneronly.reply
: Message for commands restricted to the server owner. -
ResponsesConfig.serverowneronly.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.serverowneronly.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.developerteamonly.reply
: Message for commands restricted to the developer team. -
ResponsesConfig.developerteamonly.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.developerteamonly.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.nsfw.reply
: Message for commands that can only be used in NSFW channels. -
ResponsesConfig.nsfw.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.nsfw.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.memberpermissions.reply
: Message for insufficient permissions. -
ResponsesConfig.memberpermissions.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.memberpermissions.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.botpermissions.reply
: Message for missing bot permissions. -
ResponsesConfig.botpermissions.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.botpermissions.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.requiredroles.reply
: Message for missing required roles. -
ResponsesConfig.requiredroles.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.requiredroles.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.requiredchannels.reply
: Message for commands that can only be used in specific channels. -
ResponsesConfig.requiredchannels.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.requiredchannels.shouldAutoDelete
: Whether the response should auto-delete (default: true). -
ResponsesConfig.alloweduserids.reply
: Message for users not allowed to use the command. -
ResponsesConfig.alloweduserids.autoDelete
: Time in seconds to auto-delete the response (default: 10 seconds). -
ResponsesConfig.alloweduserids.shouldAutoDelete
: Whether the response should auto-delete (default: true).
Contributions are welcome! Please follow these guidelines:
-
Fork the Repository:
- Click the "Fork" button at the top-right of the repository page to create your copy.
-
Create a New Branch:
- Create a new branch for your changes:
git checkout -b my-feature-branch
- Create a new branch for your changes:
-
Make Your Changes:
- Implement your changes or new features.
-
Commit and Push:
- Commit your changes and push to your forked repository:
git add . git commit -m "Add new feature" git push origin my-feature-branch
- Commit your changes and push to your forked repository:
-
Submit a Pull Request:
- Open a pull request from your branch to the
main
branch of the original repository.
- Open a pull request from your branch to the
If you have any questions or need support with this project, feel free to join our Discord server. For issues or bugs, please visit the issues section and submit a new issue.