anshshindey

This is a complete professional marketplace and middleman shop bot built for Discord servers using discord dot py version two with modern button components and a clean modular cog based architecture, designed for real trading communities where buyers, sellers and staff need a secure, organised and transparent workflow, the bot provides a fully customised ticket system with an interactive ticket panel where members can open buy, exchange, support and middleman tickets directly from buttons, including a dedicated exchange ticket command and fully customised ticket categories and permissions, the bot features a complete escrow based middleman system where both buyer and seller must confirm the deal and payment through interactive confirmation buttons before the middleman can release the funds, ensuring safety for both sides, it includes a professional USDT wallet and balance system which clearly separates confirmed and unconfirmed balances and allows users to check their balance using the ,bal command while administrators can credit balances using the ,usdt addy and ,bal usdt addy tools and the ,addusdt command for trusted manual payments, the ,usdt command shows the userโ€™s personal USDT address linked to their account, the system supports a secure middleman deal code which is generated for every escrow deal and stored in the database for verification and staff tracking, the bot also includes a complete review and vouch system where users can submit public reviews and vouches after a completed deal using the Review and Vouch commands which automatically attach to the userโ€™s trading profile, sellers can create and manage their own professional shop profiles using ,setshop and ,additem commands such as ,additem โ€œNetflix One Month Slotโ€ price, ,additem โ€œDiscord Nitro One Monthโ€ price and ,additem โ€œSpotify Premium Slotโ€ price, and the bot automatically generates clean and well formatted shop embeds showing items, availability, prices in Litecoin and the live converted value in Indian rupees, users can view any seller shop using the ,shop command, the bot maintains detailed leaderboards including ,lbbuyers for top buyers, ,lbdealsbystaff for staff activity and ,lbinvites for invite performance, along with an ,invites command to view personal invite statistics, a complete invite tracking and reward system is built in to support organic server growth, staff can start professional giveaways using the ,gstart command with automatic and transparent winner selection, a payment confirmation panel can be configured and posted by staff using ,paypanel where a UPI identifier is displayed and buyers confirm payment using buttons inside their ticket, every important action including ticket creation, payment confirmation, escrow confirmations, deal completion, balance changes, reviews, vouches and shop updates is automatically logged in dedicated staff log channels, the bot stores all balances, shops, tickets, reviews, vouches, middleman deals, invites and logs in a persistent SQLite database so no data is lost after restarts, the command system uses a clean and simple prefix style including embed for sending custom shop or information embeds, review and vouch for reputation, ticketpanel to publish the interactive ticket creation panel, mmstart to start a middleman deal inside a ticket, confirm for buyer and seller confirmations and payment verification, logdeal for staff to manually register completed deals when required, and shop and setshop for seller profile management, all wrapped inside a modern button driven user interface and structured modules that make this bot a complete end to end solution for running a secure marketplace, managing sellers, tracking reputation, handling escrow based middleman transactions and maintaining transparent and auditable records for both users and staff in a single integrated and professional system.

Kodari AI
KodariFeb 28 at 10:16 am 29,571 (v2)
MarketplaceMiddlemanBot
A professional Discord marketplace and middleman bot built with discord.py v2. Features a full escrow system with buyer/seller confirmations, USDT wallet with confirmed/unconfirmed balances, interactive ticket panels with button components, seller shop profiles with live LTC/INR pricing, review and vouch reputation system, invite tracking and rewards, staff giveaways, payment confirmation panels, leaderboards, and complete SQLite persistence. All actions are logged to dedicated staff channels in a modular cog-based architecture.

Iโ€™ll build this as a fully modular, professional bot. Let me plan the architecture:

  • main.py โ€” bot entry, cog loader, DB init

  • database.py โ€” all SQLite schema and helper functions

  • config.py โ€” centralised config constants

  • cogs/tickets.py โ€” ticket panel, button UI, category routing

  • cogs/middleman.py โ€” escrow flow, deal codes, confirmations

  • cogs/wallet.py โ€” USDT balances, address management, pay panel

  • cogs/shop.py โ€” shop profiles, item management, LTC/INR embed

  • cogs/reviews.py โ€” review and vouch commands

  • cogs/leaderboard.py โ€” buyer, staff, invite leaderboards

  • cogs/invites.py โ€” invite tracking and rewards

  • cogs/giveaway.py โ€” gstart, winner selection

  • cogs/admin.py โ€” logdeal, embed, addusdt, ticketpanel

Hereโ€™s a complete summary of everything built:


๐Ÿ“ Project Structure

