Introduction and Features Overview
Relevant source files
The following files were used as context for generating this wiki page:
Red Discord Bot is a modular, self-hosted Discord bot built with Python and the discord.py library. The system provides a customizable foundation where users enable or disable specific features, known as "cogs," to suit their server's needs. The bot supports a wide range of functionalities, including moderation, music playback, trivia, and custom command creation.
Sources: README.md:1-40, redbot/init.py:18-25
Core Architecture and Modularity
The bot operates on a modular architecture where the Core cog manages basic bot functionality, while additional features are implemented as independent plugins. This design allows for high customization and extensibility.
Cog Management
The Core logic handles the loading, unloading, and reloading of cog packages. It verifies package names, checks for valid specifications, and manages the bot's internal registry of loaded extensions.
The diagram shows how user commands flow through the Core cog to manage various extensions that interact with Discord.
Sources: redbot/core/core_commands.py:112-250, README.md:58-64
System Features
Red includes several default modules that provide essential services to server administrators and users.
| Feature | Description | Relevant Module |
|---|---|---|
| Moderation | Includes kick, ban, mod-log, filter, and chat cleanup. | redbot.core.modlog |
| Bank | Manages a virtual economy with user credits and slot machines. | redbot.core.bank |
| Music | Supports YouTube, SoundCloud, local files, and playlists. | Music Cog |
| Trivia | Provides customizable trivia sessions with JSON-based lists. | Trivia Cog |
| Admin | Handles self-role assignment and cross-server announcements. | Admin Cog |
Sources: README.md:42-56, redbot/core/core_commands.py:1016-1050
Versioning and Requirements
Red requires Python 3.8.1 or greater and utilizes a structured VersionInfo system to track releases, including alpha, beta, and release candidate stages.
Versioning Logic
The VersionInfo class parses version strings and manages metadata such as commit hashes and dev-release statuses. It ensures the environment meets the MIN_PYTHON_VERSION of 3.8.1.
This class diagram represents the structure used to manage bot versions and ensure compatibility.
Sources: redbot/init.py:18-70, CONTRIBUTING.md:42-45
Command and Interaction System
The bot uses a sophisticated command system that handles both traditional prefix-based commands and modern Discord slash commands.
Embed and Help Settings
Administrators can configure how the bot displays information through extensive embed settings and a customizable help menu.
- Embed Settings: Configurable at global, guild, channel, and user levels.
- Help Menus: Supports buttons, reactions, and select menus for navigation.
The flow shows the steps taken to process and display help information to a user.
Sources: redbot/core/commands/help.py:74-130, redbot/core/core_commands.py:644-700
Security and Data Management
Red incorporates features for end-user data privacy and owner security notifications.
- Data Deletion: Supports
mydata forgetmeto remove non-operational user data. - Access Control: Includes allowlists and blocklists to manage which users or roles can interact with the bot.
- Privacy: Provides
tracebackcommands to view errors in DMs, preventing sensitive info leaks in public channels.
Sources: redbot/core/core_commands.py:469-530, redbot/core/core_commands.py:1653-1700
Summary
Red Discord Bot functions as a highly customizable framework for community management. By utilizing a modular cog system, it allows server owners to build a bespoke bot experience while maintaining a secure and stable core architecture.
Sources: README.md:30-40, CONTRIBUTING.md:15-30