Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -85,31 +85,31 @@ async def on_message_edit(before, after):
|
|
85 |
@bot.event
|
86 |
async def on_message_delete(message):
|
87 |
try:
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
except Exception as e:
|
114 |
print(f"Error: {e}")
|
115 |
|
|
|
85 |
@bot.event
|
86 |
async def on_message_delete(message):
|
87 |
try:
|
88 |
+
if message.author == bot.user:
|
89 |
+
return
|
90 |
+
|
91 |
+
embed = Embed(color=Color.red())
|
92 |
+
embed.set_author(name=f"{message.author} ID: {message.author.id}", icon_url=message.author.avatar.url)
|
93 |
+
embed.title = "Message Deleted"
|
94 |
+
embed.description = message.content or "*(empty message)*"
|
95 |
+
embed.add_field(name="Author Username", value=message.author.name, inline=True)
|
96 |
+
embed.add_field(name="Channel", value=message.channel.mention, inline=True)
|
97 |
+
#embed.add_field(name="Message Created On", value=message.created_at.strftime("%Y-%m-%d %H:%M:%S UTC"), inline=True)
|
98 |
+
embed.add_field(name="Message Created On", value=convert_to_timezone(message.created_at, zurich_tz), inline=True)
|
99 |
+
embed.add_field(name="Message ID", value=message.id, inline=True)
|
100 |
+
embed.add_field(name="Message Jump URL", value=f"[Jump to message!](https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id})", inline=True)
|
101 |
+
|
102 |
+
if message.attachments:
|
103 |
+
attachment_urls = "\n".join([attachment.url for attachment in message.attachments])
|
104 |
+
embed.add_field(name="Attachments", value=attachment_urls, inline=False)
|
105 |
+
|
106 |
+
#embed.set_footer(text=f"{datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC')}")
|
107 |
+
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
108 |
+
|
109 |
+
if LOG_CHANNEL is not None:
|
110 |
+
await LOG_CHANNEL.send(embed=embed)
|
111 |
+
else:
|
112 |
+
print("Log channel not found.")
|
113 |
except Exception as e:
|
114 |
print(f"Error: {e}")
|
115 |
|