Spaces:
Paused
Paused
Update roulette.py
Browse files16 unmodified lines17181920212223242526272829303132331 unmodified line3536373839404142434445465 unmodified lines5253545556575816 unmodified lines75767778798016 unmodified linesreturnif bet > balance:await interaction.response.send_message(f"you got no money. Your current balance is ${balance:.2f}")returnif choice not in ["red", "black", "green"] and not (choice.isdigit() and 0 <= int(choice) <= 36):await interaction.response.send_message("Invalid. Choose 'red', 'black', 'green', or a number between 0 and 36.")returnembed = discord.Embed(title="Roulette Game", description=f"{interaction.user.name} is betting ${bet:.2f} on {choice}", color=0x787878)embed.add_field(name="Current Balance", value=f"${balance:.2f}", inline=False)spin_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="Spin the Roulette", custom_id="spin_roulette")async def spin_roulette_callback(interaction: discord.Interaction):nonlocal balance1 unmodified lineresult_color = "green" if result_number == 0 else ("red" if result_number % 2 == 1 else "black")win = Falseif choice.isdigit():win = int(choice) == result_numberpayout = bet * 35 if win else -betelse:win = choice == result_colorpayout = bet * 2 if win else -betbalance += payoutuser_cash[user_id] = balance5 unmodified linesembed.add_field(name="Result", value=result_text, inline=False)embed.add_field(name="New Balance", value=f"${balance:.2f}", inline=False)spin_again_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="Spin Again", custom_id="spin_again")async def spin_again_callback(interaction: discord.Interaction):if interaction.user.id == user_id:16 unmodified linesif interaction.response.is_done():await interaction.followup.send(embed=embed, view=view)else:await interaction.response.send_message(embed=embed, view=view)# Ensure you have set up your bot and registered this command appropriately in your bot setup code.16 unmodified lines171819202122232425262728293031323334351 unmodified line373839404142434445464748495 unmodified lines5556575859606116 unmodified lines7879808116 unmodified linesreturnif bet > balance:await interaction.response.send_message(f"You don't have enough cash. Your current balance is ${balance:.2f}")returnvalid_choices = ["red", "black", "green"] + [str(i) for i in range(37)]if choice not in valid_choices:await interaction.response.send_message("Invalid choice. Choose 'red', 'black', 'green', or a number between 0 and 36.")returnembed = discord.Embed(title="Roulette Game", description=f"{interaction.user.name} is betting ${bet:.2f}", color=0x787878)embed.add_field(name="Your Bet", value=f"Choice: {choice}", inline=False)embed.add_field(name="Current Balance", value=f"${balance:.2f}", inline=False)spin_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="Spin the Roulette 🎡", custom_id="spin_roulette")async def spin_roulette_callback(interaction: discord.Interaction):nonlocal balance1 unmodified lineresult_color = "green" if result_number == 0 else ("red" if result_number % 2 == 1 else "black")win = Falsepayout = -betif choice.isdigit():win = int(choice) == result_numberpayout = bet * 35 if win else payoutelse:win = choice == result_colorpayout = bet * 2 if win else payoutbalance += payoutuser_cash[user_id] = balance5 unmodified linesembed.add_field(name="Result", value=result_text, inline=False)embed.add_field(name="New Balance", value=f"${balance:.2f}", inline=False)spin_again_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="Spin Again 🔄", custom_id="spin_again")async def spin_again_callback(interaction: discord.Interaction):if interaction.user.id == user_id:16 unmodified linesif interaction.response.is_done():await interaction.followup.send(embed=embed, view=view)else:await interaction.response.send_message(embed=embed, view=view)
roulette.py+12-11