Answers for "how to make a cooldown in 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
0

add cooldown to command discord.py

@commands.cooldown(1, 30, commands.BucketType.user)
Posted by: Guest on May-20-2021

Code answers related to "how to make a cooldown in discord.py"

Browse Popular Code Answers by Language