Skip to content

Repository files navigation

Discord Bot Builder

Visual drag-and-drop Discord bot creation platform built with Next.js 16 (Turbopack), React 19, Discord.js v14, and MongoDB. ||No more coding needed!||

Node.js Next.js Discord.js License

Technical Overview

Discord Bot Builder is a multi-tenant platform designed to create, configure, and host custom Discord bots visually. Built-in node canvas editor allows designing complex event-driven workflows, slash commands, moderation rules, role assignments, and interactive components. ||No more coding needed!||

Bots are executed as isolated Node.js child processes with AES-256 encrypted token security, automatic slash command registration, live stdout process logging, and guild audit log integration.

Platform Features

  • Visual Graph Canvas: Drag-and-drop canvas powered by @dnd-kit for connecting triggers, dynamic variables, conditional logic, and action outputs without writing code.
  • Automated Slash Command Engine: Automatically registers slash commands with Discord API and inspects input blocks (get_command_input) to dynamically infer required option types (string, channel, user, role, number, boolean).
  • Interactive UI Component Suite: Build and handle Discord buttons (create_button, button_row), select menus (create_select_menu), and modal dialogs (open_modal, create_text_input).
  • Role & Member Moderation: Complete moderation suite including timeout_member, remove_timeout, kick_member, ban_member, unban_member, purge_messages, add_role, and remove_role with automatic target resolution for both triggering executors and specific users.
  • Guild Audit Log Resolver: Automatic audit log lookup for GuildRoleCreate, GuildRoleDelete, ChannelCreate, and ChannelDelete events to identify the executor.
  • Security & Process Isolation:
    • Bot tokens encrypted using AES-256 (CryptoJS) before database persistence.
    • Bots executed in dedicated child processes with isolated environments.
    • Rate-limited bot control endpoints and strict input sanitization to prevent path traversal.
  • Real-time Live Logs & Monitoring: Stream live stdout and stderr logs from running bot child processes directly in the dashboard UI.

System Requirements

Requirement Minimum Version Recommended Version
Node.js v18.17.0 v20.x or v22.x
npm / pnpm v9.0.0 v10.x
MongoDB v6.0 Local MongoDB or MongoDB Atlas
Discord.js v14.18.0 v14.18.0
Next.js v16.1.2 v16.1.2 (Turbopack)

Installation & Setup

  1. Clone the repository
git clone https://github.com/fczavian/DiscordBot-Builder.git
cd DiscordBot-Builder
  1. Install dependencies
npm install
  1. Environment Variables Setup Create a .env file in the root directory:
# Discord OAuth2 Credentials
DISCORD_CLIENT_ID=your_discord_client_id
DISCORD_CLIENT_SECRET=your_discord_client_secret

# NextAuth Configuration
NEXTAUTH_SECRET=your_32_character_random_secret_string
NEXTAUTH_URL=http://localhost:3000

# Security & Encryption Key (AES-256)
ENCRYPTION_KEY=your_custom_secret_encryption_key_2024

# Database Connection String
MONGODB_URI=mongodb://localhost:27017/discord-bot-builder
# For MongoDB Atlas: mongodb+srv://<username>:<password>@cluster.mongodb.net/discord-bot-builder
  1. Start Development Server
npm run dev

Open http://localhost:3000 in your browser.

  1. Production Build & Execution
npm run build
npm start

Discord Application Setup

  1. Navigate to the Discord Developer Portal and click New Application.
  2. Under OAuth2 $\rightarrow$ General:
    • Copy the Client ID and Client Secret into your .env file.
    • Add Redirect URI: http://localhost:3000/api/auth/callback/discord
  3. Under Bot:
    • Generate a Bot Token (copied and saved into individual bot settings in the dashboard).
    • Enable Privileged Gateway Intents:
      • Presence Intent
      • Server Members Intent
      • Message Content Intent

Complete Block Catalog (37+ Blocks)

||No more coding needed!|| Complete catalog of supported canvas blocks:

Triggers

  • on_message: Listens for message content matching a configured prefix (e.g. !hi).
  • on_command: Slash command trigger with automated option discovery.
  • on_reaction: Listens for specific emoji reactions on messages.
  • on_member_join: Triggers when a new member joins the server.
  • on_member_leave: Triggers when a member leaves the server.
  • on_button_click: Triggers when a user clicks a specific button component.
  • on_select_choose: Triggers when a user makes a selection from a dropdown menu.
  • on_modal_submit: Triggers when a user submits a modal popup form.
  • on_role_event: Triggers when a server role is created or deleted (with executor lookup).
  • on_channel_event: Triggers when a text/voice channel is created or deleted.
  • on_bot_startup: Executes actions automatically as soon as the bot logs in.

