Add file output for code evaluation commands & Better long output handling #5901

Closed
opened 2022-11-11 14:34:32 +01:00 by Luc1412 · 8 comments
Luc1412 commented 2022-11-11 14:34:32 +01:00 (Migrated from github.com)

What component of Red (cog, command, API) would you like to see improvements on?

Dev

Describe the enhancement you're suggesting.

Currently when evaluating code with a large response, it would be shown in multiple messages. (when typing more)

Dropping a file would be way more convenient.

Furthermore instead of typing more, a button will be nice. When clicking the button, the button disappears and a new message with a new button appears. (if there is further output)

Anything else?

No response

### What component of Red (cog, command, API) would you like to see improvements on? Dev ### Describe the enhancement you're suggesting. Currently when evaluating code with a large response, it would be shown in multiple messages. (when typing more) Dropping a file would be way more convenient. Furthermore instead of typing more, a button will be nice. When clicking the button, the button disappears and a new message with a new button appears. (if there is further output) ### Anything else? _No response_
Flame442 commented 2022-11-11 18:22:27 +01:00 (Migrated from github.com)

I'd be OK with a config option for outputting long dev results to a file rather than with send_interactive, but there's currently no config editing commands in Dev, so that would probably need a new command.

Using buttons rather than typing would be a change to send_interactive itself, which has cascading effects on all other cogs that use that method. I don't think that is a good idea unless it is behind a kwarg as to not break existing usage. I also don't know if it's a good idea for dev commands in particular.

I'd be OK with a config option for outputting long dev results to a file rather than with `send_interactive`, but there's currently no config editing commands in `Dev`, so that would probably need a new command. Using buttons rather than typing would be a change to `send_interactive` itself, which has cascading effects on all other cogs that use that method. I don't think that is a good idea unless it is behind a kwarg as to not break existing usage. I also don't know if it's a good idea for dev commands in particular.
Luc1412 commented 2022-11-11 19:10:06 +01:00 (Migrated from github.com)

@Flame442

I'd be OK with a config option for outputting long dev results to a file rather than with send_interactive, but there's currently no config editing commands in Dev, so that would probably need a new command.

Maybe instead of having a config option it could be enabled automatically once the output doesn't fit in one message. (That's the way I do it in my custom discord.py bot)

Using buttons rather than typing would be a change to send_interactive itself, which has cascading effects on all other cogs that use that method. I don't think that is a good idea unless it is behind a kwarg as to not break existing usage. I also don't know if it's a good idea for dev commands in particular.

Am not aware on all use-cases of send_interactive , but I fell like the current UX isn't that good. If you got more than a few messages, it can be annoying due to the delay and if you send more too fast, it doesn't get recognized. The button would be only clickable if the bot is ready to send a new message

@Flame442 > I'd be OK with a config option for outputting long dev results to a file rather than with send_interactive, but there's currently no config editing commands in Dev, so that would probably need a new command. Maybe instead of having a config option it could be enabled automatically once the output doesn't fit in one message. (That's the way I do it in my custom discord.py bot) > Using buttons rather than typing would be a change to send_interactive itself, which has cascading effects on all other cogs that use that method. I don't think that is a good idea unless it is behind a kwarg as to not break existing usage. I also don't know if it's a good idea for dev commands in particular. Am not aware on all use-cases of `send_interactive `, but I fell like the current UX isn't that good. If you got more than a few messages, it can be annoying due to the delay and if you send more too fast, it doesn't get recognized. The button would be only clickable if the bot is ready to send a new message
Flame442 commented 2022-11-11 19:52:41 +01:00 (Migrated from github.com)

Maybe instead of having a config option it could be enabled automatically once the output doesn't fit in one message.

The current behavior (using send_interactive) only happens when the message is too long already. I am saying that whether it uses buttons or text is a matter of personal preference, so it should be configurable not entirely replaced to always use buttons. When I'm writing an eval, I'm just typing, not using my mouse, and I'd personally prefer to not have to use my mouse just to see more output. I think it would be fine to have an option (with a kwarg to send_interactive or otherwise), but it should not be the only option.

If you got more than a few messages, it can be annoying due to the delay and if you send more too fast, it doesn't get recognized. The button would be only clickable if the bot is ready to send a new message

That's automatically handled by dpy, there isn't an easy way for the bot to know when it's rate limits are clear, since dpy just quietly handles that for it. Even if it was possible to know, adding a button after the message is sent requires editing the message, which is another api call.

> Maybe instead of having a config option it could be enabled automatically once the output doesn't fit in one message. The current behavior (using `send_interactive`) only happens when the message is too long already. I am saying that whether it uses buttons or text is a matter of personal preference, so it should be configurable not entirely replaced to always use buttons. When I'm writing an eval, I'm just typing, not using my mouse, and I'd personally prefer to not have to use my mouse just to see more output. I think it would be fine to have an option (with a kwarg to `send_interactive` or otherwise), but it should **not** be the only option. > If you got more than a few messages, it can be annoying due to the delay and if you send more too fast, it doesn't get recognized. The button would be only clickable if the bot is ready to send a new message That's automatically handled by dpy, there isn't an easy way for the bot to know when it's rate limits are clear, since dpy just quietly handles that for it. Even if it was possible to know, adding a button after the message is sent requires editing the message, which is another api call.
Luc1412 commented 2022-11-11 20:02:08 +01:00 (Migrated from github.com)

