HTTPException: 400 Bad Request (error code: 50006): Cannot s


@bot.command()
async def ping(ctx):
embed=discord.Embed(title="",description="`Bot Latency...`",color=colour)
msg = await ctx.send(embed=embed)
times = []
counter = 0
embed = discord.Embed(title="More Information:", description="4 pings have been made and here are the results:", colour=colour)
for _ in range(3):
counter += 1
start = time.perf_counter()
embed.description=f"Trying Ping... {counter}/3"
await msg.edit(embed=embed)
end = time.perf_counter()
speed = round((end - start) * 1000)
times.append(speed)
if speed < 160:
embed.add_field(name=f"Ping {counter}:", value=f"🟢 | {speed}ms", inline=True)
elif speed > 170:
embed.add_field(name=f"Ping {counter}:", value=f"🟡 | {speed}ms", inline=True)
else:
embed.add_field(name=f"Ping {counter}:", value=f"🔴 | {speed}ms", inline=True)
embed.set_author(name="🏓    PONG    🏓", icon_url="https://img.icons8.com/ultraviolet/40/000000/table-tennis.png")
embed.add_field(name="Bot Latency", value=f"{round(bot.latency * 1000)}ms", inline=True)
embed.add_field(name="Normal Speed", value=f"{round((round(sum(times)) + round(bot.latency * 1000))/4)}ms")
embed.set_footer(text=f"Total estimated elapsed time: {round(sum(times))}ms")
await msg.edit(content=f":ping_pong: **{round((round(sum(times)) + round(bot.latency * 1000))/4)}ms**", embed=embed)

Error: Command raise an exception: HTTPException: 400 Bad Request (Error code: 50006): Cannot send an empty message

它几天前还在工作,但突然就不工作了有什么帮助吗?

您的color嵌入错误。

你可以用color=discord.Color.light_gray()color=discord.Color.random()

请记住,每个嵌入的颜色都是随机的,如果你不想这样,那么在开始的时候把它保存到一个变量中,然后使用

完整颜色列表

最新更新