This is a modular Discord.js v15 bot by Jonell Hutchin Magallanes with support for:
- Prefix commands (
!ping) - Mention commands (
@BotName ping) - Slash commands (
/ping) - Event system (custom
config + eventsformat) - Cooldown system
- JSON database (users, servers, stickers, emoji)
- Logging system
The bot is designed to be extensible, so you can add commands, slash commands, and events easily. Lightweight, so can run where the server you want like linux or localhost
-
Initialization
- Loads config from
config.json. - Starts the Discord client with required intents.
- Loads config from
-
Database System
- JSON files stored in
./database/json/. - Auto-created if missing.
- JSON files stored in
-
Command System
- Prefix commands: use
!command. - Mention commands: use
@BotName command. - Slash commands: use
/command.
- Prefix commands: use
-
Event System
- Events are stored in
./modules/events/. - Each event has its own
configandeventsfunction.
- Events are stored in
-
Cooldowns
- Prevents spam.
- Sends embed if command is on cooldown.
-
Logging
- Logs messages and command usage.
git clone https://github.com/jonellcc/Discord-Bot-CC.git
cd Discord-Bot-CCnpm installCreate config.json in the root directory:
{
"token": "YOUR_BOT_TOKEN",
"prefix": "!",
"autorestart": 0
}node index.js or npm startLocated in ./modules/commands/.
All commands work with prefix (!ping) and mention (@BotName ping).
Example: ping.js
module.exports = {
config: {
name: "ping",
aliases: ["p"],
description: "Replies with Pong!",
cooldown: 5,
usePrefix: true
},
letStart: async function ({ message }) {
await message.reply("π Pong!");
}
};β Usage:
!ping!p@BotName ping
Located in ./modules/events/.
Events use config + events structure.
Example: prefix.js
module.exports = {
config: {
name: "prefix",
description: "Displays the current command prefix."
},
events: ({ discord }) => {
const client = discord.client;
client.on("messageCreate", (message) => {
if (message.content === "!prefix" || message.content === `<@${client.user.id}> prefix`) {
const prefix = require("../../config.json").prefix;
message.reply(`π§ The current prefix is: \\`${prefix}\\``);
}
});
}
};β
Works with both !prefix and @BotName prefix.
Located in ./modules/slash/.
Example: hello.js
const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("hello")
.setDescription("Replies with a greeting!"),
async execute(interaction) {
await interaction.reply("π Hello there!");
}
};β Usage:
- Type
/helloin chat.
project-root/
βββ index.js
βββ config.json
βββ database/
β βββ json/
β βββ users.json
β βββ servers.json
β βββ stickers.json
β βββ emoji.json
βββ modules/
β βββ commands/
β β βββ ping.js
β βββ events/
β β βββ prefix.js
β βββ slash/
β βββ hello.js
βββ utils/
β βββ commandLoader.js
β βββ eventLoader.js
β βββ logger.js
- Prefix Commands:
!ping - Mention Commands:
@BotName ping - Slash Commands:
/ping - Events (
config + events): run automatically - Dynamic Command Reloading:
global.cc.reloadCommand("ping");
- Cooldown System: prevents spam, shows embed with remaining time
- JSON Database: auto-created for users, servers, stickers, emoji
β Your bot now supports:
- Prefix commands
- Mention commands
- Slash commands
- Custom event system
- Cooldowns
- JSON database