Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,6 @@ tree = app_commands.CommandTree(bot)
|
|
15 |
|
16 |
luck_multipliers = {}
|
17 |
luck_expiration = {}
|
18 |
-
luck_button_used = set()
|
19 |
|
20 |
@app.get("/")
|
21 |
async def read_root():
|
@@ -158,7 +157,7 @@ async def perform_roll(interaction: discord.Interaction):
|
|
158 |
view = discord.ui.View()
|
159 |
view.add_item(roll_again_button)
|
160 |
|
161 |
-
if random.random() < 0.2
|
162 |
increase_luck_button = discord.ui.Button(style=discord.ButtonStyle.success, label="Increase Luck", custom_id="increase_luck")
|
163 |
|
164 |
async def increase_luck_callback(interaction: discord.Interaction):
|
@@ -166,14 +165,13 @@ async def perform_roll(interaction: discord.Interaction):
|
|
166 |
await interaction.response.send_message("cannot use", ephemeral=True)
|
167 |
return
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
luck_multipliers[user_id] = 2
|
174 |
luck_expiration[user_id] = time.time() + 1800 # 30 minutes
|
175 |
-
|
176 |
-
|
|
|
177 |
|
178 |
increase_luck_button.callback = increase_luck_callback
|
179 |
view.add_item(increase_luck_button)
|
|
|
15 |
|
16 |
luck_multipliers = {}
|
17 |
luck_expiration = {}
|
|
|
18 |
|
19 |
@app.get("/")
|
20 |
async def read_root():
|
|
|
157 |
view = discord.ui.View()
|
158 |
view.add_item(roll_again_button)
|
159 |
|
160 |
+
if random.random() < 0.2:
|
161 |
increase_luck_button = discord.ui.Button(style=discord.ButtonStyle.success, label="Increase Luck", custom_id="increase_luck")
|
162 |
|
163 |
async def increase_luck_callback(interaction: discord.Interaction):
|
|
|
165 |
await interaction.response.send_message("cannot use", ephemeral=True)
|
166 |
return
|
167 |
|
168 |
+
current_luck = luck_multipliers.get(user_id, 1)
|
169 |
+
new_luck = min(current_luck + 1, 10) # Cap at 10x
|
170 |
+
luck_multipliers[user_id] = new_luck
|
|
|
|
|
171 |
luck_expiration[user_id] = time.time() + 1800 # 30 minutes
|
172 |
+
|
173 |
+
luck_percentage = (new_luck - 1) * 100
|
174 |
+
await interaction.response.send_message(f"Your luck has been increased to x{luck_percentage}% for 30 minutes!", ephemeral=True)
|
175 |
|
176 |
increase_luck_button.callback = increase_luck_callback
|
177 |
view.add_item(increase_luck_button)
|