Discord Bot 无法在消息中找到嵌入内容

时间:2021-04-30 15:40:53

标签: python python-3.x discord discord.py

我有一条消息,其中嵌入了一条消息,使用时

message.embeds

我什么也没有得到,它的长度是 0 并且打印列表时什么都没有。如果我尝试引用列表中的任何内容,我会收到超出范围的错误,因为那里显然没有任何内容。

如果那里有原始文本,我仍然可以阅读消息内容本身。所以我的问题是,我会以错误的方式获得嵌入吗?如果没有,有没有办法只获取消息的原始文本并绕过嵌入?

谢谢!

下面添加的是我正在尝试阅读的其中一条消息的图片,您可以清楚地看到它有一个嵌入:

enter image description here

这里是完整代码的更多上下文

async def on_message(message):
      if message.channel.id in channels:
           print(str(message.embeds))
           #or any other reference to an embed in the message, none of the work

1 个答案:

答案 0 :(得分:0)

我不太明白您的问题,也许我只是愚蠢,但您的嵌入似乎有点问题。也许如果我给你举个例子你就会明白。

@client.command()
async def Embed(ctx):
    embed=discord.Embed(title="Title")
    embed.add_field(name="Field Name", value="Field Text", inline=False)
    await ctx.send(embed=embed)  

我希望这对您有所帮助,如果您想提出任何其他问题,请随时对此消息发表评论!谢谢,