Skip to content

jonellcc/Discord-Bot-CC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Discord Bot Documentation

πŸš€ Introduction

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 + events format)
  • 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

βš™οΈ How It Works

  1. Initialization

    • Loads config from config.json.
    • Starts the Discord client with required intents.
  2. Database System

    • JSON files stored in ./database/json/.
    • Auto-created if missing.
  3. Command System

    • Prefix commands: use !command.
    • Mention commands: use @BotName command.
    • Slash commands: use /command.
  4. Event System

    • Events are stored in ./modules/events/.
    • Each event has its own config and events function.
  5. Cooldowns

    • Prevents spam.
    • Sends embed if command is on cooldown.
  6. Logging

    • Logs messages and command usage.

▢️ How to Run

1. Clone the Repository

git clone https://github.com/jonellcc/Discord-Bot-CC.git
cd Discord-Bot-CC

2. Install Dependencies

npm install

3. Configure config.json

Create config.json in the root directory:

{
  "token": "YOUR_BOT_TOKEN",
  "prefix": "!",
  "autorestart": 0
}

4. Start the Bot

node index.js or npm start

πŸ“œ How to Make Commands & Events

1. Prefix + Mention Commands

Located 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

2. Event Commands

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.


3. Slash Commands

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 /hello in chat.

πŸ“‚ Folder Structure

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

πŸ› οΈ Features

  • 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

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages