【问题标题】:Repost an embed message by ID discord.py通过 ID discord.py 重新发布嵌入消息
【发布时间】:2021-07-02 09:28:34
【问题描述】:

我只想获取嵌入的内容。我什至不知道这是否可能。 那是我的尝试。

async def getEmbedContent(ctx):
    print("start")
    msg = await ctx.fetch_message(828964689648156702) # <-- embed ID
    print(msg.embeds)
    print("done")

控制台正在打印:

start
[<discord.embeds.Embed object at 0x000001D2F83D2790>]
done

如何让嵌入的漏洞内容再次重新发布到频道中?

【问题讨论】:

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


    【解决方案1】:

    msg.embeds 返回附加到消息的所有Embeds 的列表,因此您可以像从任何其他类中获取字段一样访问它们的字段。例如获取标题:

    >>> print(msg.embeds[0].title)
    embed_title_goes_here
    

    要重新发布它,您所要做的就是获取discord.Embed 实例并发送它。这与发送您自己创建的Embed 的过程相同,因为两种情况完全相同:发送discord.Embed

    await ctx.send(embed=msg.embeds[0])
    

    【讨论】:

      猜你喜欢
      • 2021-02-13
      • 2020-05-31
      • 1970-01-01
      • 2021-04-12
      • 1970-01-01
      • 2019-01-12
      • 2021-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多