繁体   English   中英

不和谐的 ping 命令(Python)

[英]discord ping command (Python)

所以这是我当前的 ping 命令代码:

async def ping(ctx):
  await ctx.send(f"Pong! 🏓 \nLatency: **{round(client.latency * 1000)}ms**")

但我想让它像这样:示例图像

我怎么做?

编辑:好的不是嵌入,而是嵌入内部的内容,例如响应时间等。

这称为富嵌入。

请参阅: 如何通过我的 Discord bot 发送嵌入文件,w/python?

域名注册地址:

async def ping(ctx):
    embedVar = discord.Embed(title="Pong", description="Pong", color=0x00ff00)
    embedVar.add_field(name="Latency", value=str(round(client.latency * 1000)), inline=False)
    await ctx.send(embed=embedVar)

就像 testfile 已经说过的那样。

您必须使用不和谐嵌入

首先,您可以使用发电机。 生成器生成输入的预览和 Python 的代码示例。 这应该对你有帮助。

https://cog-creators.github.io/discord-embed-sandbox/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM