I understand. You want the **"High-End" Code Generation Prompt** to feed into Replit's AI Agent. You want the advanced architecture (TypeScript, Prisma, Sapphire), not the basic "hello world" bot. Since Replit is best suited for a **Modular Monolith** (one repo, multiple logic controllers) rather than a distributed Kubernetes cluster, here is the **"Master Recipe"** designed to force Replit to build the Enterprise-Grade system you need. Copy and paste this entire block directly into the **Replit AI Agent**: ----- ### ๐Ÿค– THE REPLIT MASTER PROMPT **Role:** You are a Senior Backend Engineer specializing in Distributed Systems and Discord API (Discord.js v14). **Project Goal:** Build "Aethex Sentinel," a monolithic Discord bot that manages a federation of 5 distinct servers (Hub, GameForge, Foundation, Labs, Corp). **Tech Stack:** * **Language:** TypeScript (Node.js) * **Framework:** @sapphire/framework (for enterprise command handling) * **Database:** PostgreSQL (via Prisma ORM) * **State Management:** Map/Set (in-memory) or Redis (if available) for rate-limiting. **Architecture Requirements:** Do not write a single `index.ts` file. Structure this as a Modular Monolith. 1. **`/src/core`**: The bot client and database connection. 2. **`/src/modules`**: Separate folders for `Security`, `Federation`, `Commerce`, `Tickets`. 3. **`/src/listeners`**: Global event handlers. **Feature Specification (Implement these Logic Flows):** **1. The Federation Sync Module (Cross-Server Roles)** * Create a config object mapping Server IDs: `HUB_ID`, `FORGE_ID`, `FOUNDATION_ID`. * Create a `RoleMap` linking the "Global Citizen" Role ID in the Hub to the equivalent Role IDs in Forge and Foundation. * **Logic:** Listen for `guildMemberUpdate`. If a user gains the "Global Citizen" role in `HUB_ID`, automatically fetch that user in `FORGE_ID` and `FOUNDATION_ID` and assign the mapped role. Log this action to the console. **2. The Sentinel Module (Heuristic Security)** * Implement a "Heat System" for Anti-Nuke. * Create a `UserActivity` class that tracks actions (Channel Delete, Ban, Kick) in a rolling 10-second window. * **Heuristic:** If a user performs \> 3 "Dangerous Actions" in 5 seconds, automatically ban them and trigger a "LOCKDOWN" mode that removes all permissions from the `@everyone` role. **3. The Commerce Module (Ticket System)** * Create a Button Interaction Handler for `#hosting-support`. * When a user clicks "Rent Server," create a private thread. * Send an Embed with a mock "Invoice Generation" button. * **Database:** When a ticket is closed, save the transcript (text dump) to the PostgreSQL database linked to the User's ID. **4. The Dashboard Module (Status)** * Create a `cron` task that runs every 5 minutes. * Fetch the member counts of all 5 Guilds. * Update a specific Voice Channel name in the Hub to: `๐ŸŸข Network: [TotalMembers] Users`. **Output:** Scaffold the entire directory structure, install necessary dependencies (`discord.js`, `@sapphire/framework`, `prisma`, `typescript`), and write the code for the `index.ts`, `client.ts`, and the `FederationSync` listener. ----- ### ๐Ÿ› ๏ธ HOW TO DEPLOY THIS ON REPLIT Once the AI writes the code, you need to do 3 manual steps to make it "Enterprise": **1. The Database (Prisma)** Replit has a built-in PostgreSQL database now. * Open the **Shell** in Replit. * Run: `npx prisma init` * In the generated `schema.prisma` file, define your User model: ```prisma model User { id String @id // Discord ID heatLevel Int @default(0) balance Float @default(0.0) roles String[] // Array of synced roles } ``` * Run: `npx prisma db push` **2. The Config (Secrets)** Go to the **Secrets** (Lock icon) tab in Replit and add these variables. Do not hardcode them. * `DISCORD_TOKEN`: Your Bot Token. * `HUB_ID`: The ID of your Hub server. * `FORGE_ID`: The ID of your GameForge server. * `STRIPE_KEY`: (If you add real payments later). **3. The "Always On"** * Since this is a Monolith, it cannot sleep. You must use **Replit Deployments** (Reserved VM) to keep it running 24/7. The free tier will put the bot to sleep, killing your Anti-Nuke protection. ### ๐Ÿงช TESTING THE "MONOLITH" Once the code generates: 1. **Test Sync:** Give yourself the "Global Citizen" role in the Hub. Watch your bot automatically give it to you in GameForge. 2. **Test Nuke:** Create a test channel. Delete it 5 times quickly. See if the bot bans you (Make sure to whitelist yourself first\!).