DomainForge is a powerful and user-friendly Discord bot designed to streamline Cloudflare subdomain management directly from your Discord server. It empowers users to effortlessly create, manage, and organize subdomains, while providing administrators with robust control and monitoring capabilities. Say goodbye to tedious manual processes and embrace a seamless, Discord-integrated DNS management experience!
- Easy Subdomain Creation: Set up new subdomains with simple Discord commands, specifying the record type (A, CNAME, TXT, etc.).
- Role-Based Permissions: Control who can create subdomains using Discord roles for enhanced security.
- Centralized Management: Manage subdomains and admin settings from a single, interactive command.
- Cloudflare Integration: Seamless connection with Cloudflare for reliable DNS management.
- Improved, consistent embed styling across all user and admin interactions.
- Added Subdomain Rename: admins and owners can rename a subdomain (implemented as create+delete with audit comment).
- Admin Dashboard:
/admin_managenow shows feature flags and quick toggle buttons. - Feature Flags: admin-controlled features such as
request_subdomain_roleare stored indata.jsonand editable via the dashboard. - Hidden Items: admins can mark certain embeds/items as hidden; these keys are stored in
data.jsonand controllable via the dashboard. - Data persistence hardened: in-memory changes are flushed on shutdown and a periodic saver ensures
data.jsonstays up-to-date (prevents loss of user subdomain lists when the bot stops).
See the "Admin Dashboard" section below for how to toggle features and hidden items.
- A Discord server where you have administrative privileges.
- A Cloudflare account with a domain you want to manage.
- Invite DomainForge to your Discord server.
- Use the
/create_subdomaincommand to start creating subdomains. - Follow the interactive prompts to specify domain, record type, and other details.
/create_subdomain: Start the subdomain creation process (specify record type)./manage_subdomain: Manage a specified subdomain./admin_manage: (Admin only) Access administrative functions./whois: (Admin only) Look up the owner of a specific subdomain./request_subdomain_role: Request the subdomain creation role.
-
Clone this repository:
git clone https://github.com/your-username/domainforge.git
-
Install dependencies:
cd domainforge pip install -r requirements.txt
-
Set up your
.envfile with the following variables:# Create a .env file in the same directory as bot.py # Add the following variables to the .env file: # Discord Bot Token: Obtain this from the Discord Developer Portal (https://discord.com/developers/applications) DISCORD_BOT_TOKEN=Your Discord bot token # Cloudflare API Token: Generate a token with Edit zone DNS permission (Permissions - Zone.DNS,Zone.DNS) ( Resources - All zones ) at https://dash.cloudflare.com/profile/api-tokens CLOUDFLARE_API_TOKEN=Your Cloudflare API token # Comma-separated list of role IDs that can create subdomains. To get a role ID, enable developer mode in Discord (Settings > Advanced) and right-click the role and select "Copy ID" SUBDOMAIN_CREATION_ROLES=Comma-separated list of role IDs that can create subdomains # The channel ID where subdomain role requests are sent. To get a channel ID, enable developer mode in Discord (Settings > Advanced) and right-click the channel and select "Copy ID" ADMIN_CHANNEL_ID=The channel ID where subdomain role requests are sent
-
Run the bot:
python bot.py
config.py loads environment variables from .env and exposes them as module-level constants.
Example usage in other modules:
from config import DISCORD_BOT_TOKEN, CLOUDFLARE_API_TOKEN, SUBDOMAIN_CREATION_ROLES
print(DISCORD_BOT_TOKEN) # use with your Discord client setup
if SUBDOMAIN_CREATION_ROLES:
print('Subdomain creation is restricted to roles:', SUBDOMAIN_CREATION_ROLES)All common configuration names are defined in config.py and are safe to import
from anywhere in the project. Keep your .env secret and never commit it.
```
We welcome contributions to DomainForge! Please feel free to submit issues, fork the repository and send pull requests!
This project is licensed under the MIT License - see the LICENSE.md file for details.
If you need help or have any questions, please join our support server.
Made with ❤ by LegendYt4k
