maint: warn Joel

This commit is contained in:
2024-09-07 11:08:06 +02:00
parent 569d05d4e7
commit 75f630b020

64
aw.py
View File

@@ -227,42 +227,48 @@ async def detect_ghost_ping_in_edit(before, after):
@bot.event @bot.event
async def on_message_delete(message): async def on_message_delete(message):
if message.author == bot.user: channel = bot.get_channel(BOT_LOG)
if not channel:
return return
channel = bot.get_channel(BOT_LOG) is_bot = message.author == bot.user
if channel: if is_bot and message.channel.id != BOT_LOG:
embed = discord.Embed( return
title="Deleted Message",
description="A message was deleted.", if is_bot:
color=0xDD2E44, await message.channel.send(
) "You attempted to delete a message from a channel where messages are logged and stored indefinitely. Please refrain from doing so." # noqa
embed.add_field(
name="Author", value=message.author.mention, inline=True
) # noqa ) # noqa
embed.add_field( # It is impossible to recover the message at this point
name="Channel", value=message.channel.mention, inline=True return
) # noqa
if message.content:
embed.add_field(name="Content", value=message.content, inline=False) # noqa
if message.reference is not None: embed = discord.Embed(
original_message = await message.channel.fetch_message( title="Deleted Message",
message.reference.message_id description="A message was deleted.",
) color=0xDD2E44,
)
embed.add_field(name="Author", value=message.author.mention, inline=True) # noqa
embed.add_field(name="Channel", value=message.channel.mention, inline=True) # noqa
if message.content:
embed.add_field(name="Content", value=message.content, inline=False) # noqa
embed.add_field( if message.reference is not None:
name="Replied", original_message = await message.channel.fetch_message(
value=original_message.author.mention, message.reference.message_id
inline=False, # noqa
) # noqa
embed.set_footer(
text=f"Message ID: {message.id} | Author ID: {message.author.id}"
) )
await detect_ghost_ping(message) embed.add_field(
await channel.send(embed=embed) name="Replied",
value=original_message.author.mention,
inline=False, # noqa
) # noqa
embed.set_footer(
text=f"Message ID: {message.id} | Author ID: {message.author.id}" # noqa
) # noqa
await detect_ghost_ping(message)
await channel.send(embed=embed)
@bot.event @bot.event