diff options
| author | 2025-01-29 19:38:59 -0500 | |
|---|---|---|
| committer | 2025-01-29 19:38:59 -0500 | |
| commit | 1f50e946a67dd32fab53b293612e70453e57c93b (patch) | |
| tree | b46480a6c45416731ed7cfa91df75389f09bce87 | |
| parent | Move EmbedFileHandler cog to its own module (diff) | |
Exit early if none of the attachments are text.
Previously, the bot might have offered to upload the attachments in a message containing only images, and then done nothing.
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/utils/attachment_pastebin_uploader.py | 3 | 
1 files changed, 1 insertions, 2 deletions
| diff --git a/bot/exts/utils/attachment_pastebin_uploader.py b/bot/exts/utils/attachment_pastebin_uploader.py index cc507f39e..d6d3c7d2c 100644 --- a/bot/exts/utils/attachment_pastebin_uploader.py +++ b/bot/exts/utils/attachment_pastebin_uploader.py @@ -43,7 +43,7 @@ class EmbedFileHandler(commands.Cog):      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 message.attachments: +        if message.author.bot or not any(a.content_type.startswith("text") for a in message.attachments):              return          bot_reply = await message.reply(f"React with {PASTEBIN_UPLOAD_EMOJI} to upload your file to our paste bin") @@ -76,7 +76,6 @@ class EmbedFileHandler(commands.Cog):              async with aiohttp.ClientSession() as session:                  paste_response = await paste_service.send_to_paste_service(files=files, http_session=session)          except (paste_service.PasteTooLongError, ValueError): -            # paste is too long              await bot_reply.edit(content="Your paste is too long, and couldn't be uploaded.")              return          except paste_service.PasteUploadError: | 
