lunarflu HF Staff commited on
Commit
c6f650d
·
verified ·
1 Parent(s): aad0f27

test fix: break pings in backup message logs, embed nicely

Browse files
Files changed (1) hide show
  1. app.py +45 -1
app.py CHANGED
@@ -55,7 +55,7 @@ async def on_message(message):
55
 
56
 
57
  """Backup"""
58
-
59
  number_of_messages = number_of_messages + 1
60
  message_link = f"[#{urllib.parse.quote(message.channel.name)}]({message.jump_url})"
61
  msgcnt = message.content
@@ -71,6 +71,50 @@ async def on_message(message):
71
  backup_message += f"\nEmbed Title: {embed.title}\nEmbed Description: {embed.description}"
72
  dm_message = await bot.log_channel.send(backup_message)
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  """Antispam"""
76
 
 
55
 
56
 
57
  """Backup"""
58
+ """
59
  number_of_messages = number_of_messages + 1
60
  message_link = f"[#{urllib.parse.quote(message.channel.name)}]({message.jump_url})"
61
  msgcnt = message.content
 
71
  backup_message += f"\nEmbed Title: {embed.title}\nEmbed Description: {embed.description}"
72
  dm_message = await bot.log_channel.send(backup_message)
73
 
74
+
75
+ """
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+ """Backup"""
84
+
85
+ embed = discord.Embed(
86
+ title=f"Messages since last restart #{number_of_messages}",
87
+ color=discord.Color.blue()
88
+ )
89
+ embed.add_field(name="Channel", value=message_link, inline=False)
90
+ embed.add_field(name="Author", value=f"{message.author} (`{message.author.id}`)", inline=False)
91
+
92
+ # Use .content directly (no ping)
93
+ if message.content:
94
+ embed.add_field(name="Content", value=discord.utils.escape_markdown(message.content) or "*No text*", inline=False)
95
+
96
+ # Attachments
97
+ if message.attachments:
98
+ for attachment in message.attachments:
99
+ embed.add_field(name="Attachment", value=attachment.url, inline=False)
100
+
101
+ # Embeds
102
+ if message.embeds:
103
+ for i, embedded in enumerate(message.embeds):
104
+ if embedded.title or embedded.description:
105
+ embed.add_field(
106
+ name=f"Embed {i + 1}",
107
+ value=f"**{embedded.title or ''}**\n{embedded.description or ''}",
108
+ inline=False
109
+ )
110
+
111
+ await bot.log_channel.send(embed=embed)
112
+
113
+
114
+
115
+
116
+
117
+
118
 
119
  """Antispam"""
120