[英]Discord.py logging edited and deleted messages in a specific channel
我想為我的服務器安裝一個 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)
誰能告訴我有什么問題和正確的代碼,將不勝感激以及如何記錄已編輯的消息
看看這段代碼:
@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.