maint: warn Joel

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

28
aw.py
View File

@@ -227,22 +227,28 @@ 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
is_bot = message.author == bot.user
if is_bot and message.channel.id != BOT_LOG:
return
if is_bot:
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
) # noqa
# It is impossible to recover the message at this point
return return
channel = bot.get_channel(BOT_LOG)
if channel:
embed = discord.Embed( embed = discord.Embed(
title="Deleted Message", title="Deleted Message",
description="A message was deleted.", description="A message was deleted.",
color=0xDD2E44, color=0xDD2E44,
) )
embed.add_field( embed.add_field(name="Author", value=message.author.mention, inline=True) # noqa
name="Author", value=message.author.mention, inline=True embed.add_field(name="Channel", value=message.channel.mention, inline=True) # noqa
) # noqa
embed.add_field(
name="Channel", value=message.channel.mention, inline=True
) # noqa
if message.content: if message.content:
embed.add_field(name="Content", value=message.content, inline=False) # noqa embed.add_field(name="Content", value=message.content, inline=False) # noqa
@@ -258,8 +264,8 @@ async def on_message_delete(message):
) # noqa ) # noqa
embed.set_footer( embed.set_footer(
text=f"Message ID: {message.id} | Author ID: {message.author.id}" text=f"Message ID: {message.id} | Author ID: {message.author.id}" # noqa
) ) # noqa
await detect_ghost_ping(message) await detect_ghost_ping(message)
await channel.send(embed=embed) await channel.send(embed=embed)