therynzo

Create a professional, all-in-one Discord bot named "TheRynzo PteroControl Bot", built using Python with discord.py (v2.x, slash commands support) and integrated with the Pterodactyl Panel API (Client + Application API).

The bot must be modular, scalable, secure, and production-ready, with a clean architecture and support for environment configuration using a ".env" file.

---

Core Requirements

  • Use Python 3.10+
  • Use discord.py with slash commands (app_commands)
  • Use async/await properly
  • All bot responses must use rich embed messages
  • Embeds must be modern, clean, and include appropriate emojis
  • No emojis should be used outside embeds
  • Strong error handling and logging system
  • No hardcoded secrets (use .env)
  • Fully configurable via admin-only commands or config system

---

Features

  1. Node Status Monitoring
  • Command: /nodes
  • Display:

- Node name - Status (online/offline) - CPU usage - RAM usage

  • Automatic updates:

- Update every 3 minutes - Send or edit embed in configured channel

  • Admin command:

- /set-node-status channel:<channel>

---

  1. Pterodactyl Account Generator
  • Command: /createuser user:<discord_user>
  • Features:

- Generate random email using domain: @therynzo.io - Generate secure random password - Create account via Pterodactyl API - Send credentials via DM using embed

  • Requirements:

- Prevent duplicate account creation per user - Store user mapping in database

---

  1. Server Management System
  • Command: /manage
  • Features:

- Show user's servers - Interactive embed with buttons: - Start - Stop - Restart - Console

  • Display:

- Server status - CPU, RAM, Disk usage

  • Console:

- Fetch latest logs - Optional live updates

---

  1. Economy System
  • Currency: Coins
  • Commands:

- /balance - /leaderboard - /bank

  • Earning:

- /daily โ†’ 20โ€“50 coins - /work โ†’ 40โ€“75 coins - Work cooldown: 30 minutes

  • Admin:

- /add-coin user:<user> amount:<number>

  • Store all data in database

---

  1. Shop System (Minecraft Server Plans)
  • Command: /shop
  • Display:

- Plan name - RAM - CPU - Disk - Price

  • Purchase:

- /buy plan:<name>

  • Logic:

- Check user balance - Deduct coins - Automatically create server via Pterodactyl API - Assign server to user

---

  1. Admin Configuration
  • Command: /edit-shop
  • Admin-only features:

- Add/edit/remove server plans - Configure rewards - Set log channels - Enable/disable features

  • Role-based permission system

---

Additional Requirements

  • Use slash commands only
  • Use cooldowns where needed
  • Use database (SQLite or MongoDB)
  • Include logging system
  • Include retry handling for API errors
  • Ensure performance and security best practices

---

Output Expectations

  • Full working source code
  • Clean and readable code
  • Ready to deploy on Pterodactyl (Python environment)
  • Include setup instructions
  • Include requirements.txt
  • Include .env.example

---

The bot must be designed as a professional hosting control system with clean UI, efficient performance, and reliable backend logic.

5 images attached
Kodari AI
KodariMay 4 at 4:21 pm 29,243 (v2)
TheRynzoPteroControlBot
A professional all-in-one Discord bot for Pterodactyl panel hosting control. Features node status monitoring with auto-updates, Pterodactyl account generation, interactive server management (start/stop/restart/console), a coin-based economy (daily/work/bank/leaderboard), and a Minecraft server plan shop that auto-provisions servers via the Pterodactyl API. Admin commands allow full configuration of shop plans, rewards, and log channels. Built with discord.py v2 slash commands and SQLite.

Hereโ€™s the full project plan before writing any code:

  • main.py โ€” entry point, loads cogs, starts bot

  • database.py โ€” SQLite manager (users, economy, servers, plans, config)

  • pterodactyl.py โ€” async API wrapper for Client + Application API

  • cogs/nodes.py โ€” /nodes, /set-node-status-channel, background task

  • cogs/account.py โ€” /createuser

  • cogs/manage.py โ€” /manage with button UI

  • cogs/economy.py โ€” /balance, /daily, /work, /leaderboard, /bank, /add-coin

  • cogs/shop.py โ€” /shop, /buy

  • cogs/admin.py โ€” /edit-shop and full admin config

  • .env.example, requirements.txt, README.md

