【发布时间】:2025-12-28 05:35:11
【问题描述】:
这是我当前的 ping 命令代码:
async def ping(ctx):
await ctx.send(f"Pong! ???? \nLatency: **{round(client.latency * 1000)}ms**")
但我想变成这样:
我该怎么做?
编辑:好吧,不是嵌入,而是嵌入中的内容,例如响应时间等。
【问题讨论】:
标签: python discord discord.py
这是我当前的 ping 命令代码:
async def ping(ctx):
await ctx.send(f"Pong! ???? \nLatency: **{round(client.latency * 1000)}ms**")
但我想变成这样:
我该怎么做?
编辑:好吧,不是嵌入,而是嵌入中的内容,例如响应时间等。
【问题讨论】:
标签: python discord discord.py
这称为富嵌入。
见:How can I send an embed via my Discord bot, w/python?
TLDR:
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 代码示例。 这应该对您有所帮助。
【讨论】: