python - Discord.py中的延迟命令

标签 python discord discord.py

我到过很多地方,但找不到使用discord.py进行ping(延迟)命令的方法,如下所示:

@client.command(pass_context=True)
async def pong(ctx):
    # Somehow find 'pingtime'
    await client.say(pingtime)

最佳答案

确实在这一点上,您应该使用rewrite branch of discord.py

这将是我使用命令扩展名的解决方案。

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

关于python - Discord.py中的延迟命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46307035/

相关文章:

python - 我可以将自己的 Python 类与 numpy 或其他一些矩阵库一起使用吗?

python - 如何在Python中使用zip和map编写csv文件?

javascript - Discord.js 为 ReactionRole 添加一次 react 收集器

用于 Selfbot 的 Discord API "soft-ban"?它只能读取自己的消息

python - 如何创建来自机器人的嵌入消息?

python - 显示 json python discord bot

python - 如何在 GraphViz 中生成矩形样式的边而不是曲线?

python - 使用 pymongo 更新 Mongo 文档中的平均值

python - 比如说,send_message 和 send,在 @bot 事件中不起作用怎么办?不和谐.py

javascript - 使用 Discord.Js 获取倒数第二条消息