A

Make this:

πŸ“Ž 1 file 5,081 chars
πŸ“„
pasted-code-1771466754192.txt
txt 269 lines
β–Ά
ULTRA NETWORK – COMPLETE SYSTEM OVERVIEW

────────────────────────

SYSTEM STRUCTURE

BOT A β€” Ultra Gold Core (Private / Main Server Only)

This is the central authority of the entire system.

Responsibilities:
	β€’	Stores all global Ultra Gold balances
	β€’	Handles all games (blackjack, roll, coinflip, highlow, double)
	β€’	Handles wipe system
	β€’	Handles business creation
	β€’	Stores all businesses and business items
	β€’	Processes every balance change
	β€’	Approves and finalizes all purchases
	β€’	Controls cross-server execution
	β€’	Only admin user ID: 1395404583601307851

This bot is not public and cannot be invited elsewhere.
It is the single source of truth.

────────────────────────

BOT B β€” Ultra Credit Support (Public Installable Bot)

This bot can be added to any server.

Purpose:
It acts as a bridge between external servers and the Core Bot.

It can:
	β€’	View businesses
	β€’	Display business shops
	β€’	Allow users to purchase items
	β€’	Execute rewards in its own server

It cannot:
	β€’	Create businesses
	β€’	Edit businesses
	β€’	Modify prices
	β€’	Add Ultra Gold
	β€’	Remove Ultra Gold
	β€’	Wipe balances
	β€’	Access the Core database directly

Bot B never stores currency.
It only sends secure requests to Core Bot.

────────────────────────

GLOBAL CURRENCY SYSTEM

Ultra Gold is:
	β€’	Global per Discord user ID
	β€’	Shared across all servers
	β€’	Stored only in Core Bot
	β€’	Never stored in Bot B

If a user has 50,000 Ultra Gold, that balance exists everywhere.

All balance changes must happen inside Core Bot.

────────────────────────

BUSINESS SYSTEM (Core Bot Only)

Businesses are personal shops owned by users.

Creation (Main Server Only):
/business create name

Rules:
	β€’	Costs Ultra Gold
	β€’	Maximum 3 per user (configurable)
	β€’	Name must be unique
	β€’	Stored permanently in Core database

Only Core Bot can create or manage businesses.

────────────────────────

BUSINESS SHOP SYSTEM

Users can view someone’s businesses with:

/business username

Flow:
	1.	Command is executed.
	2.	Core Bot retrieves all businesses owned by that user.
	3.	Buttons appear for each business.
	4.	User selects a business.
	5.	Business items appear as buttons.
	6.	User selects item to purchase.

Businesses are dynamic personal storefronts.

────────────────────────

BUSINESS ITEM TYPES

Each business item can:
	β€’	Unlock a role in a specific server
	β€’	Trigger a command in a specific server
	β€’	Grant access to a channel
	β€’	Execute predefined reward logic
	β€’	Unlock digital perks

Each item stores:
	β€’	Price (Ultra Gold)
	β€’	Target server ID
	β€’	Reward type
	β€’	Reward data
	β€’	Owner ID

────────────────────────

CROSS-SERVER PURCHASE FLOW

Example:
A user buys an item from a business.

Step 1:
Purchase initiated (from main server or public server).

Step 2:
Bot B sends secure purchase request to Core Bot:
purchase(user_id, business_id, item_id)

Step 3: Core Bot validates:
	β€’	User balance
	β€’	Item existence
	β€’	Business ownership
	β€’	Target guild validity

Step 4:
Core Bot deducts Ultra Gold.

Step 5:
Core Bot sends reward execution request to Bot B in the correct server.

Step 6:
Bot B executes reward in that server only.

Step 7:
Bot B confirms success.

Step 8:
Core Bot logs transaction and finalizes.

If reward fails, transaction can be reversed safely.

────────────────────────

ADMIN CONTROL (Core Bot Only)

Only user ID:
1395404583601307851

Can:
	β€’	Set Ultra Gold
	β€’	Add Ultra Gold
	β€’	Remove Ultra Gold
	β€’	Wipe user
	β€’	Wipe all users
	β€’	Wipe below amount
	β€’	Wipe above amount
	β€’	Change business limits
	β€’	Force delete businesses

No server owner can override this.

────────────────────────

DATABASE STRUCTURE

Users
	β€’	user_id
	β€’	ultra_gold
	β€’	wins
	β€’	losses
	β€’	business_count

Businesses
	β€’	business_id
	β€’	owner_id
	β€’	name
	β€’	created_at

BusinessItems
	β€’	item_id
	β€’	business_id
	β€’	name
	β€’	price
	β€’	target_guild_id
	β€’	reward_type
	β€’	reward_data

Transactions
	β€’	transaction_id
	β€’	buyer_id
	β€’	business_id
	β€’	item_id
	β€’	amount
	β€’	timestamp

