aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/utils/attachment_pastebin_uploader.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/utils/attachment_pastebin_uploader.py b/bot/exts/utils/attachment_pastebin_uploader.py
index 9a805dd66..1ea74b509 100644
--- a/bot/exts/utils/attachment_pastebin_uploader.py
+++ b/bot/exts/utils/attachment_pastebin_uploader.py
@@ -77,8 +77,8 @@ class AutoTextAttachmentUploader(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: discord.Message) -> None:
"""Listens for messages containing attachments and offers to upload them to the pastebin."""
- # Check if the message contains an embedded file and is not sent by a bot.
- if message.author.bot or not any("charset" in a.content_type for a in message.attachments):
+ # Check if the message contains an embedded file and is not sent by a bot or in DMs.
+ if message.author.bot or not message.guild or not any("charset" in a.content_type for a in message.attachments):
return
log.trace(f"Offering to upload attachments for {message.author} in {message.channel}, message {message.id}")