Answers for "ping pong command discord.py"

2

bot ping discord.py

@client.command()
async def ping(ctx):
    before = time.monotonic()
    message = await ctx.send("Pong!")
    ping = (time.monotonic() - before) * 1000
    await message.edit(content=f"Pong!  `{int(ping)}ms`")
    
    #for discord.py rewrite
Posted by: Guest on February-03-2021
0

discord.py ping command

@bot.command(name="ping")
async def ping(ctx: commands.Context):
    await ctx.send(f"Pong! {round(bot.latency * 1000)}ms")
Posted by: Guest on October-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language