@client.event
async def on_command_error(ctx,error):
if isinstance(error , commands.CommandOnCooldown):
await ctx.send(f'{ctx.author.mention}**hold your horses buddy <:iac_namaste:841266597318361098>**')
await ctx.send('Try again in {:2f}s'.format(error.retry_after))
I have added cooldowns on one of my command for 20 min
@commands.cooldown(1 , 1200, type=commands.BucketType.user)
and it is working fine but I'm not getting the output in min or hr format
I want it to send something like try again in 20 min , and also show how many min's left
CodePudding user response:
The best way would be to just use the new discord timestamp format
import time # Add this to the top
# Then in the error handler
await ctx.send('Try again in <t:{}:R>'.format(int(time.time() error.retry_after)))