The full bot is ready. Hereโ€™s a summary of what was built:

  • main.py โ€” Async bot entry point, loads all cogs, syncs slash commands on startup

  • database.py โ€” Fully async SQLite manager covering users, economy, servers, plans, and config with auto-seeded default plans

  • pterodactyl.py โ€” Async API wrapper with retry logic for both Application and Client APIs

  • cogs/nodes.py โ€” /nodes slash command + tasks.loop every 3 minutes auto-editing a status embed; /set-node-status-channel for admin setup

  • cogs/account.py โ€” /createuser generates a random @therynzo.io email + secure password, creates the account via API, DMs credentials, prevents duplicates

  • cogs/manage.py โ€” /manage shows live CPU/RAM/disk/status with Start/Stop/Restart/Console buttons via discord.ui.View

  • cogs/economy.py โ€” Full economy: /balance, /daily, /work (30min cooldown), /leaderboard, /bank, /deposit (2% fee), /withdraw (1% fee), /add-coin (admin)

  • cogs/shop.py โ€” /shop renders all plans as a rich embed; /buy deducts coins, provisions a server via Pterodactyl App API, records ownership

  • cogs/admin.py โ€” /edit-shop add/remove/list, /set-log-channel, /configure โ€” all administrator-only

therynzo

Like /shop have a server plans ram CPU disks same like Starter like have 1gb ram 1 core 5 disk is just I show you how to work ok then any member have 300 coin to buy this used /buy plan: select and it automatic deploy same space server for the pterodactyl panel on this user to buy the server then he can /manage to like you no how to it like other bot ok add deploy automatic server ok and all server deploy

1 image attached
Kodari AI
KodariMay 4 at 5:10 pm 40,142 (v2)

The error means the server creation payload is using Pterodactylโ€™s auto-deploy feature but missing required deploy parameters (location IDs, port range, etc.), OR the plan specs exceed whatโ€™s on the node. Let me read the current files first.

The root cause is clear: the deploy block in app_create_server asks Pterodactyl to auto-find a node, but it fails when no node satisfies the resource constraints, or the location ID is wrong. The fix is to stop using auto-deploy and instead:

  1. Fetch the actual free allocations from a specific node

  2. Use a hard allocation ID in the payload (most reliable)

  3. Fetch the real egg startup + docker_image from the API so it matches the egg

  4. Add node_id + nest_id defaults to .env and plans table

Hereโ€™s every file that needs to change:

Now I have the full picture. Hereโ€™s the plan:

  • pterodactyl.py: Add app_get_node_allocations() + app_get_egg(), rewrite app_create_server() to use a real allocation ID instead of deploy

  • database.py: Add node_id column to plans, update seed + upsert

  • cogs/shop.py: Resolve free allocation from node before creating server, fetch real egg startup/docker

  • cogs/admin.py: Add node_id param to /edit-shop add

  • .env.example: Add PTERO_DEFAULT_NODE_ID + PTERO_DEFAULT_NEST_ID

Now update database.py to add the node_id column, keep everything backward-compatible with ALTER TABLE IF NOT EXISTS:

Now rewrite cogs/shop.py to resolve a real free allocation before creating the server:

Now add node_id to the admin /edit-shop add command:Let me do all the file changes properly using update tags:

Hereโ€™s exactly what was fixed and why:


Root Cause

The old app_create_server used Pterodactylโ€™s auto-deploy feature ("deploy": {"locations": [id], ...}). This tells the panel โ€œfind me a node in this location that has enough resources freeโ€. It fails with 400 โ€“ No nodes satisfying requirements when:

  • The location ID is wrong/empty

  • The node doesnโ€™t have enough free overhead

  • The panelโ€™s auto-deploy algorithm is stricter than expected

What changed

