A Feature-Rich, Multipurpose Discord Bot with 170+ Prefix and Slash Commands!
Built with Discord.js (v13), Node.js, and MongoDB. Includes Giveaways, Economy, Leveling, Server Backup, Reaction Roles, Tickets, AI Chatbot, and more.
- ๐ Overview
- ๐๏ธ Architecture
- โจ Core Features
- ๐ฆ Database Schemas
- ๐ Complex Commands & Systems Deep Dive
- ๐ง What I've Learnt Making This Project
- ๐ ๏ธ Tech Stack & Dependencies
- โก Installation & Hosting
Flame Bot is a high-performance, multipurpose Discord bot designed to provide an all-in-one package for guild management, member engagement, and utility tools. Leveraging the Discord v13 interaction paradigms (including Slash Commands, Context Menus, Select Menus, and Buttons), Flame Bot provides users with a fast, modern, and visually appealing user experience.
Flame Bot operates on a modular architecture divided into four main layers: Handlers, Commands, Events, and the Database (MongoDB).
graph TD
A[Discord API] -->|Events / Interactions| B[Client Listener]
B -->|interactionCreate| C[Slash & Context Menu Handler]
B -->|messageCreate| D[Prefix Command Handler]
C -->|Executes command| E[Commands Module]
D -->|Executes command| E
E -->|Database Queries| F[(Mongoose / MongoDB)]
E -->|External API Calls| G[External APIs]
E -->|Responds via Embeds/Components| A
- Command Loader / Handler: Uses
globto scan subdirectories withincommandsandSlashCommands, registering commands into adiscord.jsCollection. Normal command calls handle aliases, cooldown checks via MongoDB, maintenance toggles, and user/bot permission guards. - Event Loader: Dynamically requires all JS event modules inside the
events/folder at startup, hooking them onto thediscord.jsClient. - Database Integration: Powered by
mongoose, establishing persistent configurations, profiles, and state machines globally and per-guild. - Slash & Context Menu Execution: Registers server-specific slash commands for instant guild testing or global registration. Hooks user context menu interactions (like translation) directly to Discord UI menus.
Flame Bot features robust, command-based and slash-based moderation tools ensuring administrators keep servers clean and secure.
- Commands:
ban,kick,lock,unlock,timeout,purge,slowmode,warn,remove-warn,mute,unmute, andnuke(re-creates a channel clean). - Timed Mute Engine: Safely caches original roles in MongoDB before clearing them, creating a dedicated
Mutedrole override on all text channels, and restoring them automatically via a timer.
- Discord Together Games: Launch internal voice-channel gaming activities like YouTube Watch-Together, Poker, Fishington, Betrayal, Chess, Letter Tile, Word Snack, Spellcast, Awkword, and Doodle Crew using the
discord-togetherpackage. - Fun Commands:
8ball,advice,ascii,clyde,echo,emojify, andmemegenerator.
- Context Menu Translator: Right-click any text message inside Discord to automatically translate it to your user client's local region language using
@iamtraction/google-translate. - API Integrations: Uses Axio/Fetch to load up-to-date memes, advice cards, translated packages, and top.gg voting checks.
- Allows members to build a personalized user profile card accessible via
/profile. - Profile Configurations:
/set bio: Customize your profile bio (keeps lines clean via character splitting)./set color: Update profile embed colors using Hex Codes./set birthday: Store and display user birthdays./set banner: Set image background links (validates image formats like.png,.jpg,.gif)./set leveling: Enable or disable the leveling XP system for the guild.
- Auto Roles: Automatically assigns a configured role to members on join.
- Select-Menu Reaction Roles: Create modern, interactive dropdown lists where users select/toggle their roles without cluttering channels.
- Server Backups: Back up and restore guild channels, permissions, category trees, and base64-encoded server images.
- Interactive Ticket Panel: Configures a category, panel channel, staff role, and transcript logs channel. Members click a button to open a ticket, creating a locked channel with precise permission overrides. Closing a ticket prompts a double confirmation button, generates an HTML transcript of the messages, logs it, and cleans up the channel.
- Reputation & Suggestions: Send suggestions in dedicated channels with auto upvote/downvote buttons. Administrators review and reply using suggestion tokens, updating the embed status and informing the sender in DMs.
Flame Bot stores all data structures inside a MongoDB database, mapped out with schemas:
- afk.js: AFK status message, unix timestamp, and member tracking.
- Auto Role.js: Guild auto-role configurations.
- chatbot.js: Guild chatbot channel mapping.
- cmdcooldown.js: Tracks user cooldown states for prefix commands.
- keys.js: Unredeemed premium validation codes.
- level.js: Toggle state of the leveling system per guild.
- loggingSystem.js: Targets channels for logs.
- mute.js: Holds original user roles while muted.
- premium.js: Tracks users with active premium features.
- reactionroles.js: Dropdown choices and mapped roles.
- starboard.js: Guild starboard configurations.
- thank.js: Users' rep scores.
- ticket.js: Ticket setups.
- User Profile: Birthday, Bio, Color, and Banner models.
- Suggestion: Suggestion channels and logs mapped to distinct unique tokens.
- Path: server-backup.js
- Complexity: Connects with
discord-backupto capture entire server environments. Integrates multi-button verification ("Yes"/"No" double checks) using Discord component collectors. Automatically disables components after use to prevent click spam, exports base64 server graphics, and safely DMs the generated backup ID.
- Path: mute.js
- Complexity: Checks role-hierarchy differences before muting. Generates a custom
Mutedrole automatically if it doesn't exist, applying negative permission overrides (SEND_MESSAGES: false,ADD_REACTIONS: false) globally to all guild channels. Temporarily deposits all current roles in MongoDB, sets a timeout handler, and restores the exact role list even if the bot restarts.
- Path: translate.js
- Complexity: Registers as a Discord context action (
MESSAGEtype) instead of a standard slash query. Reads the client's current Discord application language context (interaction.locale), parses it to translate codes, translates the fetched message payload automatically, and sends back details of the translation in a colored embed.
- Path: rank.js
- Complexity: Gathers leveling data from
discord-xpand computes progress metrics. Feeds these variables intocanvacordto build custom canvas elements. Rather than static background assets, it picks a random background graphic from a pre-defined neon/cyberpunk asset array, producing unique rank card results.
- Path: leaderboard.js
- Complexity: A single command that hosts three distinct data sources (Leveling, Global Economy, and Reputation) behind a Select Menu component collector. It aggregates Mongoose document entries, sorts them dynamically, computes rank pages, fetches user entities from Discord, and updates active embeds on the fly.
- Path: suggestion.js
- Complexity: Auto-generates a secure 12-character token per suggestion. Fires suggestion embeds to targets and registers voting reaction hooks. Guild moderators use
/suggestion reply [token]to dynamically update the suggestion's status (e.g. from Pending to Approved/Replied) on the fly, editing the target channel embed and informing the submitter.
- Path: ticket.js
- Complexity: Saves configuration fields (Category, Panel, Staff, Log) to database structures. Button interactions trigger text channel generation. Generates ticket logging files in HTML via
discord-html-transcriptson ticket closure, sends logs to the moderator logging channel, and deletes the channel automatically.
- Asynchronous flow management & JavaScript Promises: Working with callbacks, event loops, timeouts, and handlers inside a real-time environment.
- Working with Discord.js interaction systems: Shifting from old prefix-based messaging parameters to slash command parameters, buttons, select menus, component collectors, and context actions.
- Database Management with MongoDB & Mongoose: Structuring schemas, caching live channel rules, running queries, updating values, and handling timeouts securely.
- Designing Permission-Heavy Scripts: Restructuring channel permissions for ticket locking and muted overrides while managing client/role hierarchies.
- Runtime Engine: Node.js (v16.x)
- Language: JavaScript (ES6+)
- Library: discord.js (v13.6.0)
- Database Client: mongoose (v6.0.14)
- Graphics rendering: canvacord
- APIs & Utility:
@iamtraction/google-translate,discord-together,discord-giveaways,discord-backup,discord-html-transcripts,currency-system