[英]Repost an embed message by ID discord.py
我只想獲取嵌入的內容。 我什至不知道這是否可能。 那是我的嘗試。
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
如何獲取嵌入的空洞內容以將其重新發布到頻道中?
msg.embeds
返回附加到消息的所有Embeds
的列表,因此您可以像從任何其他 class 獲取字段一樣訪問它們的字段。 例如,要獲取標題:
>>> print(msg.embeds[0].title)
embed_title_goes_here
要重新發布它,您所要做的就是獲取discord.Embed
實例並發送它。 這與發送您自己創建的Embed
的過程相同,因為兩種情況完全相同:發送discord.Embed
。
await ctx.send(embed=msg.embeds[0])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.