所以我让 cog 工作,当我在 cog 中进行其他嵌入时,它们可以工作,但对于这个特定的嵌入,它不起作用。我收到回溯错误,错误的最后一部分显示“ValueError:无法将浮点 NaN 转换为整数”
from discord.ext import commands
class pingcog(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def ping(self, ctx):
client = commands.Bot(command_prefix = "//", case_insensitive=True)
ping_embed = discord.Embed(color = 0x003f7f)
ping_embed.add_field(name = "Ping Command", value = f"Pong! {round(client.latency * 1000)}ms", inline = False)
ping_embed.set_author(name = ctx.author, icon_url = ctx.author.avatar_url)
await ctx.send(embed = ping_embed)
def setup(client):
client.add_cog(pingcog(client))```