Variables & Data Extraction

  • get_command_input: Extracts string, channel, user, role, number, or boolean options from slash command interactions into {var:optionName} and {var:blockId}.
  • get_executor: Extracts username, ID, tag, mention, or avatar of the user executing the event.
  • get_user: Fetches target user information for executor or specific user ID.
  • get_server: Extracts server name, ID, or member count into {server.name}, {server.members}.
  • get_channel: Extracts channel name, ID, or mention formatting into {channel.name}, {channel.id}.
  • get_modal_value: Pulls text input values from submitted modal forms using custom IDs.
  • random_number: Generates a random integer between a configured minimum and maximum.
  • random_choice: Selects a random item from a comma-separated list of values.

Actions

  • send_message: Sends plain text or formatted messages to same channel, reply, specific channel, or direct message (DM).
  • send_embed: Constructs and sends rich embeds with titles, descriptions, hex colors, thumbnail URLs, image URLs, footers, and inline field arrays.
  • reply: Replies directly to a message or slash command interaction.
  • add_role: Assigns a server role to executor or specific user with mention stripping and name fallback.
  • remove_role: Removes a server role from executor or specific user.
  • delete_message: Deletes the triggering message or last sent message.
  • add_reaction: Adds an emoji reaction to the triggering message.

Interactive Components

  • create_button: Generates custom button components with style, label, custom ID, or URL.
  • button_row: Action row container for organizing up to 5 buttons per row.
  • create_select_menu: Dropdown select menu with placeholder and custom choice options.
  • open_modal: Modal popup form dialog with custom title and input fields.
  • create_text_input: Text input field for modal popups (short text or paragraph style).

Moderation & Utilities

  • timeout_member: Times out a member for a configured duration in minutes.
  • remove_timeout: Removes an active timeout from a member.
  • kick_member: Kicks a member from the server with a reason.
  • ban_member: Bans a member with reason and optional message deletion history days.
  • unban_member: Unbans a user by ID.
  • purge_messages: Bulk deletes up to 100 recent messages in a channel.
  • send_log: Sends structured log messages (INFO, WARN, ERROR) to a designated log channel.
  • create_channel: Creates a new text or voice channel.
  • delete_channel: Deletes a specified channel by ID.
  • rename_channel: Renames a channel.

Flow Control & Logic

  • if_condition: Evaluates condition types (equals, contains, startsWith, endsWith, hasRole, isBot, inChannel) and routes execution to then or else branches.
  • permission_check: Verifies if the member has specified permissions (e.g. ADMINISTRATOR, MANAGE_MESSAGES).
  • cooldown: Enforces user, channel, or guild rate limit cooldowns in seconds.
  • delay: Asynchronously pauses execution flow for a specified duration in milliseconds/seconds.
  • loop: Repeats connected child actions for a specified iteration count.

API Architecture

Endpoint Method Description
/api/bots GET, POST List user bots or create a new bot instance.
/api/bot/[id] GET, DELETE Fetch bot details or delete bot instance and stored features.
/api/bot/[id]/control POST Control bot lifecycle (start, stop, restart).
/api/bot/[id]/status GET Fetch bot execution status, uptime, and stdout logs.
/api/bot/[id]/token GET, POST Retrieve or securely save encrypted bot token.
/api/bot/[id]/features GET, POST List or save bot feature configurations.
/api/bot/[id]/features/[featureId]/blocks GET, POST Fetch or save block graph nodes and connections for a feature.

Security & Architecture Details

  1. Token Encryption: Bot tokens are encrypted using AES-256 before being written to MongoDB or disk storage.
  2. Process Sandboxing: Each running bot process is spawned as a separate Node.js child process using process.execPath and communicates via filesystem configuration files.
  3. Input Sanitization: Slash command names and option keys undergo regular expression sanitization (/[^a-z0-9_-]/g) and length enforcement to strictly comply with Discord API rules.

License

Distributed under the MIT License.

About

A visual drag-and-drop Discord bot creation platform built with Next.js 16, React 19, Discord.js v14, and MongoDB. Design, customize, and deploy fully functional Discord bots visually with 37+ built-in blocks for triggers, moderation, automated slash commands, role management, interactive UI components, flow control, and live process logs.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages