【发布时间】:2021-05-04 07:44:03
【问题描述】:
我有一个小问题,我不知道如何解决它。我想编辑一个消息嵌入,如果它被发布,它是由一个不和谐的 webhook 直接发送的。这就是为什么我为此使用“on_message”事件。在正常情况下,您可以只获取消息而不是使用msg.edit,但这不适用于 webhook 消息。
如何在 webhook 发布消息后直接对其进行编辑?我尝试使用 api“discord-webhooks”,但找不到我想要的解决方案。
我试过了:
@bot.event
async def on_message(message):
##### Netflix-News edit ######
if message.channel.id == 804484025166856262:
embed = discord.Embed(title=f"{title}",
url=f"{lonk}",
description=f"{descfix}",
color=0xe74c3c)
embed.set_thumbnail(url=f"https://i.imgur.com/4np2bdK.png")
embed.set_image(url=f"{Thumbnail}")
embed.set_footer(text=f"{footer}", icon_url="https://i.imgur.com/4np2bdK.png")
webhook = DiscordWebhook(url='LINKHERE')
webhook.embed = embed
await webhook.edit(sent_webhook)
【问题讨论】:
标签: python python-3.x discord.py webhooks discord.py-rewrite