Ask coding questions

← Back to all posts
how can i send cooldown in this format Hours:Minutes:seconds
chinnupavan48 (0)

I tried this ..

async def on_command_error(ctx,error):
    if isinstance(error,commands.CommandOnCooldown):
        s=error.retry_after
        mes=('Try again in {}s'.format(int(s)))
        await ctx.send(mes)
Comments
hotnewtop
MrVoo (102)

Make your own function for it, like this.

from time import sleep
def sleep2(h,m,s):
  duration = s+ m*60+ h*3600
  sleep(duration) 
chinnupavan48 (0)

@MrVoo
Thank you...
i tried this and it's working fine

async def on_command_error(ctx,error):
    if isinstance(error,commands.CommandOnCooldown):
        secs=error.retry_after
        mes=f"{secs // 3600:02.0f}:{(secs // 60) % 60:02.0f}:{secs % 60:02.0f}"

        await ctx.send("```please try again in : ```" + mes)