File
Change
pterodactyl.py
Added
app_get_node_allocations(node_id)
and
app_get_free_allocation(node_id)
โ€” fetches real port allocations from a specific node and picks the first unassigned one. Added
app_get_egg(nest_id, egg_id)
โ€” fetches the real startup command and docker image from the egg. Rewrote
app_create_server
to use
"allocation": {"default": allocation_id}
instead of
"deploy"
โ€”
this is the definitive fix
.
cogs/shop.py
/buy
now: (1) resolves a free allocation from the node, (2) fetches the eggโ€™s real startup/docker/env, (3) passes all of it to
app_create_server
. Each step has its own clear error message with actionable advice.
database.py
Added
node_id
column to
plans
table. Added
_migrate()
so existing
data.db
files are updated automatically without data loss.
cogs/admin.py
/edit-shop add
now includes
node_id
and
nest_id
as required parameters so admins can create plans pointing at specific nodes.
.env.example
Added
PTERO_DEFAULT_NODE_ID
and
PTERO_DEFAULT_NEST_ID
with clear comments explaining how to find each ID in the panel.

Setup steps to make /buy work

  1. Set PTERO_DEFAULT_NODE_ID in .env to your actual nodeโ€™s ID (Pterodactyl Admin โ†’ Nodes โ†’ click node โ†’ ID in URL)

  2. Set PTERO_DEFAULT_NEST_ID and PTERO_DEFAULT_EGG_ID to match the egg you want (Admin โ†’ Nests)

  3. Make sure your node has at least one free allocation (Admin โ†’ Nodes โ†’ your node โ†’ Allocations tab โ†’ add a port range like 25565โ€“25600)

therynzo

Can you All plans add more 150 coin high price and add prefix system all cmd work on prefix is . And make .help embed to show all cmd and normal user cmd and admin cmd and add 2 more cmd like this .create paid (email) (password) (ram) (cpu) (disk) (node) like User Paid 1 number and other ram CPU like this 1024 ramk CPU 100 like this other and node is 1,2 ok and add this cmd .create free (email) (password) (ram) (cpu) (disk) (node) all same just change Paid 1 to Free 1 number ok and other is same and add .env files owner,CEO,admin user id to Used admin cmd ok and other old function don't remove ok also add all cmd in / cmd ok make good and premium looking .help embed massage ok and add .rob system like image showing it have 50% win or 50% los and you los .rob failed get fine charge 10-50 coins ok and you win max rate coin win 300 coin and min 10 coin ok all make premium ok

2 images attached
therynzo

Can you All plans add more 150 coin high price and add prefix system all cmd work on prefix is . And make .help embed to show all cmd and normal user cmd and admin cmd and add 2 more cmd like this .create paid (email) (password) (ram) (cpu) (disk) (node) like User Paid 1 number and other ram CPU like this 1024 ramk CPU 100 like this other and node is 1,2 ok and add this cmd .create free (email) (password) (ram) (cpu) (disk) (node) all same just change Paid 1 to Free 1 number ok and other is same and add .env files owner,CEO,admin user id to Used admin cmd ok and other old function don't remove ok also add all cmd in / cmd ok make good and premium looking .help embed massage ok and add .rob system like image showing it have 50% win or 50% los and you los .rob failed get fine charge 10-50 coins ok and you win max rate coin win 300 coin and min 10 coin ok all make premium ok

2 images attached
Kodari AI
KodariMay 17 at 9:14 am 41,863 (v2)

Let me read all the current files first.

Now I have a full picture of everything. Hereโ€™s my plan:

  • main.py: Change prefix to ., add message_content intent, add on_command_error handler

  • database.py: Update seed plans with +150 coins each, add last_rob column to economy, add set_last_rob method

  • cogs/economy.py: Add .rob prefix command + /rob slash command with 50/50 win/loss, fine 10-50 on loss, win 10-300 coins, 30-min cooldown

  • cogs/account.py: Add .create paid and .create free prefix commands + slash equivalents, role-based admin check using .env IDs

  • cogs/help.py: New cog with premium .help embed showing all commands split by user/admin

  • cogs/admin.py / all cogs: Add role-based admin check from .env OWNER/CEO/ADMIN IDs

  • .env.example: Add OWNER_IDS, CEO_IDS, ADMIN_IDS

Now update main.py to change prefix to ., add message_content intent, load help cog, and add on_command_error:

Now update database.py to bump plan prices +150, add last_rob column and method:

