diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/filtering/filtering.py | 3 | ||||
| -rw-r--r-- | bot/exts/utils/attachment_pastebin_uploader.py | 3 | 
2 files changed, 4 insertions, 2 deletions
| diff --git a/bot/exts/filtering/filtering.py b/bot/exts/filtering/filtering.py index 377cff015..b1cfa9e23 100644 --- a/bot/exts/filtering/filtering.py +++ b/bot/exts/filtering/filtering.py @@ -69,7 +69,8 @@ WEEKLY_REPORT_ISO_DAY = 3  # 1=Monday, 7=Sunday  async def _extract_text_file_content(att: discord.Attachment) -> str:      """Extract up to the first 30 lines and first 2000 characters (whichever is shorter) of an attachment."""      file_encoding = re.search(r"charset=(\S+)", att.content_type).group(1) -    file_lines: list[str] = (await att.read()).decode(encoding=file_encoding).splitlines() +    file_content_bytes = await att.read() +    file_lines = file_content_bytes.decode(file_encoding).splitlines()      first_n_lines = "\n".join(file_lines[:30])[:2_000]      return f"{att.filename}: {first_n_lines}" diff --git a/bot/exts/utils/attachment_pastebin_uploader.py b/bot/exts/utils/attachment_pastebin_uploader.py index 3e2152a97..0d3508108 100644 --- a/bot/exts/utils/attachment_pastebin_uploader.py +++ b/bot/exts/utils/attachment_pastebin_uploader.py @@ -39,7 +39,8 @@ class EmbedFileHandler(commands.Cog):      async def _convert_attachment(attachment: discord.Attachment) -> paste_service.PasteFile:          """Converts an attachment to a PasteFile, according to the attachment's file encoding."""          encoding = re.search(r"charset=(\S+)", attachment.content_type).group(1) -        file_content = (await attachment.read()).decode(encoding) +        file_content_bytes = await attachment.read() +        file_content = file_content_bytes.decode(encoding)          return paste_service.PasteFile(content=file_content, name=attachment.filename)      async def wait_for_user_reaction( | 