────────────────────────

SECURITY MODEL

Core Bot is the only authority.

Core Bot validates:
	β€’	API key
	β€’	Bot B identity
	β€’	Request signature
	β€’	Valid item
	β€’	Valid server
	β€’	Sufficient balance

Bot B cannot:
	β€’	Mint currency
	β€’	Fake balance changes
	β€’	Modify database
	β€’	Bypass validation

Even if someone owns a server or has Administrator, they cannot create Ultra Gold.

────────────────────────

CONFIG SYSTEM

Core Bot configuration example:

max_businesses_per_user = 3
business_creation_cost = 50000
min_bet = 100
max_bet_percent = 0.5

All limits are adjustable without rewriting the system.

────────────────────────

WHAT THIS SYSTEM IS

This is a centralized competitive economy network with:
	β€’	One global currency
	β€’	User-owned businesses
	β€’	Cross-server commerce
	β€’	Centralized balance authority
	β€’	Strict admin control
	β€’	Secure reward execution

Users:
	β€’	Earn Ultra Gold
	β€’	Play games
	β€’	Create businesses
	β€’	Sell perks
	β€’	Compete globally

Server owners:
	β€’	Integrate into the network
	β€’	Offer purchasable perks
	β€’	Reward users using Ultra Gold

But currency creation and control remain fully centralized under Core Bot.
Kodari AI
KodariFeb 19 at 2:08 am 20,714 (v2)

I’ll create a complete dual-bot Discord economy system with global currency, businesses, games, and cross-server commerce.

UltraNetworkEconomy
A dual-bot Discord economy system with global currency (Ultra Gold), user-owned businesses, cross-server commerce, and centralized authority. Core bot manages currency and games while public bot enables cross-server purchases and reward execution. Features include blackjack, coinflip, roll, highlow, double games, business shops, and admin controls.

Complete dual-bot system created with Core Bot (private economy server) and Public Bot (installable cross-server shop system) featuring global Ultra Gold currency, 5 gambling games, user-owned businesses with cross-server purchases, and centralized admin controls.

Kodari can make mistakes. Review important code before using.
Files
admin.py
api_server.py
bot_core.py
bot_public.py
business.py
config.json
core_api.py
database.py
games.py
public_shop.py
README.txt
requirements.txt
Code
12 1,631
games.py
import discord
from discord import ui
import random
from typing import Optional

