Any way to use command cooldowns for slash commands? #105
-
I would want a command I have in a slash cog to not be replying every time the user wants to, I would want a 30 second cooldown so the bot doesn't have to run many commands at once from various users. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Cooldown support for slashcommands is currently limited to the preview version from discord.ext import commands
# the `1` will indicate how often the command can be used before a cooldown is "activated"
# `30` is the amount of seconds for cooldown
@slash_command(...)
@commands.cooldown(1, 30, commands.BucketType.user)
async def my_command(self, ctx):
... |
Beta Was this translation helpful? Give feedback.
-
I'm really sorry for that, seems that cooldowns can't work on slashcommands because of a missing attribute (interactions don't have a |
Beta Was this translation helpful? Give feedback.
-
I added cooldown support to the preview version so if you want to use cooldowns you will either have to switch to the preview version or wait until it gets released I've updated my original answer Sorry for the inconvenience |
Beta Was this translation helpful? Give feedback.
I added cooldown support to the preview version so if you want to use cooldowns you will either have to switch to the preview version or wait until it gets released
I've updated my original answer
Sorry for the inconvenience