【问题标题】:Discord ping command for discord.pydiscord.py 的 Discord ping 命令
【发布时间】:2020-11-11 09:31:30
【问题描述】:

我已经有一个 ping 命令,但最近我得到了 0.0 作为输出。在这种情况下可能是四舍五入,但我没有回溯错误。有没有办法让我的 ping 输出显示为这样? 0.123

我的代码:

@client.command()
async def ping(ctx):
  await ctx.send('Pong! {0}'.format(round(client.latency, 1)))

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    只需删除 round() 或将数字 1 更改为更高的值

    @client.command()
    async def ping(ctx):
      await ctx.send('Pong! {0}'.format(client.latency))
    

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 1970-01-01
      • 2021-10-11
      • 2021-06-06
      • 2019-07-23
      • 2021-04-16
      • 2021-01-01
      • 2020-08-16
      • 2021-01-13
      相关资源
      最近更新 更多