Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -225,36 +225,45 @@ async def dice(interaction: discord.Interaction, bet: int):
|
|
225 |
|
226 |
embed = discord.Embed(title="Dice Roll", description=f"{interaction.user.name} is betting ${bet:.2f}", color=0x00ff00)
|
227 |
embed.add_field(name="Current Balance", value=f"${balance:.2f}", inline=False)
|
|
|
228 |
|
229 |
-
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
-
|
|
|
253 |
|
254 |
view = discord.ui.View()
|
255 |
-
view.add_item(
|
|
|
256 |
|
257 |
-
await
|
258 |
|
259 |
@tree.command(name="admincash", description="Admin command to add cash to a specific user")
|
260 |
async def admincash(interaction: discord.Interaction, user: discord.User, amount: int):
|
|
|
225 |
|
226 |
embed = discord.Embed(title="Dice Roll", description=f"{interaction.user.name} is betting ${bet:.2f}", color=0x00ff00)
|
227 |
embed.add_field(name="Current Balance", value=f"${balance:.2f}", inline=False)
|
228 |
+
embed.add_field(name="Rolling...", value="🎲", inline=False)
|
229 |
|
230 |
+
message = await interaction.response.send_message(embed=embed)
|
231 |
|
232 |
+
# Simulate dice rolling animation
|
233 |
+
for _ in range(3):
|
234 |
+
await asyncio.sleep(1)
|
235 |
+
embed.set_field_at(1, name="Rolling...", value="🎲"*random.randint(1,6), inline=False)
|
236 |
+
await message.edit(embed=embed)
|
237 |
+
|
238 |
+
result = random.choice(["win", "lose"])
|
239 |
+
|
240 |
+
if result == "win":
|
241 |
+
winnings = bet
|
242 |
+
balance += winnings
|
243 |
+
result_text = f"You won ${winnings:.2f}!"
|
244 |
+
else:
|
245 |
+
balance -= bet
|
246 |
+
result_text = f"You lost ${bet:.2f}."
|
247 |
+
|
248 |
+
user_cash[user_id] = balance
|
249 |
+
|
250 |
+
embed.set_field_at(1, name="Result", value=result_text, inline=False)
|
251 |
+
embed.set_field_at(0, name="New Balance", value=f"${balance:.2f}", inline=False)
|
252 |
+
|
253 |
+
roll_again_double = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"Roll Again (Double: ${bet*2:.2f})", custom_id="roll_again_double")
|
254 |
+
roll_again_same = discord.ui.Button(style=discord.ButtonStyle.secondary, label=f"Roll Again (Same: ${bet:.2f})", custom_id="roll_again_same")
|
255 |
+
|
256 |
+
async def roll_again_callback(interaction: discord.Interaction, new_bet):
|
257 |
+
await dice(interaction, new_bet)
|
258 |
|
259 |
+
roll_again_double.callback = lambda i: roll_again_callback(i, bet*2)
|
260 |
+
roll_again_same.callback = lambda i: roll_again_callback(i, bet)
|
261 |
|
262 |
view = discord.ui.View()
|
263 |
+
view.add_item(roll_again_double)
|
264 |
+
view.add_item(roll_again_same)
|
265 |
|
266 |
+
await message.edit(embed=embed, view=view)
|
267 |
|
268 |
@tree.command(name="admincash", description="Admin command to add cash to a specific user")
|
269 |
async def admincash(interaction: discord.Interaction, user: discord.User, amount: int):
|