'Discord.py - Set a command cooldown using the command's arguments
I have a discord bot and I am trying to make a command that gives you a certain amount of cash depending on the time you wait. Think of it like going on a quest in a game, where the 12-hour quest gives more than the 6-hour one, which gives more than the 3-hour one, and so on.
So to do this, I tried setting the command cooldown to the time specified when a user uses the command. Like so ('time' is the specified quest length in hours):
@bot.command("quest")
@commands.cooldown(1, time*60*60, commands.BucketType.user)
async def quest(ctx, time):
...
Obviously I got an error saying that the variable time is not defined. I tried searching for an answer but I couldn't find anything.
How can I use the command argument ('time') for the command cooldown?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
