sinnalwayssimle
📎 1 file 5,305 chars
📄
pasted-code-1778408221520.txt
txt 326 lines
▶
Create a PROFESSIONAL premium Discord Minecraft Store Bot in Python using discord.py 2.x.

Bot Name: Nosleep Store

The bot must feel like a real Minecraft network store system with premium UI, advanced ticket system, payment proof verification, automatic Minecraft delivery, logs, database system, and organized clean code.

━━━━━━━━━━━━━━━━━━
📂 PROJECT STRUCTURE
━━━━━━━━━━━━━━━━━━

Organize the project professionally:

/cogs
/events
/views
/utils
/database
/payments
/rcon
/assets
main.py
config.json
.env.example
requirements.txt
README.md

Use clean modular architecture.

━━━━━━━━━━━━━━━━━━
🏪 MAIN STORE SYSTEM
━━━━━━━━━━━━━━━━━━

Create a beautiful /store slash command that sends a premium animated-feeling store panel.

Main panel buttons:

🏆 Rank Store
🗝️ Key Store
🎁 Kit Store

Each button opens advanced dropdown/select menus with premium embeds.

The UI must feel modern, smooth, and professional like a large Minecraft server store.

━━━━━━━━━━━━━━━━━━
🏆 RANK STORE
━━━━━━━━━━━━━━━━━━

Ranks:

• Elite — $5
• Supreme — $10
• Dominator — $15
• King — $20
• God — $25

All ranks include:
	•	/fly
	•	/ec
	•	/craft
	•	/anvil
	•	/feed

When delivered:
lp user IGN parent addtemp RANK 30d

Rank names:
	•	elite
	•	supreme
	•	dominator
	•	king
	•	god

The rank menu must:
	•	Show price
	•	Show perks
	•	Show professional embed formatting
	•	Include confirmation step before checkout

━━━━━━━━━━━━━━━━━━
🗝️ KEY STORE
━━━━━━━━━━━━━━━━━━

Keys:

• Lucky Key — $1.5
• Super Key — $1
• Premium Key — $1

Users MUST be able to select quantity before purchase.

Delivery command:
crates key give IGN KEY AMOUNT

Keys:
	•	lucky
	•	super
	•	premium

━━━━━━━━━━━━━━━━━━
🎁 KIT STORE
━━━━━━━━━━━━━━━━━━

Kit available:

• Dominator Kit — $2

Users can select quantity.

Delivery command:
kit give IGN dominator AMOUNT

━━━━━━━━━━━━━━━━━━
🎫 ADVANCED TICKET SYSTEM
━━━━━━━━━━━━━━━━━━

When user purchases ANY item:

Automatically create private ticket:
ticket-username

Permissions:
	•	Buyer
	•	Staff/admin
	•	Bot only

Inside ticket:
Send premium order embed containing:
	•	Product
	•	Quantity
	•	Total price
	•	Order ID
	•	Instructions

Then automatically open MODAL FORM asking:
	1.	Minecraft IGN
	2.	Platform:
	•	Java Edition
	•	Bedrock Edition

Store all order data inside SQLite database.

━━━━━━━━━━━━━━━━━━
💳 PAYMENT SYSTEM
━━━━━━━━━━━━━━━━━━

Use local QR image:
assets/qrcode.png

Inside ticket:
	•	Show QR image
	•	Show payment instructions
	•	Show total amount
	•	Show order ID

User workflow:
	1.	Scan QR
	2.	Pay manually
	3.	Upload payment proof screenshot in ticket

━━━━━━━━━━━━━━━━━━
🧾 PAYMENT PROOF & APPROVAL
━━━━━━━━━━━━━━━━━━

After proof uploaded:

Staff/admin can use buttons:

✅ Approve Payment
❌ Reject Payment

If approved:
	•	Mark order as PAID
	•	Trigger automatic Minecraft delivery
	•	Send success embed
	•	Log transaction

If rejected:
	•	Send rejection embed
	•	Keep order pending or cancel it

━━━━━━━━━━━━━━━━━━
⚡ AUTOMATIC MINECRAFT DELIVERY
━━━━━━━━━━━━━━━━━━