Plain Text
MarketplaceMiddlemanBot/
โ”œโ”€โ”€ main.py               โ† Bot entry, cog loader, error handler, ,help
โ”œโ”€โ”€ database.py           โ† All SQLite schema, queries & helpers
โ”œโ”€โ”€ config.py             โ† Centralised constants (colors, channel names, roles, rates)
โ”œโ”€โ”€ utils.py              โ† Shared helpers (role checks, embeds, log sender)
โ”œโ”€โ”€ .env                  โ† Bot token
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ cogs/
    โ”œโ”€โ”€ tickets.py        โ† Ticket panel with 4 button types, close system, logging
    โ”œโ”€โ”€ middleman.py      โ† Full escrow flow, deal codes, buyer/seller confirmations, fund release
    โ”œโ”€โ”€ wallet.py         โ† USDT balances (confirmed/unconfirmed), address system, pay panel
    โ”œโ”€โ”€ shop.py           โ† Shop profiles, item management, LTC/INR live pricing embeds
    โ”œโ”€โ”€ reviews.py        โ† Review (1โ€“5 stars), vouch, profile commands
    โ”œโ”€โ”€ leaderboard.py    โ† ,lbbuyers, ,lbdealsbystaff, ,lbinvites
    โ”œโ”€โ”€ invites.py        โ† Full invite tracking with cache, ,invites command
    โ”œโ”€โ”€ giveaway.py       โ† ,gstart with button entry, auto draw, ,greroll
    โ””โ”€โ”€ admin.py          โ† ,logdeal, ,embed, ,setupchannels, ,userinfo, ,botstats, ,dmuser

โšก Quick Start

  1. Add your token to .env

  2. Install deps: pip install -r requirements.txt

  3. Run: python main.py

  4. In Discord run ,setupchannels to auto-create all log channels

  5. Post ,ticketpanel in your support channel

๐Ÿ”‘ Key Features

  • Escrow MM system โ€” deal codes, buyer/seller confirm buttons, MM release/cancel buttons

  • USDT wallet โ€” confirmed vs unconfirmed split, ,bal, ,usdt, ,addusdt

  • Shop embeds โ€” live LTC โ†’ INR conversion at โ‚น7,200/LTC displayed on every item

  • Pay panel โ€” UPI display with โ€œI Have Paidโ€ button, staff-log triggered

  • Persistent SQLite โ€” survives all restarts, persistent Views re-registered on on_ready

  • Full audit logging โ€” every action logs to its dedicated channel automatically

anshshindey
code
PaymentCog:
  bal      
  calc     Simple calculator with safety checks
  delltc   Delete LTC address by ID
  delusdt  Delete USDT address by ID
  listltc  List all LTC addresses
  listupi  List all UPI addresses
  listusdt List all USDT addresses
  ltc      Interactive LTC selection with QR generation
  qr       Generate UPI QR code
  remind   Send a professional reminder DM to a user
  setltc   Add LTC address
  setupi   Add a UPI address
  setusdt  Add USDT address. Usage: .setusdt <address> [network] [label]
  upi      Interactive UPI selection with QR generation
  usdt     Interactive USDT selection with QR generation
No Category:
  help     Shows this message

Type ,help command for more info on a command.
You can also type ,help category for more info on a category.

Not working Usdt Confirmed and unconfirmed bal Bal ,userdm Emded announcement,userdm not working Usst bal not working or any bal Add ltc bal And embed all not working And staff and admin last all not working

code
SlotManager:
  ausers       
  create       
  create_key   
  delete_key   
  deleteslots  
  hold         
  keys         
  myslot       
  nuke         
  pings        
  pusers       
  redeem       
  renew        
  resetping    
  resetpings   
  restoreslots 
  revoke       
  rpanel       
  rusers       
  search       
  setpings     
  slotinfo     
  unhold       
  unrevoke     
No Category:
  help         Shows this message

Type +help command for more info on a command.
You can also type +help category for more info on a category.

Kodari AI
KodariFeb 28 at 1:44 pm 58,577 (v2)

Let me read all the relevant files first.

Let me check the remaining cog files and any additional files.

Now I have the full picture. Let me analyze everything:

  • PaymentCog bot (, prefix) - Missing commands: calc, delltc, delusdt, listltc, listupi, listusdt, ltc, qr, remind, setltc, setupi + broken bal, usdt, userdm, embed, LTC balance

  • SlotManager bot (+ prefix) - Completely missing, needs to be built from scratch as a separate bot

  • Need DB additions: payment address tables, LTC balance column, full slots schema

Let me build everything now.

Now Iโ€™ll build everything โ€” full PaymentCog rewrite, fixed admin, updated database, and complete SlotManager bot.

Now build the complete SlotManager bot:

Now fix the init_db in database.py to handle the already existing ltc_balance column gracefully:

Also update main.py to reference the renamed PaymentCog cog correctly (the class name changed but the module path is the same):

Hereโ€™s a complete summary of every change made:


What Was Fixed & Built

๐Ÿ”ง PaymentCog (cogs/wallet.py) โ€” Complete Rewrite

