Cooldown For Command On Discord Bot Python

前端 未结 1 925
清酒与你
清酒与你 2020-12-17 05:16
@client.command(pass_context = True)
async def getalt(ctx):
    msg = [\"gabrielwarren2000@gmail.com:Cyber123\", \"leandroriveros123@gmail.com:culillo123\", \"albesi         


        
相关标签:
1条回答
  • 2020-12-17 05:46

    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

    0 讨论(0)
提交回复
热议问题