Spaces:
Building
Building
import discord | |
from discord import app_commands | |
import asyncio | |
from cash import user_cash | |
# Define the available codes for each item | |
robux_codes = ["TD4XD-QHR5A-QMNYG"] | |
steam_game_codes = [ | |
"6X5C2-FI9DW-8WF2E", | |
"7DEDH-09ZFZ-M2EVK", | |
"3NXYK-ZLGJ4-0B94A" | |
] | |
async def shop(interaction: discord.Interaction, item: str = None): | |
user_id = interaction.user.id | |
balance = user_cash.get(user_id, 0) | |
if item is None: | |
embed = discord.Embed(title="Shop", description="Items:", color=0x787878) | |
embed.add_field(name="@everyone / ping", value="Price: $300,000,000", inline=False) | |
embed.add_field(name="100 / Robux Code", value=("Price: $999,000,000" if robux_codes else "Out of stock"), inline=False) | |
embed.add_field(name="steam/ Steam Games $2-$70 Value", value=("Price: $1,000,000,000" if steam_game_codes else "Out of stock"), inline=False) | |
embed.set_footer(text="Use /shop <item> to purchase") | |
await interaction.response.send_message(embed=embed) | |
elif item.lower() == "@everyone": | |
if balance >= 300000000: | |
user_cash[user_id] -= 300000000 | |
await interaction.response.send_message("Item bought. @everyone ping will be sent in 2 seconds.") | |
await asyncio.sleep(2) | |
await interaction.channel.send("@everyone") | |
else: | |
await interaction.response.send_message("You don't have enough money.") | |
elif item == "100": | |
if robux_codes: | |
if balance >= 999000000: | |
user_cash[user_id] -= 999000000 | |
code = robux_codes.pop(0) | |
await interaction.user.send(f"Here's your 100 Robux code: {code}") | |
await interaction.response.send_message("Code sent to your DMs.") | |
else: | |
await interaction.response.send_message("You don't have enough money to purchase this get richer fool") | |
else: | |
await interaction.response.send_message("This item is gone wait for a restock.") | |
elif item.lower() == "steam": | |
if steam_game_codes: | |
if balance >= 1000000000: | |
user_cash[user_id] -= 1000000000 | |
code = steam_game_codes.pop(0) # Redeem the first available code | |
await interaction.user.send(f"Here's your Steam game code: {code}") | |
await interaction.response.send_message("Code sent to your DMs.") | |
else: | |
await interaction.response.send_message("You don't have enough money to purchase this get richer fool") | |
else: | |
await interaction.response.send_message("All codes are redeemed wait for a restock.") | |
else: | |
await interaction.response.send_message("Invalid item. Use /shop to see available items.") |