Skip to content

Commit eb2744e

Browse files
authored
Merge pull request #306 from practical-python-org/fix/on-message-edit-fix
fix/on message edit fix
2 parents 6b991ea + cc0677f commit eb2744e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/zorak/cogs/logging/logging_message_edit.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ async def on_message_edit(self, message_before, message_after):
3737
# Dont log admin actions.
3838
# This just gets really messy when we are cleaning things up
3939
# or doing dodgy business in secret places.
40+
if len(message_before) > 1000:
41+
message_before = message_before[:1000]
42+
if len(message_after) > 1000:
43+
message_after = message_after[:1000]
44+
4045
embed = embed_message_edit(username, author, message_before, message_after)
4146
logs_channel = await self.bot.fetch_channel(self.bot.server_settings.log_channel["chat_log"])
4247
await logs_channel.send(embed=embed)

src/zorak/utilities/cog_helpers/_embeds.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ def embed_message_edit(some_username, orig_author, some_message_before, some_mes
117117
, color=discord.Color.dark_orange()
118118
, timestamp=datetime.utcnow()
119119
)
120-
121-
embed.set_thumbnail(
122-
url=orig_author.avatar
123-
)
120+
if orig_author.avatar is not None:
121+
embed.set_thumbnail(
122+
url=orig_author.avatar
123+
)
124124

125125
embed.add_field(
126126
name='Original message: '

0 commit comments

Comments
 (0)