The current behavior (using send_interactive) only happens when the message is too long already. I am saying that whether it uses buttons or text is a matter of personal preference, so it should be configurable not entirely replaced to always use buttons. When I'm writing an eval, I'm just typing, not using my mouse, and I'd personally prefer to not have to use my mouse just to see more output. I think it would be fine to have an option (with a kwarg to send_interactive or otherwise), but it should not be the only option.

I wanted to refer to the file, not to the button. If the output is longer than 1 message, the first message should include a file with the complete output and allows the user to type more

That's automatically handled by dpy, there isn't an easy way for the bot to know when it's rate limits are clear, since dpy just quietly handles that for it. Even if it was possible to know, adding a button after the message is sent requires editing the message, which is another api call.

Good point. Keeping more at least as an option should be inevitable. Think better focusing then on what should be the default.
Especially devs prefer using keyboard only, but I assume the avarage Discord user would benefit from buttons UX.

> The current behavior (using send_interactive) only happens when the message is too long already. I am saying that whether it uses buttons or text is a matter of personal preference, so it should be configurable not entirely replaced to always use buttons. When I'm writing an eval, I'm just typing, not using my mouse, and I'd personally prefer to not have to use my mouse just to see more output. I think it would be fine to have an option (with a kwarg to send_interactive or otherwise), but it should not be the only option. I wanted to refer to the file, not to the button. If the output is longer than 1 message, the first message should include a file with the complete output **and** allows the user to type `more` > That's automatically handled by dpy, there isn't an easy way for the bot to know when it's rate limits are clear, since dpy just quietly handles that for it. Even if it was possible to know, adding a button after the message is sent requires editing the message, which is another api call. Good point. Keeping `more` at least as an option should be inevitable. Think better focusing then on what should be the default. Especially devs prefer using keyboard only, but I assume the avarage Discord user would benefit from buttons UX.
TrustyJAID commented 2022-11-11 20:38:07 +01:00 (Migrated from github.com)

Actually an idea that might work to solve both issues is have send_interactive listen for the word file so whenever it's used we can use the traditional more response to receive the next page but you can optionally say file and it would then upload all the content as a file in the next message. This would be backwards compatible.

Actually an idea that might work to solve both issues is have `send_interactive` listen for the word `file` so whenever it's used we can use the traditional `more` response to receive the next page but you can optionally say `file` and it would then upload all the content as a file in the next message. This would be backwards compatible.
Flame442 commented 2022-11-11 21:11:31 +01:00 (Migrated from github.com)

We appear to be in agreement that adding buttons to send_interactive is a bad idea, and Trusty will be PRing an option to say "file" with send_interaction to output the entire contents as a text file. That should be sufficient to close this issue.

We appear to be in agreement that adding buttons to `send_interactive` is a bad idea, and Trusty will be PRing an option to say "file" with `send_interaction` to output the entire contents as a text file. That should be sufficient to close this issue.
i-am-zaidali commented 2022-11-11 21:49:35 +01:00 (Migrated from github.com)

Could we also add a kwarg to the send_interactive function that makes it use buttons instead because that does sound cool to me. With buttons we could either make the output into a menu or just 2 buttons to either send the output 1 by 1 on each click (on the next message sent) or click the other button next to it to just send all the remaining pages. I hope I'm clear and understandable.

Could we also add a kwarg to the send_interactive function that makes it use buttons instead because that does sound cool to me. With buttons we could either make the output into a menu or just 2 buttons to either send the output 1 by 1 on each click (on the next message sent) or click the other button next to it to just send all the remaining pages. I hope I'm clear and understandable.
TrustyJAID commented 2022-11-11 21:51:53 +01:00 (Migrated from github.com)

Buttons are cool but only when used in appropriate places. The majority of use cases of send_interactive are for development tools reading very long outputs and tracebacks not something typically used for user interfaces. Therefore since it's not generally a tool for the average user interface it does not require the fancy new user interface tools and only serves to make a developer happier. I personally see zero use in having buttons that I now have to click to interact with that potentially muddy the already cluttered interface send_interactive has.

Edit: if you want buttons build the button interface yourself instead of using send_interactive, it's not hard and there's already a few tools in core to make using menus and buttons easier.

Buttons are cool but only when used in appropriate places. The majority of use cases of `send_interactive` are for development tools reading very long outputs and tracebacks not something typically used for user interfaces. Therefore since it's not generally a tool for the average user interface it does not require the fancy new user interface tools and only serves to make a developer happier. I personally see zero use in having buttons that I now have to click to interact with that potentially muddy the already cluttered interface `send_interactive` has. Edit: if you want buttons build the button interface yourself instead of using `send_interactive`, it's not hard and there's already a few tools in core to make using menus and buttons easier.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#5901
No description provided.