Skip to content

DomainForge, you can effortlessly create, manage, and organize subdomains directly from your Discord server.DomainForge, you can effortlessly create, manage, and organize subdomains directly from your Discord server.

License

Notifications You must be signed in to change notification settings

FreeCode911/DomainForge

Repository files navigation

DomainForge v1.2

DomainForge Logo

Project Summary

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!

Table of Contents

Features

  • 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.

v1.2 — Release notes

  • 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_manage now shows feature flags and quick toggle buttons.
  • Feature Flags: admin-controlled features such as request_subdomain_role are stored in data.json and editable via the dashboard.
  • Hidden Items: admins can mark certain embeds/items as hidden; these keys are stored in data.json and controllable via the dashboard.
  • Data persistence hardened: in-memory changes are flushed on shutdown and a periodic saver ensures data.json stays 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.

Getting Started

Prerequisites

  • A Discord server where you have administrative privileges.
  • A Cloudflare account with a domain you want to manage.

Installation

  1. Invite DomainForge to your Discord server.
  2. Use the /create_subdomain command to start creating subdomains.
  3. Follow the interactive prompts to specify domain, record type, and other details.

Commands

  • /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.

Setup for Development

  1. Clone this repository:

    git clone https://github.com/your-username/domainforge.git
  2. Install dependencies:

    cd domainforge
    pip install -r requirements.txt

Environment Variables

  1. Set up your .env file 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
  2. Run the bot:

    python bot.py
    

Using config.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. ```

Contributing

We welcome contributions to DomainForge! Please feel free to submit issues, fork the repository and send pull requests!

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Support

If you need help or have any questions, please join our support server.


Made with ❤ by LegendYt4k

About

DomainForge, you can effortlessly create, manage, and organize subdomains directly from your Discord server.DomainForge, you can effortlessly create, manage, and organize subdomains directly from your Discord server.

Topics

Resources

License

Stars

Watchers

Forks

Languages