class Games:
    def __init__(self, db):
        self.db = db
        self.min_bet = 100
        self.max_bet_percent = 0.5
    
    async def validate_bet(self, user_id: int, bet: int) -> tuple[bool, str, int]:
        if bet < self.min_bet:
            return False, f"Minimum bet is {self.min_bet} Ultra Gold", 0
        
        user_data = await self.db.get_user(user_id)
        balance = user_data['ultra_gold']
        
        if bet > balance:
            return False, "Insufficient balance", balance
        
        max_bet = int(balance * self.max_bet_percent)
        if bet > max_bet:
            return False, f"Maximum bet is {max_bet:,} Ultra Gold (50% of balance)", balance
        
        return True, "", balance
    
    async def blackjack(self, interaction: discord.Interaction, bet: int) -> Optional['BlackjackView']:
        valid, msg, balance = await self.validate_bet(interaction.user.id, bet)
        if not valid:
            await interaction.response.send_message(msg, ephemeral=True)
            return None
        
        await self.db.update_balance(interaction.user.id, -bet)
        return BlackjackView(interaction.user.id, bet, self.db)
    
    async def coinflip(self, interaction: discord.Interaction, bet: int, choice: str):
        valid, msg, balance = await self.validate_bet(interaction.user.id, bet)
        if not valid:
            await interaction.response.send_message(msg, ephemeral=True)
            return
        
        result = random.choice(['heads', 'tails'])
        won = result == choice.lower()
        
        if won:
            winnings = bet * 2
            await self.db.update_balance(interaction.user.id, winnings)
            await self.db.increment_wins(interaction.user.id)
            new_balance = balance + bet
            
            embed = discord.Embed(title="πŸͺ™ Coinflip - You Won!", color=0x00FF00)
            embed.add_field(name="Your Choice", value=choice.capitalize(), inline=True)
            embed.add_field(name="Result", value=result.capitalize(), inline=True)
            embed.add_field(name="Winnings", value=f"+{bet:,} Ultra Gold", inline=False)
            embed.add_field(name="New Balance", value=f"{new_balance:,} Ultra Gold", inline=False)
        else:
            await self.db.update_balance(interaction.user.id, 0)
            await self.db.increment_losses(interaction.user.id)
            new_balance = balance - bet
            
            embed = discord.Embed(title="πŸͺ™ Coinflip - You Lost", color=0xFF0000)
            embed.add_field(name="Your Choice", value=choice.capitalize(), inline=True)
            embed.add_field(name="Result", value=result.capitalize(), inline=True)
            embed.add_field(name="Lost", value=f"-{bet:,} Ultra Gold", inline=False)
            embed.add_field(name="New Balance", value=f"{new_balance:,} Ultra Gold", inline=False)
        
        await interaction.response.send_message(embed=embed)
    
    async def roll(self, interaction: discord.Interaction, bet: int):
        valid, msg, balance = await self.validate_bet(interaction.user.id, bet)
        if not valid:
            await interaction.response.send_message(msg, ephemeral=True)
            return
        
        roll = random.randint(1, 100)
        
        if roll >= 90:
            multiplier = 2.0
            winnings = int(bet * multiplier)
        elif roll >= 75:
            multiplier = 1.5
            winnings = int(bet * multiplier)
        elif roll >= 50:
            multiplier = 1.0
            winnings = bet
        else:
            multiplier = 0
            winnings = 0
        
        profit = winnings - bet
        await self.db.update_balance(interaction.user.id, profit)
        
        if profit > 0:
            await self.db.increment_wins(interaction.user.id)
            color = 0x00FF00
            title = "🎲 Roll - You Won!"
        elif profit == 0:
            color = 0xFFFF00
            title = "🎲 Roll - Break Even"
        else:
            await self.db.increment_losses(interaction.user.id)
            color = 0xFF0000
            title = "🎲 Roll - You Lost"
        
        new_balance = balance + profit
        
        embed = discord.Embed(title=title, color=color)
        embed.add_field(name="Roll", value=str(roll), inline=True)
        embed.add_field(name="Multiplier", value=f"{multiplier}x", inline=True)
        embed.add_field(name="Profit/Loss", value=f"{profit:+,} Ultra Gold", inline=False)
        embed.add_field(name="New Balance", value=f"{new_balance:,} Ultra Gold", inline=False)
        
        await interaction.response.send_message(embed=embed)
    
    async def highlow(self, interaction: discord.Interaction, bet: int) -> Optional['HighLowView']:
        valid, msg, balance = await self.validate_bet(interaction.user.id, bet)
        if not valid:
            await interaction.response.send_message(msg, ephemeral=True)
            return None
        
        await self.db.update_balance(interaction.user.id, -bet)
        return HighLowView(interaction.user.id, bet, self.db)
    
    async def double(self, interaction: discord.Interaction, bet: int):
        valid, msg, balance = await self.validate_bet(interaction.user.id, bet)
        if not valid:
            await interaction.response.send_message(msg, ephemeral=True)
            return
        
        won = random.choice([True, False])
        
        if won:
            winnings = bet * 2
            await self.db.update_balance(interaction.user.id, winnings)
            await self.db.increment_wins(interaction.user.id)
            new_balance = balance + bet
            
            embed = discord.Embed(title="πŸ’° Double - You Won!", color=0x00FF00)
            embed.add_field(name="Result", value="SUCCESS!", inline=True)
            embed.add_field(name="Winnings", value=f"+{bet:,} Ultra Gold", inline=False)
            embed.add_field(name="New Balance", value=f"{new_balance:,} Ultra Gold", inline=False)
        else:
            await self.db.update_balance(interaction.user.id, 0)
            await self.db.increment_losses(interaction.user.id)
            new_balance = balance - bet
            
            embed = discord.Embed(title="πŸ’° Double - You Lost", color=0xFF0000)
            embed.add_field(name="Result", value="FAILED", inline=True)
            embed.add_field(name="Lost", value=f"-{bet:,} Ultra Gold", inline=False)
            embed.add_field(name="New Balance", value=f"{new_balance:,} Ultra Gold", inline=False)
        
        await interaction.response.send_message(embed=embed)

class BlackjackView(ui.View):
    def __init__(self, user_id: int, bet: int, db):
        super().__init__(timeout=60)
        self.user_id = user_id
        self.bet = bet
        self.db = db
        
        self.deck = list(range(1, 14)) * 4
        random.shuffle(self.deck)
        
        self.player_hand = [self.deck.pop(), self.deck.pop()]
        self.dealer_hand = [self.deck.pop(), self.deck.pop()]
        self.game_over = False
        
        self.embed = self.create_embed()
    
    def card_value(self, card: int) -> int:
        if card > 10:
            return 10
        return card
    
    def hand_value(self, hand: list) -> int:
        value = sum(self.card_value(card) for card in hand)
        aces = hand.count(1)
        
        while value <= 11 and aces > 0:
            value += 10
            aces -= 1
        
        return value
    
    def card_name(self, card: int) -> str:
        if card == 1:
            return "A"
        elif card == 11:
            return "J"
        elif card == 12:
            return "Q"
        elif card == 13:
            return "K"
        return str(card)
    
    def create_embed(self) -> discord.Embed:
        player_value = self.hand_value(self.player_hand)
        dealer_value = self.hand_value(self.dealer_hand)