Command
Status
Notes
bal [@user]
โœ… Fixed
Shows USDT confirmed, unconfirmed
AND
LTC balance with INR conversions
calc <expr>
โœ… Added
Safe AST-based evaluator โ€” supports
+ - * / ** % //
, blocks dangerous code
setltc/setupi/setusdt
โœ… Added
Admins add payment-receiving addresses to botโ€™s database
listltc/listupi/listusdt
โœ… Added
Lists all stored payment addresses with IDs
delltc <id>/delusdt <id>
โœ… Added
Delete payment address by ID
ltc/upi/usdt
โœ… Added
Interactive
Select Menu
โ†’ shows chosen address +
QR code
via
api.qrserver.com
qr [upi_id]
โœ… Added
Generates UPI QR code embed
remind @user [msg]
โœ… Added
Sends professional payment reminder DM (Staff only)
addltc @user <amount>
โœ… Added
Credits LTC balance (Admin)
deductltc/deductusdt
โœ… Fixed
Fixed validation and embeds

๐Ÿ”ง Admin Cog (cogs/admin.py)

  • userdm @user <msg> โ€” New clean DM command with full embed (was missing entirely)

  • embed [#channel] [Title |] <desc> โ€” Fixed: now supports Title | Description pipe syntax, proper embed with timestamp

๐Ÿ—„๏ธ Database (database.py)

  • Added ltc_balance column to wallets table (migration-safe, catches duplicate column error)

  • Added payment_ltc, payment_upi, payment_usdt tables for storing bot payment addresses

  • Added all CRUD functions for payment addresses and LTC balance

๐Ÿค– SlotManager Bot โ€” Built from Scratch

slot_main.py โ€” Separate bot process, reads SLOT_BOT_TOKEN from .env, prefix +

slot_db.py โ€” Full slot database with slots + slot_keys tables

cogs/slotmanager.py โ€” All 24 commands implemented:

  • redeem, myslot, pings โ€” User commands

  • slotinfo, ausers, pusers, rusers, hold, unhold, search โ€” Staff

  • create, deleteslots, revoke, unrevoke, rpanel (interactive dropdown), renew, create_key, delete_key, keys, setpings, resetping, resetpings, restoreslots, nuke โ€” Admin

Run the payment bot with python main.py and the slot bot separately with python slot_main.py. Set SLOT_BOT_TOKEN in .env to your second botโ€™s token.

Kodari can make mistakes. Review important code before using.
Files
cogs
config.py
database.py
main.py
requirements.txt
slot_db.py
slot_main.py
utils.py
Code
17 3,689
main.py
import discord
from discord.ext import commands
import os
import asyncio
import logging
from dotenv import load_dotenv
import database as db
import config

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("MarketplaceBot")

intents = discord.Intents.all()

bot = commands.Bot(
    command_prefix=config.PREFIX,
    intents=intents,
    help_command=None
)

COGS = [
    "cogs.tickets",
    "cogs.middleman",
    "cogs.wallet",
    "cogs.shop",
    "cogs.reviews",
    "cogs.leaderboard",
    "cogs.invites",
    "cogs.giveaway",
    "cogs.admin",
]


@bot.event
async def on_ready():
    logger.info(f"Logged in as {bot.user} (ID: {bot.user.id})")
    logger.info(f"Serving {len(bot.guilds)} guild(s)")
    await bot.change_presence(
        activity=discord.Activity(
            type=discord.ActivityType.watching,
            name=f",help | Marketplace Bot"
        )
    )


@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send(embed=discord.Embed(
            title="Missing Argument",
            description=f"Missing required argument: `{error.param.name}`",
            color=config.ERROR_COLOR
        ))
    elif isinstance(error, commands.MemberNotFound):
        await ctx.send(embed=discord.Embed(
            title="Member Not Found",
            description="Could not find that member. Please mention them or use their ID.",
            color=config.ERROR_COLOR
        ))
    elif isinstance(error, commands.BadArgument):
        await ctx.send(embed=discord.Embed(
            title="Invalid Argument",
            description=str(error),
            color=config.ERROR_COLOR
        ))
    elif isinstance(error, commands.MissingPermissions):
        await ctx.send(embed=discord.Embed(
            title="No Permission",
            description="You don't have permission to use this command.",
            color=config.ERROR_COLOR
        ))
    elif isinstance(error, commands.CommandNotFound):
        pass
    elif isinstance(error, commands.CheckFailure):
        await ctx.send(embed=discord.Embed(
            title="Check Failed",
            description="You do not meet the requirements to use this command.",
            color=config.ERROR_COLOR
        ))
    else:
        logger.error(f"Unhandled error in command '{ctx.command}': {error}", exc_info=error)


@bot.command(name="help")
async def help_command(ctx):
    embed = discord.Embed(
        title="๐Ÿ“š MarketplaceBot Commands",
        description=f"Prefix: `{config.PREFIX}` | All commands listed below",
        color=config.BOT_COLOR
    )

    embed.add_field(
        name="๐ŸŽซ Tickets",
        value=(
            "`ticketpanel` โ€” Post the interactive ticket panel\n"
            "`exchangeticket` โ€” Open an exchange ticket\n"
            "`closeticket` โ€” Close current ticket (Staff)"
        ),
        inline=False
    )

    embed.add_field(
        name="๐Ÿ›ก๏ธ Middleman / Deals",
        value=(
            "`mmstart @buyer @seller <amount> <desc>` โ€” Start MM deal\n"
            "`dealinfo <code>` โ€” View deal information\n"
            "`logdeal @buyer @seller <amount> <desc>` โ€” Log a completed deal (Staff)\n"
            "`confirm` โ€” Confirm your part of a deal"
        ),
        inline=False
    )

    embed.add_field(
        name="๐Ÿ’ฐ Wallet & Payments",
        value=(
            "`bal [@user]` โ€” View USDT + LTC balance (admin can view others)\n"
            "`calc <expression>` โ€” Safe math calculator\n"
            "`usdt` โ€” Show USDT payment addresses (interactive QR)\n"
            "`ltc` โ€” Show LTC payment addresses (interactive QR)\n"
            "`upi` โ€” Show UPI payment IDs (interactive QR)\n"
            "`qr [upi_id]` โ€” Generate UPI QR code\n"
            "`remind @user [msg]` โ€” Send professional reminder DM (Staff)\n"
            "`addusdt @user <amount> [confirmed]` โ€” Credit USDT (Admin)\n"
            "`addltc @user <amount>` โ€” Credit LTC balance (Admin)\n"
            "`confirmbal @user <amount>` โ€” Confirm unconfirmed USDT (Admin)\n"
            "`deductusdt @user <amount>` โ€” Deduct USDT (Admin)\n"
            "`deductltc @user <amount>` โ€” Deduct LTC (Admin)\n"
            "`setusdt <addr> [network] [label]` โ€” Add USDT pay address (Admin)\n"
            "`setltc <addr> [label]` โ€” Add LTC pay address (Admin)\n"
            "`setupi <upi_id> [label]` โ€” Add UPI ID (Admin)\n"
            "`listusdt / listltc / listupi` โ€” List payment addresses (Admin)\n"
            "`delusdt <id> / delltc <id>` โ€” Delete payment address (Admin)"
        ),
        inline=False
    )

    embed.add_field(
        name="๐Ÿช Shop",
        value=(
            "`setshop <name> <description>` โ€” Create/update your shop\n"
            "`additem \"Item Name\" <ltc_price>` โ€” Add item to shop\n"
            "`removeitem <item_id>` โ€” Remove an item\n"
            "`toggleitem <item_id>` โ€” Toggle item availability\n"
            "`setbanner <url>` โ€” Set shop banner image\n"
            "`shop [@user]` โ€” View a shop\n"
            "`myshopitems` โ€” View your items with IDs"
        ),
        inline=False
    )

    embed.add_field(
        name="๐Ÿ“ Reviews & Vouches",
        value=(
            "`review @user <1-5> <text> [deal:CODE]` โ€” Leave a review\n"
            "`vouch @user <text> [deal:CODE]` โ€” Leave a vouch\n"
            "`reviews [@user]` โ€” View reviews\n"
            "`vouches [@user]` โ€” View vouches\n"
            "`profile [@user]` โ€” View trading profile"
        ),
        inline=False
    )

    embed.add_field(
        name="๐Ÿ† Leaderboards",
        value=(
            "`lbbuyers` โ€” Top buyers leaderboard\n"
            "`lbdealsbystaff` โ€” Staff deal leaderboard\n"
            "`lbinvites` โ€” Invite leaderboard\n"
            "`invites [@user]` โ€” View invite stats"
        ),
        inline=False
    )

    embed.add_field(
        name="๐ŸŽ‰ Giveaways",
        value=(
            "`gstart <duration> <winners> <prize>` โ€” Start giveaway\n"
            "`greroll <message_id>` โ€” Reroll giveaway winner"
        ),
        inline=False
    )

    embed.add_field(
        name="โš™๏ธ Admin / Staff",
        value=(
            "`setupchannels` โ€” Create all log channels\n"
            "`userinfo [@user]` โ€” Detailed user info\n"
            "`staffinfo [@user]` โ€” Staff activity info\n"
            "`botstats` โ€” Bot-wide statistics\n"
            "`embed [#channel] [Title |] <desc>` โ€” Send custom embed\n"
            "`announce #channel [color] <text>` โ€” Post announcement\n"
            "`dmuser @user <message>` โ€” DM a user as bot\n"
            "`userdm @user <message>` โ€” DM a user (clean embed)"
        ),