Connect directly to Minecraft server using RCON.

Use environment variables:
	•	RCON_HOST
	•	RCON_PORT
	•	RCON_PASSWORD

After payment approval:

━━━━━━━━ RANK DELIVERY ━━━━━━━━
lp user IGN parent addtemp rank 30d

━━━━━━━━ KEY DELIVERY ━━━━━━━━
crates key give IGN key amount

━━━━━━━━ KIT DELIVERY ━━━━━━━━
kit give IGN dominator amount

The bot must:
	•	Execute automatically
	•	Prevent duplicate delivery
	•	Handle RCON errors
	•	Log delivery success/failure

━━━━━━━━━━━━━━━━━━
📊 SQLITE DATABASE
━━━━━━━━━━━━━━━━━━

Create database system with tables:

orders
payments
tickets
deliveries

Store:
	•	user_id
	•	username
	•	ign
	•	product
	•	category
	•	quantity
	•	price
	•	order_id
	•	payment_status
	•	delivery_status
	•	timestamp

━━━━━━━━━━━━━━━━━━
👨‍💻 ADMIN SYSTEM
━━━━━━━━━━━━━━━━━━

Create advanced staff tools.

Slash commands:
	•	/setup
	•	/panel
	•	/orders
	•	/close
	•	/approve
	•	/reject
	•	/deliver
	•	/pending

Features:
	•	Order logs
	•	Payment logs
	•	Delivery logs
	•	Ticket claim button
	•	Ticket close button
	•	Transcript export
	•	Pending order tracker

━━━━━━━━━━━━━━━━━━
🎨 UI / DESIGN REQUIREMENTS
━━━━━━━━━━━━━━━━━━

The bot must look:
	•	Premium
	•	Modern
	•	Clean
	•	Organized
	•	Mobile-friendly
	•	Professional Minecraft themed

Use:
	•	Beautiful embeds
	•	Buttons
	•	Select menus
	•	Modals
	•	Proper spacing
	•	Organized layouts

Avoid messy embeds or beginner-looking design.

━━━━━━━━━━━━━━━━━━
⚙️ REQUIREMENTS
━━━━━━━━━━━━━━━━━━

Use latest stable versions of:
	•	discord.py
	•	python-dotenv
	•	mcrcon
	•	aiohttp

Bot must:
	•	Auto create database
	•	Auto sync slash commands
	•	Include error handling
	•	Use async architecture
	•	Include comments
	•	Be deployment-ready

━━━━━━━━━━━━━━━━━━
📖 README
━━━━━━━━━━━━━━━━━━

README must explain:
	•	Installation
	•	Bot setup
	•	Discord intents
	•	RCON setup
	•	QR setup
	•	Running the bot
	•	VPS hosting guide

━━━━━━━━━━━━━━━━━━
🚀 FINAL RESULT
━━━━━━━━━━━━━━━━━━

The final system should work like a real Minecraft server store:
	1.	User opens store
	2.	Selects product
	3.	Ticket created automatically
	4.	User enters IGN
	5.	QR payment shown
	6.	User uploads proof
	7.	Staff reviews proof
	8.	Staff approves payment
	9.	Bot automatically gives rank/key/kit in Minecraft server
	10.	Everything logged professionally
Kodari AI
KodariMay 10 at 10:21 am 25,991 (v2)
NosleepStoreBot
A professional premium Discord Minecraft store bot for the Nosleep network. Features a full store system with Rank, Key, and Kit categories, automated private ticket creation, modal-based IGN collection, QR code payment flow, staff payment approval/rejection, automatic Minecraft delivery via RCON, SQLite order/payment/delivery tracking, and a complete admin command suite with logs and transcript export.

Here’s my plan before writing any code:

  • main.py — Bot entry point, loads cogs, syncs slash commands

  • config.json — Store products, prices, delivery commands, channel/role IDs

  • database/db.py — SQLite async wrapper, table creation, CRUD helpers

  • utils/helpers.py — Shared embed builders, order ID generator, ticket channel helpers

  • rcon/delivery.py — RCON connection, command execution, delivery logic per category

  • payments/handler.py — Payment proof detection, approval/rejection flow

  • views/store_views.py — Main store panel, rank/key/kit select menus, confirmation views

  • views/ticket_views.py — Ticket action buttons (claim, close, approve, reject, deliver)

  • views/modal_views.py — IGN + platform modal

  • cogs/store.py — /store slash command

  • cogs/admin.py — /setup, /panel, /orders, /close, /approve, /reject, /deliver, /pending

  • events/on_message.py — Payment proof image detection in ticket channels

