Spaces:
Building
Building
Create cash.py
Browse files
cash.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import discord
|
2 |
+
from discord import app_commands
|
3 |
+
|
4 |
+
user_cash = {}
|
5 |
+
|
6 |
+
@app_commands.command(name="cash", description="Check your current cash balance or claim free cash")
|
7 |
+
async def cash(interaction: discord.Interaction):
|
8 |
+
user_id = interaction.user.id
|
9 |
+
balance = user_cash.get(user_id, 0)
|
10 |
+
|
11 |
+
if balance == 0:
|
12 |
+
user_cash[user_id] = 100
|
13 |
+
balance = 100
|
14 |
+
message = "You've claimed your free $100! Your current balance is $100.00"
|
15 |
+
else:
|
16 |
+
message = f"Your current balance is ${balance:.2f}"
|
17 |
+
|
18 |
+
embed = discord.Embed(title="Cash Balance", description=message, color=0x00ff00)
|
19 |
+
embed.set_footer(text="Use /dice to bet your cash!")
|
20 |
+
|
21 |
+
await interaction.response.send_message(embed=embed)
|