Answers for "how to make cooldown for event discord.py"

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 "how to make cooldown for event discord.py"

Browse Popular Code Answers by Language