Skip to content Skip to sidebar Skip to footer

Display A Countdown For The Python Sleep Function In Discord Embed In Python

hi all I am doing one discord bot I need to send one countdown it's like a cooldown embed after every request I did this code but I don't know how to add this in my embed for i in

Solution 1:

import asyncio

@bot.command()
async def count(ctx, duration:int):
  msg = await ctx.send("Started")
  for i in range(duration, -1, -1):
    m, s = divmod(i, 60)
    await msg.edit(content="{0:02}:{1:02}".format(m, s))
    await asyncio.sleep(1)

This is the timer command but not working good if called more then 1.


Post a Comment for "Display A Countdown For The Python Sleep Function In Discord Embed In Python"