Replies: 1 comment 1 reply
-
If you use a hybrid command then the cooldowns and checks etc are all shared and work transparently as expected. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I probably used the incorrect terminology in regards to syncing them. But I have a beg command I made and it has both a prefix-based command and a slash command.
Error handler:
if isinstance(error, commands.CommandOnCooldown):
embed = discord.Embed(title = '', color = discord.Color.red())
embed.add_field(name = "Error", value = "Still on cooldown, please try again in {:.2f}s'.format(error.retry_after))
await ctx.send(embed = embed)
I know that I will likely need to add another one of these^ for slash commands.
Then I have:
@commandscooldown(1, 240, commands.BucketType.user)
On the prefix-based command.
Following the documentation on slash command cooldowns: https://discordpy.readthedocs.io/en/latest/interactions/api.html?highlight=cooldown#discord.app_commands.checks.cooldown
I figure I could use something like what's shown, but prior to digging down a rabbit hole, how would I make it so that if a user types the prefix based command, they won't be able to then also use the slash command until a "shared" cooldown so-to-speak ends?
Beta Was this translation helpful? Give feedback.
All reactions