我想让谁删除一条消息。这样的事情:message.deleted_by
将是解决方案。
这是我的代码:
@client.event
async def on_message_delete(message):
channel = client.get_channel(737364723107889304)
embed = discord.Embed(title='? ᴠᴇᴛᴇʀᴀɴᴏꜱ ɢᴜᴀʀᴅɪᴀɴ', description=f"{message.delete_by} deletou uma mensagem", color=discord.Color.dark_red())
embed.add_field(name="Informamos que:",value=f"{message.author} **teve uma mensagem com o seguinte conteudo deletada:** ```{message.content}```")
await channel.send(embed=embed)
有人知道我该怎么做吗? (经过一番搜索,我找到了解决方案)
这解决了我的问题:
@client.event
async def on_message_delete(message):
async for message in message.guild.audit_logs(action=discord.AuditLogAction.message_delete, limit=1):
delete_by = "{0.user}".format(message)
答案 0 :(得分:1)
是的,很简单:
@client.event
async def on_message_delete(message):
channel = client.get_channel(737364723107889304)
embed = discord.Embed(title='? ᴠᴇᴛᴇʀᴀɴᴏꜱ ɢᴜᴀʀᴅɪᴀɴ', description=f"{message.author} deletou uma mensagem", color=discord.Color.dark_red())
embed.add_field(name="Informamos que:",value=f"{message.author} **teve uma mensagem com o seguinte conteudo deletada:** ```{message.content}```")
await channel.send(embed=embed)
您需要做的就是将message.delete_by更改为message.author