Add file output for code evaluation commands & Better long output handling #5901
Labels
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
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#5901
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
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 inDev, so that would probably need a new command.Using buttons rather than typing would be a change to
send_interactiveitself, 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.@Flame442
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)
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 messageThe 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 tosend_interactiveor otherwise), but it should not be the only option.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.
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
moreGood point. Keeping
moreat 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.
Actually an idea that might work to solve both issues is have
send_interactivelisten for the wordfileso whenever it's used we can use the traditionalmoreresponse to receive the next page but you can optionally sayfileand it would then upload all the content as a file in the next message. This would be backwards compatible.We appear to be in agreement that adding buttons to
send_interactiveis a bad idea, and Trusty will be PRing an option to say "file" withsend_interactionto output the entire contents as a text file. That should be sufficient to close this issue.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.
Buttons are cool but only when used in appropriate places. The majority of use cases of
send_interactiveare 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 interfacesend_interactivehas.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.