Here’s a summary of everything built:

Architecture (10 modules, fully modular):

  • main.py — Async bot entry, loads all cogs, syncs slash commands to guild or globally

  • database/db.py — Full aiosqlite layer with orders, payments, tickets, deliveries tables and all CRUD helpers

  • utils/helpers.py — All embed builders (store, rank, key, kit, order, payment, proof, delivery log, success, rejection)

  • rcon/delivery.py — Synchronous MCRcon execution wrapped for async use, builds commands from config.json templates

  • payments/handler.py — Approval/rejection logic: marks DB, runs RCON, posts embeds, logs to log channel

  • views/store_views.py — Full UI tree: MainStoreView → category selects → quantity select (keys/kits) → confirmation → ticket creation

  • views/ticket_views.py — TicketActionsView (IGN, Claim, Close) + PaymentProofView (Approve/Reject) + TranscriptView

  • views/modal_views.py — IGNModal (IGN + platform) and RejectionReasonModal

  • events/on_message.py — Detects image uploads in ticket channels, posts proof embed with staff approval buttons

  • cogs/store.py + cogs/admin.py — All slash commands with staff-only guards

sinnalwayssimle

Error like command.bot and app command from console please check and fix all bug error

sinnalwayssimle

Now I don’t want bakong yet just like I have qrcode.png then need admin to confirm that order and fix the command give to console server give kit example kits give dominator kuyteavvv 2 like this correct okay and fix it more premium bot ever and fix more bug And fix the create ticket when confirm

Kodari AI
KodariMay 17 at 5:23 am 54,479 (v2)

Let me read all the relevant files first.

Now I have a full picture of the codebase. Here’s my plan:

  1. Remove Bakong — strip all Bakong references from build_payment_embed (it already just shows QR code, but the payment embed mentions “USD” — keep it clean, just show QR + amount)

  2. Fix kit delivery command — config.json has kit give {ign} dominator {amount} but the correct format is kits give dominator {ign} {amount} (product name first, then IGN, then amount)

  3. Fix _build_command in rcon/delivery.py — the category lookup for kit is broken (looks for kits then kit, but config key is kits)

  4. Fix on_message.py — the staff role mention logic is broken/crashes; simplify it

  5. Fix ticket creation — ConfirmPurchaseView.confirm calls interaction.response.defer(ephemeral=True) but the interaction was already from a button click on an ephemeral message; the followup needs to properly handle the channel mention

  6. Add admin confirm button in ticket — when proof is submitted, staff see Approve/Reject buttons (already exists via PaymentProofView) — make sure the TicketActionsView also has an Approve Order button for staff

  7. Fix RankSelect — ranks go directly to ConfirmPurchaseView with quantity=1, skipping quantity selection — that’s fine for ranks but the confirm view should work correctly

Now fix all the other files in parallel:

That comment-only change is fine. Now fix on_message.py (broken staff mention logic), views/ticket_views.py (add Approve Order button for staff), views/store_views.py (fix confirm flow), and payments/handler.py (fix approval to not re-deliver if already delivered):

Now fix store_views.py — the ConfirmPurchaseView.confirm uses defer(ephemeral=True) but then tries to send a followup with a channel mention. The issue is that edit_message was used to get to this view, so we need to edit the original message AND send a followup. Also fix the _send_ticket_content to mention staff roles:The _send_ticket_content function in the file uses a different embed title. Let me rewrite the whole store_views.py cleanly since there are multiple things to fix:

Now fix payments/handler.py — the handle_approval uses interaction.response.defer but when called from TicketActionsView (which already responded via edit_message), it will crash. Fix it to handle already-responded interactions, and also fix handle_rejection for the same reason:The handle_approval and handle_rejection are called from the modal’s on_submit (which already responded) and from button callbacks that call defer themselves. The real fix is to make these handlers safe against already-responded interactions by using interaction.followup when already deferred/responded. Let me rewrite payments/handler.py:

