Spaces:
Building
Building
import discord | |
from discord import app_commands | |
import asyncio | |
from cash import user_cash | |
async def shop(interaction: discord.Interaction, item: str = None): | |
user_id = interaction.user.id | |
balance = user_cash.get(user_id, 0) | |
robux_code_available = True # | |
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) | |
if robux_code_available: | |
embed.add_field(name="100 / Robux Code", value="Price: $999,000,000", 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 got no money poor.") | |
elif item == "100": | |
if robux_code_available: | |
if balance >= 999000000: | |
user_cash[user_id] -= 999000000 | |
code = "TD4XD-QHR5A-QMNYG" | |
await interaction.user.send(f"Here's your 100 Robux code: {code}") | |
await interaction.response.send_message("Code sent to your DMs.") | |
robux_code_available = False # Mark the code as redeemed | |
else: | |
await interaction.response.send_message("You don't have enough money to purchase this.") | |
else: | |
await interaction.response.send_message("This item is no longer available too late fool.") | |
else: | |
await interaction.response.send_message(" Use /shop to see items.") |