Skip to content

!eval auto-upload truncate logic is at odds with actual settings #1239

@bast0006

Description

@bast0006

At the moment, eval automatically truncates output that is greater than 10 lines or has more than 1000 characters.

The eval formatter cuts off the output past 1000 characters with a "message is too long" message and past 10 lines with a "too many lines" message. However, at the moment it is set (with MAX_PASTE_LEN) to not upload results that have more than 1000 characters.

        elif len(output) >= 1000:
            truncated = True
            output = f"{output[:1000]}\n... (truncated - too long)"

        if truncated:
            paste_link = await self.upload_output(original_output)

This code contains a logic path that will only succeed at precisely 1000 characters, because the upload_output function checks len() > MAX_PASTE_LEN, but here we check len(output) >= 1000.

This is probably not worth cleaning up (because it's clearly intended to support higher MAX_PASTE_LEN values), but I think we should consider raising what we have this cap set to or moving the configuration value into the bot's actual configuration rather than a module constant. I'd vote for something around 2000-5000, at least enough to fit in a single message on the discord side, while keeping in mind we don't want to flood a channel with massive output.

Metadata

Metadata

Assignees

Labels

a: utilityRelated to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils)p: 2 - normalNormal Priorityt: bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions