Skip to content

Snekbox: truncate blocked file extensions#2914

Merged
MarkKoz merged 3 commits into
mainfrom
bug/2464/truncate-snekbox-blocked-exts
Mar 26, 2024
Merged

Snekbox: truncate blocked file extensions#2914
MarkKoz merged 3 commits into
mainfrom
bug/2464/truncate-snekbox-blocked-exts

Conversation

@MarkKoz
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz commented Feb 4, 2024

Avoid Discord's character limit for messages.

Fix #2464

@MarkKoz MarkKoz added t: bug Something isn't working p: 3 - low Low Priority a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) labels Feb 4, 2024
@MarkKoz MarkKoz requested review from jb3 and ks129 as code owners February 4, 2024 01:13

return output, paste_link

async def format_file_text(self, text_files: list[FileAttachment], output: str) -> str:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as before. I just refactored it into its own function.

)
else:
blocked_str = self.join_blocked_extensions(blocked_sorted)
blocked_msg = f"Files with disallowed extensions can't be uploaded: **{blocked_str}**"
Copy link
Copy Markdown
Contributor Author

@MarkKoz MarkKoz Feb 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all extensions are too long then it will just show .... I think this is fine but it's also possible to completely omit : **{blocked_str}** in such case.

@wookie184 wookie184 self-requested a review March 20, 2024 02:07
@MarkKoz MarkKoz force-pushed the bug/2464/truncate-snekbox-blocked-exts branch from f45ea54 to 37c5e93 Compare March 22, 2024 20:59
@MarkKoz MarkKoz enabled auto-merge (rebase) March 22, 2024 21:00
Comment thread bot/exts/utils/snekbox/_cog.py Outdated
Comment thread bot/exts/utils/snekbox/_cog.py
MarkKoz and others added 2 commits March 25, 2024 17:10
Avoid Discord's character limit for messages.

Fix #2464
Co-authored-by: wookie184 <wookie1840@gmail.com>
@MarkKoz MarkKoz force-pushed the bug/2464/truncate-snekbox-blocked-exts branch from 1063442 to a74dc67 Compare March 26, 2024 00:10
Copy link
Copy Markdown
Contributor

@wookie184 wookie184 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely, thanks

@MarkKoz MarkKoz merged commit 563818e into main Mar 26, 2024
@MarkKoz MarkKoz deleted the bug/2464/truncate-snekbox-blocked-exts branch March 26, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) p: 3 - low Low Priority t: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BOT-3EQ: long file extensions cause !eval result responses to breach the message length limits

3 participants