Answers for "how to make a latency command discord.py"

1

how to make a latency command 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

how to make a latency command discord.py

@bot.command(name="ping", pass_context=True, aliases=["latency", "latence"])
async def ping(ctx):
    
    embed = discord.Embed(title="__**Latence**__", colour=discord.Color.dark_gold(), timestamp=ctx.message.created_at)
    embed.add_field(name="Latence du bot :", value=f"`{round(bot.latency * 1000)} ms`")

    await ctx.send(embed=embed)
    
    """
    Text in french
    """
Posted by: Guest on August-27-2021

Code answers related to "how to make a latency command discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language