Now update cogs/economy.py to add the .rob prefix command + /rob slash command, and add a shared admin check using .env IDs:

[Generation stopped]

therynzo

Can you All plans add more 150 coin high price and add prefix system all cmd work on prefix is . And make .help embed to show all cmd and normal user cmd and admin cmd and add 2 more cmd like this .create paid (email) (password) (ram) (cpu) (disk) (node) like User Paid 1 number and other ram CPU like this 1024 ramk CPU 100 like this other and node is 1,2 ok and add this cmd .create free (email) (password) (ram) (cpu) (disk) (node) all same just change Paid 1 to Free 1 number ok and other is same and add .env files owner,CEO,admin user id to Used admin cmd ok and other old function don't remove ok also add all cmd in / cmd ok make good and premium looking .help embed massage ok and add .rob system like image showing it have 50% win or 50% los and you los .rob failed get fine charge 10-50 coins ok and you win max rate coin win 300 coin and min 10 coin ok all make premium ok

2 images attached
Kodari can make mistakes. Review important code before using.
Files
cogs
database.py
main.py
pterodactyl.py
README.md
requirements.txt
Code
13 1,862
main.py
import asyncio
import logging
import os
import sys

import discord
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()

LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper()
logging.basicConfig(
    level=getattr(logging, LOG_LEVEL, logging.INFO),
    format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
    handlers=[
        logging.StreamHandler(sys.stdout),
        logging.FileHandler("bot.log", encoding="utf-8"),
    ],
)
log = logging.getLogger("bot")

COGS = [
    "cogs.nodes",
    "cogs.account",
    "cogs.manage",
    "cogs.economy",
    "cogs.shop",
    "cogs.admin",
    "cogs.help",
]


class PteroBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.members = True
        intents.message_content = True
        super().__init__(command_prefix=".", intents=intents, help_command=None)

    async def setup_hook(self):
        from database import Database
        self.db = Database()
        await self.db.init()

        for cog in COGS:
            try:
                await self.load_extension(cog)
                log.info(f"Loaded cog: {cog}")
            except Exception as e:
                log.error(f"Failed to load cog {cog}: {e}", exc_info=True)

        await self.tree.sync()
        log.info("Slash commands synced.")

    async def on_ready(self):
        log.info(f"Logged in as {self.user} (ID: {self.user.id})")
        await self.change_presence(
            activity=discord.Activity(
                type=discord.ActivityType.watching,
                name="Pterodactyl Panel | .help",
            )
        )

    async def on_command_error(self, ctx: commands.Context, error):
        if isinstance(error, commands.CommandNotFound):
            return
        if isinstance(error, commands.MissingRequiredArgument):
            embed = discord.Embed(
                title="โŒ Missing Argument",
                description=f"Missing required argument: `{error.param.name}`\nUse `.help` to see command usage.",
                color=discord.Color.red(),
            )
            await ctx.send(embed=embed)
            return
        if isinstance(error, commands.CheckFailure):
            embed = discord.Embed(
                title="๐Ÿ”’ Access Denied",
                description="You don't have permission to use this command.",
                color=discord.Color.red(),
            )
            await ctx.send(embed=embed)
            return
        embed = discord.Embed(
            title="โš ๏ธ Error",
            description=str(error),
            color=discord.Color.red(),
        )
        await ctx.send(embed=embed)
        log.error(f"Command error: {error}", exc_info=True)

    async def on_app_command_error(self, interaction: discord.Interaction, error: discord.app_commands.AppCommandError):
        embed = discord.Embed(
            title="โš ๏ธ Error",
            description=str(error),
            color=discord.Color.red(),
        )
        try:
            if interaction.response.is_done():
                await interaction.followup.send(embed=embed, ephemeral=True)
            else:
                await interaction.response.send_message(embed=embed, ephemeral=True)
        except Exception:
            pass
        log.error(f"App command error: {error}", exc_info=True)


async def main():
    token = os.getenv("DISCORD_TOKEN")
    if not token:
        log.critical("DISCORD_TOKEN is not set in .env")
        sys.exit(1)

    async with PteroBot() as bot:
        await bot.start(token)


if __name__ == "__main__":
    asyncio.run(main())