coollsd commited on
Commit
3e2913e
1 Parent(s): 4d9c217

Update shop.py

Browse files
Files changed (1) hide show
  1. shop.py +78 -46
shop.py CHANGED
@@ -1,58 +1,90 @@
1
  import discord
2
  from discord import app_commands
3
  import asyncio
4
- from cash import user_cash
5
-
6
- # Define the available codes for each item
7
- robux_codes = ["TD4XD-QHR5A-QMNYG"]
8
- steam_game_codes = [
9
- "6X5C2-FI9DW-8WF2E",
10
- "7DEDH-09ZFZ-M2EVK",
11
- "3NXYK-ZLGJ4-0B94A"
12
- ]
13
-
14
- @app_commands.command(name="shop", description="Buy items from the shop")
15
- @app_commands.describe(item="The item you want to buy")
 
 
 
 
 
 
 
16
  async def shop(interaction: discord.Interaction, item: str = None):
17
  user_id = interaction.user.id
18
  balance = user_cash.get(user_id, 0)
19
 
20
  if item is None:
21
- embed = discord.Embed(title="Shop", description="Items:", color=0x787878)
22
- embed.add_field(name="@everyone / ping", value="Price: $300,000,000", inline=False)
23
- embed.add_field(name="100 / Robux Code", value=("Price: $999,000,000" if robux_codes else "Out of stock"), inline=False)
24
- 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)
25
- embed.set_footer(text="Use /shop <item> to purchase")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  await interaction.response.send_message(embed=embed)
27
- elif item.lower() == "@everyone":
28
- if balance >= 300000000:
29
- user_cash[user_id] -= 300000000
30
- await interaction.response.send_message("Item bought. @everyone ping will be sent in 2 seconds.")
31
- await asyncio.sleep(2)
32
- await interaction.channel.send("@everyone")
33
- else:
34
- await interaction.response.send_message("You don't have enough money.")
35
  elif item == "100":
36
- if robux_codes:
37
- if balance >= 999000000:
38
- user_cash[user_id] -= 999000000
39
- code = robux_codes.pop(0)
40
- await interaction.user.send(f"Here's your 100 Robux code: {code}")
41
- await interaction.response.send_message("Code sent to your DMs.")
42
- else:
43
- await interaction.response.send_message("You don't have enough money to purchase this get richer fool")
44
- else:
45
- await interaction.response.send_message("This item is gone wait for a restock.")
46
  elif item.lower() == "steam":
47
- if steam_game_codes:
48
- if balance >= 1000000000:
49
- user_cash[user_id] -= 1000000000
50
- code = steam_game_codes.pop(0) # Redeem the first available code
51
- await interaction.user.send(f"Here's your Steam game code: {code}")
52
- await interaction.response.send_message("Code sent to your DMs.")
53
- else:
54
- await interaction.response.send_message("You don't have enough money to purchase this get richer fool")
55
- else:
56
- await interaction.response.send_message("All codes are redeemed wait for a restock.")
57
  else:
58
- await interaction.response.send_message("Invalid item. Use /shop to see available items.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import discord
2
  from discord import app_commands
3
  import asyncio
4
+
5
+ # Bot setup
6
+ class ShopBot(discord.Client):
7
+ def __init__(self):
8
+ super().__init__(intents=discord.Intents.default())
9
+ self.tree = app_commands.CommandTree(self)
10
+
11
+ async def setup_hook(self):
12
+ await self.tree.sync()
13
+
14
+ # Initialize bot and user cash dictionary
15
+ client = ShopBot()
16
+ user_cash = {} # Stores user balances
17
+
18
+ # Empty inventory lists to show everything is out of stock
19
+ robux_codes = []
20
+ steam_game_codes = []
21
+
22
+ @client.tree.command(name="shop", description="View and buy items from the shop")
23
  async def shop(interaction: discord.Interaction, item: str = None):
24
  user_id = interaction.user.id
25
  balance = user_cash.get(user_id, 0)
26
 
27
  if item is None:
28
+ embed = discord.Embed(
29
+ title="Shop",
30
+ description="All items are currently out of stock",
31
+ color=0xFF0000
32
+ )
33
+
34
+ embed.add_field(
35
+ name="@everyone Ping",
36
+ value="Price: $300,000,000\nStatus: Out of Stock",
37
+ inline=False
38
+ )
39
+ embed.add_field(
40
+ name="Robux Code (100 R$)",
41
+ value="Price: $999,000,000\nStatus: Out of Stock",
42
+ inline=False
43
+ )
44
+ embed.add_field(
45
+ name="Steam Game Code",
46
+ value="Price: $1,000,000,000\nStatus: Out of Stock",
47
+ inline=False
48
+ )
49
+
50
+ embed.set_footer(text="Use /shop <item> to attempt purchase")
51
  await interaction.response.send_message(embed=embed)
52
+ return
53
+
54
+ # Handle purchase attempts
55
+ if item.lower() == "@everyone":
56
+ await interaction.response.send_message("This item is currently out of stock.")
57
+
 
 
58
  elif item == "100":
59
+ await interaction.response.send_message("Robux codes are currently out of stock.")
60
+
 
 
 
 
 
 
 
 
61
  elif item.lower() == "steam":
62
+ await interaction.response.send_message("Steam game codes are currently out of stock.")
63
+
 
 
 
 
 
 
 
 
64
  else:
65
+ await interaction.response.send_message("Invalid item. Use /shop to see available items.")
66
+
67
+ @client.tree.command(name="balance", description="Check your balance")
68
+ async def balance(interaction: discord.Interaction):
69
+ user_id = interaction.user.id
70
+ balance = user_cash.get(user_id, 0)
71
+
72
+ embed = discord.Embed(
73
+ title="💰 Balance",
74
+ description=f"Your current balance: ${balance:,}",
75
+ color=0x00FF00
76
+ )
77
+ await interaction.response.send_message(embed=embed)
78
+
79
+ @client.tree.command(name="addmoney", description="Add money to a user (Admin only)")
80
+ @app_commands.checks.has_permissions(administrator=True)
81
+ async def addmoney(interaction: discord.Interaction, user: discord.Member, amount: int):
82
+ user_id = user.id
83
+ user_cash[user_id] = user_cash.get(user_id, 0) + amount
84
+
85
+ embed = discord.Embed(
86
+ title="💵 Money Added",
87
+ description=f"Added ${amount:,} to {user.mention}'s balance\nNew balance: ${user_cash[user_id]:,}",
88
+ color=0x00FF00
89
+ )
90
+ await interaction.response.send_message(embed=embed)