Skip to content

Commit 8857488

Browse files
fix: don't upload attachments in dms (#3412)
* fix: don't upload attachments in dms closes GH-3403
1 parent d21c2c7 commit 8857488

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bot/exts/utils/attachment_pastebin_uploader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ async def on_message_delete(self, message: discord.Message) -> None:
7777
@commands.Cog.listener()
7878
async def on_message(self, message: discord.Message) -> None:
7979
"""Listens for messages containing attachments and offers to upload them to the pastebin."""
80-
# Check if the message contains an embedded file and is not sent by a bot.
81-
if message.author.bot or not any("charset" in a.content_type for a in message.attachments):
80+
# Check if the message contains an embedded file and is not sent by a bot or in DMs.
81+
if message.author.bot or not message.guild or not any("charset" in a.content_type for a in message.attachments):
8282
return
8383

8484
log.trace(f"Offering to upload attachments for {message.author} in {message.channel}, message {message.id}")

0 commit comments

Comments
 (0)