[英]Discord.py logging edited and deleted messages in a specific channel
I want to have a discord bot for my server that logs deleted messages in a specific channel.我想为我的服务器安装一个 discord 机器人,在特定频道中记录已删除的消息。 I have tried but I'm new to coding this is what I came up with and it doesn't work.
我已经尝试过,但我对编码很陌生,这是我想出的,但它不起作用。 The code is shown below:
代码如下所示:
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)
Can anyone tell me what's wrong and the correct code please, it would be greatly appreciated and how to do logging for edited messages too谁能告诉我有什么问题和正确的代码,将不胜感激以及如何记录已编辑的消息
Take a look to this code:看看这段代码:
@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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.