我想为我的服务器安装一个 Discord 机器人,用于在特定频道中记录已删除的消息。我已经尝试过,但我是编码新手,这是我想出来的,但它不起作用。代码如下所示:
async def on_message_delete(message):
embed=discord.Embed(title="{} deleted a message".format(member.name.message), description="", color="teal")
embed.add_field(name= message.content ,value="Deleted message", inline=True)
channel=bot.get_channel(channel_id)
await channel.send(embed=embed)
谁能告诉我出了什么问题和正确的代码,将不胜感激,以及如何记录已编辑的消息
答案 0 :(得分:0)
看看这段代码:
@bot.event
async def on_message_delete(message):
embed = discord.Embed(
title="{}'s message deleted.".format(message.author.name), #message.author is sender of the message
description=message.content,
color="teal"
)
channel=bot.get_channel(log_channel_id)
await channel.send(embed=embed)