'Discord bot cooldown doesn´t work in the drop down menu
I am here to ask you for some help with my discord bot. Everything work just a fine, but I wanted my bot to be more like gui thing instead of writing every command to chat. So I made everything to dropdown menu. Everything works, but cooldowns not.
@client.command()
@commands.cooldown(1,3600,commands.BucketType.user)
async def reuploadprace(ctx):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
await ctx.send(f"Přišel ti příjem z reklam od PH. Celkem {reuploadlove} € .")
users[str(user.id)]["moneybag"] += int(reuploadlove)
with open("banka.json", "w") as f:
json.dump(users, f)
@client.command()
async def vyberprace(ctx):
await ctx.send("Co dnes chceš dělat ??",
components=[
Select(placeholder="Vyber práci",
options=[
SelectOption(label="Sockovat",
value="socka",
description="Vysockuješ nějaký love na autobusáku. Sockovat můžeš jednou za 30 vteřin."),
SelectOption(label="Oprava stroje v Hamečku 🔨",
value="oprava",
description="Jedeš ve 3 ráno opravit stroj do Hamečka. Opravovat můžeš jednou za 30 minut."),
SelectOption(label="Stahovat premium videa a uploudovat to na PH 🧡🖤",
value="reupload",
description="dalčí popis není nutný. Stahovat můžeš jednou za 1 hodinu.")],
custom_id="pracevyber")])
interaction = await client.wait_for("select_option", check=lambda inter: inter.custom_id == "pracevyber")
pracevyber = interaction.values[0]
if pracevyber == "socka":
await ctx.invoke(sockovat)
if pracevyber == "reupload":
await ctx.invoke(reuploadprace)
With this code When I trigger it by using chat everything works, money added to balance and Cooldown works too. But when I trigger it from dropdown menu it add´s money, and everything, but cooldown wont start. Any experience with this ? Thanks for reading guys.. and I hope someon can help me with this trouble. Have a nice rest of the day !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
