Answers for "cooldown discord.py documentation"

1

how to make a cooldown in discord.py

from discord.ext.commands import cooldown, BucketType

@commands.cooldown(1, 3, commands.BucketType.user)
@client.command()
async def command_name(ctx):
	print('Eyy')

@command_name.error
async def command_name_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        em = discord.Embed(title=f"You are in cooldown",description=f"Try again in {error.retry_after:.2f}s.", color=discord.Color.orange())
        await ctx.send(embed=em)
Posted by: Guest on June-28-2021

Code answers related to "cooldown discord.py documentation"

Browse Popular Code Answers by Language