Now rewrite store_views.py properly with all fixes:

Now fix on_message.py to also add the missing import os:

Now let me write the full corrected versions of payments/handler.py and views/store_views.py:

Here’s a full summary of every fix made:


✅ Changes Made

config.json

  • Fixed kit delivery command from kit give {ign} dominator {amount} → kits give dominator {ign} {amount} (correct plugin syntax: kits give <kit> <player> <amount>)

views/store_views.py — Major fixes:

  • Ticket creation flow fixed — ConfirmPurchaseView.confirm now uses edit_message (not defer) to show a “⏳ Creating ticket…” state, then edit_original_response to show the final result with the channel mention. No more interaction errors

  • Staff ping on ticket open — ticket channel now pings staff/admin roles when the welcome message is sent

  • Error handling — if ticket creation fails, the user sees a clean error message instead of a crash

views/ticket_views.py — Major fixes:

  • Added Approve Order button (green ✅) — staff can approve directly from the ticket action buttons without needing to wait for proof upload

  • Added Reject Order button (red ❌) — staff can reject with a reason modal directly from the ticket

  • Added WARNING_COLOR import for the “no IGN yet” warning

payments/handler.py — Fixed:

  • Added _safe_defer and _safe_followup helpers — prevents InteractionResponded crashes when handle_approval/handle_rejection is called from a modal on_submit (which already responded) or from a button that already deferred

events/on_message.py — Fixed:

  • Removed the broken/crashing staff role mention logic that used discord.utils.get incorrectly

  • Now correctly reads STAFF_ROLE_ID / ADMIN_ROLE_ID from env and pings them when proof is uploaded

  • Added missing import os

sinnalwayssimle

And can you update the rank god to Aurafarm and price is 35$ can access kits Aurafarm 2 kit and key lucky key 2 premium key super key

Kodari can make mistakes. Review important code before using.
Files
assets
cogs
database
events
payments
rcon
utils
views
config.json
main.py
README.md
requirements.txt
Code
22 1,928
main.py
import discord
from discord.ext import commands
import os
import logging
import asyncio
from dotenv import load_dotenv
from database import db

load_dotenv()

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S"
)
logger = logging.getLogger("NosleepStore")

COGS = [
    "cogs.store",
    "cogs.admin",
    "events.on_message"
]


class NosleepBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.all()
        super().__init__(command_prefix="!", intents=intents, help_command=None)

    async def setup_hook(self):
        await db.init_db()
        logger.info("Database initialized.")

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

        guild_id = os.getenv("GUILD_ID")
        if guild_id:
            guild = discord.Object(id=int(guild_id))
            self.tree.copy_global_to(guild=guild)
            await self.tree.sync(guild=guild)
            logger.info(f"Slash commands synced to guild {guild_id}.")
        else:
            await self.tree.sync()
            logger.info("Slash commands synced globally.")

    async def on_ready(self):
        logger.info(f"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
        logger.info(f"  Nosleep Store Bot is online!")
        logger.info(f"  Logged in as: {self.user} ({self.user.id})")
        logger.info(f"  Guilds: {len(self.guilds)}")
        logger.info(f"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
        await self.change_presence(
            activity=discord.Activity(
                type=discord.ActivityType.watching,
                name="Nosleep Store 🏪"
            )
        )

    async def on_app_command_error(self, interaction: discord.Interaction, error: app_commands.AppCommandError):
        if isinstance(error, app_commands.CheckFailure):
            return
        logger.error(f"App command error: {error}")
        try:
            await interaction.response.send_message(
                embed=discord.Embed(
                    description=f"❌ An error occurred: `{error}`",
                    color=0xe74c3c
                ),
                ephemeral=True
            )
        except discord.InteractionResponded:
            pass


from discord import app_commands


async def main():
    bot = NosleepBot()
    token = os.getenv("DISCORD_TOKEN")
    if not token:
        logger.critical("DISCORD_TOKEN not found in environment variables!")
        return
    async with bot:
        await bot.start(token)


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