diff options
author | 2025-02-08 12:56:56 -0500 | |
---|---|---|
committer | 2025-02-08 12:56:56 -0500 | |
commit | 35cfb5481e600f08094708c1725d7a37219576e9 (patch) | |
tree | d4e317cb8371688008e1aff58bc9d177c29250e5 | |
parent | `and` -> `or` (diff) |
Use `"charset" in Attachment.content_type` to determine that it's text-based.
Previously, `on_message` used `Attachment.content_type.startswith("text")` for this, but this is false for some text-based files (like json).
-rw-r--r-- | bot/exts/utils/attachment_pastebin_uploader.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bot/exts/utils/attachment_pastebin_uploader.py b/bot/exts/utils/attachment_pastebin_uploader.py index 357b0feef..03439390b 100644 --- a/bot/exts/utils/attachment_pastebin_uploader.py +++ b/bot/exts/utils/attachment_pastebin_uploader.py @@ -79,7 +79,7 @@ class AutoTextAttachmentUploader(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 any(a.content_type.startswith("text") for a in message.attachments): + if message.author.bot 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}") |