Cooldown For Command On Discord Bot Python

You should decorate your command with

@commands.cooldown(1, 30, commands.BucketType.user)

This will add a ratelimit of 1 use per 30 seconds per user.
docs, example

You can change the BucketType to default, channel or server to create a global, channel or server ratelimit instead, but you can only have 1 cooldown on a command.

Note: In discord.py rewrite (v1.0+) instead of BucketType.server, you have to use BucketType.guild.

This will also cause a CommandOnCooldown exception in on_command_error

Leave a Comment