diff --git a/bot/exts/utils/attachment_pastebin_uploader.py b/bot/exts/utils/attachment_pastebin_uploader.py index 9a805dd660..1ea74b5090 100644 --- a/bot/exts/utils/attachment_pastebin_uploader.py +++ b/bot/exts/utils/attachment_pastebin_uploader.py @@ -77,8 +77,8 @@ async def on_message_delete(self, message: discord.Message) -> None: @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}")