Search code examples
pythondiscord.pyuptime

Discord.py Uptime


Using discord.py, I'm attempting to make a uptime script, im not sure if it would be a f string ( like await ctx.send(f"client.uptime") or a something else,

im seriously new to discord.py and have just started learning it, can somebody help?


Solution

  • Your example would be ctx.send(f"{client.uptime}") the curly braces in an f string is where the variable is. However, I think discord.py doesn't have a .uptime feature. You would need to save the time the bot started up then calculate the time difference when the command is run. You would use something like this.