https://github.com/freecode911/domainforge
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.
https://github.com/freecode911/domainforge
cloudflare-api clouflare discord discord-py discordbot
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/freecode911/domainforge
- Owner: FreeCode911
- License: mit
- Created: 2024-09-11T14:19:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-13T10:18:31.000Z (over 1 year ago)
- Last Synced: 2025-04-05T18:14:27.458Z (about 1 year ago)
- Topics: cloudflare-api, clouflare, discord, discord-py, discordbot
- Language: Python
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# DomainForge v1.2
## 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](#features)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Commands](#commands)
- [Setup for Development](#setup-for-development)
- [Environment Variables](#environment-variables)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
## 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](https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=2147483648&scope=bot%20applications.commands) 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:
```bash
git clone https://github.com/your-username/domainforge.git
```
2. Install dependencies:
```bash
cd domainforge
pip install -r requirements.txt
```
### Environment Variables
3. Set up your `.env` file with the following variables:
```env
# 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
```
4. Run the bot:
```bash
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:
```python
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](LICENSE.md) file for details.
## Support
If you need help or have any questions, please join our [support server](https://discord.gg/your-support-server-invite).
---
Made with ❤ by LegendYt4k