Its.. A discord bot, I use it for https://discord.gg/tokyoonline
Description
DiscordBot is a highly modular and permission‑aware Discord system built with Discord.js v14.
It is designed to be easy to extend, secure with permission checks, and simple to maintain while providing a smooth experience for both developers and staff teams.
- Commands are auto‑loaded from the
commandsandcogsfolders. - New commands can be added by simply dropping a file in – no core edits required.
- Supports both single‑file commands and multi‑command cogs.
- Every command automatically goes through the
CanRunCommandsystem. - Restrict usage to specific roles or ranks without touching command code.
- Prevents unauthorized access to sensitive commands effortlessly.
- Events are fully modular.
- Cogs can register multiple events or single legacy events with minimal boilerplate.
- Easy to scale as your bot grows in complexity.
- Slash commands are synced to Discord on startup.
- No manual registration or separate scripts needed.
- Keeps your commands always up‑to‑date with your code.
- Global error handlers for unhandled rejections and exceptions.
- Clear logging for command loading, events, and runtime issues.
- Reduces downtime and simplifies debugging.
- Organized project structure (
commands/,cogs/,helpers/). - Built‑in helpers like
registerCommandmake it simple to expand. .envsupport for safe and secure configuration.- Uses modern Discord.js features (GatewayIntents, Partials, Collections).
This bot is built for teams that want a powerful, flexible, and permission‑safe foundation.
You can easily add features, keep commands organized, and ensure only the right people can use them—all while benefiting from clean logging and stability safeguards.
Perfect for moderation systems, staff tools, or any project needing a reliable Discord backend.
DiscordBot Is A Modular, Permission‑Aware, And Developer‑Friendly Discord System Built With Discord.js v14.
This Documentation Explains How The Bot Is Structured, How Commands And Cogs Are Loaded, And What You Need To Do To Add Your Own Features.
root
│ .env
│ index.js // Main Bot File
│ package.json
│
├─ commands // Individual Slash Command Files
│ ping.js
│ ban.js
│ …
│
├─ cogs // Event‑Driven Or Multi‑Command Files
│ moderation.js
│ activityLogger.js
│ …
│
└─ helpers
RankChecker.js // Permission And Command Registration Helpers
-
Environment Setup
.envFile Loads Your Token And Secrets
TOKEN=your-bot-token-here -
Client Initialization
Client Is Created With GatewayIntents And Partials
Collections For client.Commands And client.Cogs Are Created -
Command Loader
Scans commands Directory And Loads Each File Exporting:
module.exports = {
data: new SlashCommandBuilder().setName('example').setDescription('…'),
async execute(interaction) { … }
}
Registers Each Command To client.Commands And Adds To slashCommandData -
Cog Loader
Scans cogs Directory And Attaches Events Automatically -
Slash Command Registration
Registers All Commands With:
await client.application.commands.set(slashCommandData); -
Interaction Handling
Checks Permissions With CanRunCommand Before Executing -
Global Error Handling
Catches unhandledRejection And uncaughtException And Logs Them Without Crashing
Create a new file in commands/:
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!');
}
};
Restart Bot → Command Is Registered Automatically
Create a new file in cogs/:
module.exports = {
name: 'WelcomeCog',
events: {
guildMemberAdd: async (client, member) => {
const channel = member.guild.systemChannel;
if (channel) channel.send(👋 Welcome, ${member}!);
}
}
};
Restart Bot → Event Handler Is Active
if (!CanRunCommand(interaction, interaction.commandName)) {
await interaction.reply({ content: '❌ You Do Not Have Permission.', ephemeral: true });
return;
}
Edit helpers/RankChecker.js To Customize Permissions
Restart Bot After Adding Commands Or Cogs
Test On A Private Server
Watch Console For ✅ Or ❌ Logs
✔️ Commands → Add File To commands/, Restart
✔️ Events → Add File To cogs/, Restart
✔️ Permissions → Edit RankChecker.js
✔️ Commands Auto‑Register On Startup
🚀 Extend Your Bot By Simply Creating A File!