Add buttons to help #5634

Merged
TrustyJAID merged 47 commits from add-help-buttons into V3/develop 2022-10-12 16:29:10 +02:00
TrustyJAID commented 2022-03-22 18:15:50 +01:00 (Migrated from github.com)

Description of the changes

This adds support for button menus in help and adds a SimpleMenu cog creators can import to simply paginate items with buttons similar to the existing menu in terms of available features.

Have the changes in this PR been tested?

Yes

### Description of the changes This adds support for button menus in help and adds a SimpleMenu cog creators can import to simply paginate items with buttons similar to the existing menu in terms of available features. ### Have the changes in this PR been tested? <!-- Choose one (remove the line that doesn't apply): --> Yes <!-- If the question doesn't apply (for example, it's not a code change), choose Yes. Please respond to this question truthfully. We do not delay nor reject PRs based on the answer to this question but it allows to better review this PR. -->
phenom4n4n (Migrated from github.com) reviewed 2022-03-22 18:37:42 +01:00
@ -12,0 +70,4 @@
await interaction.message.delete()
class SimpleMenu(discord.ui.View):
phenom4n4n (Migrated from github.com) commented 2022-03-22 18:37:42 +01:00

I think Views should be suffixed with View (SimpleMenuView? PaginatedView?) so it isn't confused with menus from the old ext library.

I think Views should be suffixed with View (`SimpleMenuView`? `PaginatedView`?) so it isn't confused with menus from the old ext library.
TrustyJAID (Migrated from github.com) reviewed 2022-03-22 18:44:58 +01:00
@ -12,0 +70,4 @@
await interaction.message.delete()
class SimpleMenu(discord.ui.View):
TrustyJAID (Migrated from github.com) commented 2022-03-22 18:44:58 +01:00

I don't see any confusion here? SimpleMenu could be put into the utils.menus namespace but since it's a view I think it makes more sense inside the new utils.views namespace.

I don't see any confusion here? SimpleMenu could be put into the utils.menus namespace but since it's a view I think it makes more sense inside the new utils.views namespace.
Jackenmen (Migrated from github.com) reviewed 2022-04-03 04:37:43 +02:00
Jackenmen (Migrated from github.com) left a comment
  • Buttons aren't used if the bot doesn't have react perms.
  • [p]helpset usebuttons and [p]helpset usemenus are currently separate settings but it might make sense for the setting to work as a tribool. Either way, the user should be informed (in help, maybe also in command responses) that setting both doesn't work/is required for buttons to function (depending on what you choose to do here)
- Buttons aren't used if the bot doesn't have react perms. - `[p]helpset usebuttons` and `[p]helpset usemenus` are currently separate settings but it might make sense for the setting to work as a tribool. Either way, the user should be informed (in help, maybe also in command responses) that setting both doesn't work/is required for buttons to function (depending on what you choose to do here)
TrustyJAID commented 2022-04-03 04:41:46 +02:00 (Migrated from github.com)
  • Buttons aren't used if the bot doesn't have react perms.

Should we use buttons if menus are toggled and the bot does not have reaction perms despite buttons not being set then?

  • [p]helpset usebuttons and [p]helpset usemenus are currently separate settings but it might make sense for the setting to work as a tribool. Either way, the user should be informed (in help, maybe also in command responses) that setting both doesn't work/is required for buttons to function (depending on what you choose to do here)

I thought it was clear in the response "if menus are also enabled."

> * Buttons aren't used if the bot doesn't have react perms. Should we use buttons if menus are toggled and the bot does not have reaction perms despite buttons not being set then? > * `[p]helpset usebuttons` and `[p]helpset usemenus` are currently separate settings but it might make sense for the setting to work as a tribool. Either way, the user should be informed (in help, maybe also in command responses) that setting both doesn't work/is required for buttons to function (depending on what you choose to do here) I thought it was clear in the response "if menus are also enabled."
npc203 commented 2022-04-03 04:48:20 +02:00 (Migrated from github.com)

I'd support a tri-bool (a single command for toggling the three), one could get fancier by using a select menu for selecting the option perhaps.

I'd support a tri-bool (a single command for toggling the three), one could get fancier by using a select menu for selecting the option perhaps.
TrustyJAID commented 2022-04-03 04:53:28 +02:00 (Migrated from github.com)

My concern with a tri-bool is that there will be 2 groups of people, some who want buttons and some who do not want buttons. With a tri-bool I now have to decide whether True uses buttons or False uses buttons which will then cause some people in either group to be forced to change their setting appropriately. The current way I have it setup the bot will startup the way they're expecting and can then optionally adjust their settings as they wish.

My concern with a tri-bool is that there will be 2 groups of people, some who want buttons and some who do not want buttons. With a tri-bool I now have to decide whether True uses buttons or False uses buttons which will then cause some people in either group to be forced to change their setting appropriately. The current way I have it setup the bot will startup the way they're expecting and can then optionally adjust their settings as they wish.
TwinDragon commented 2022-04-03 04:58:55 +02:00 (Migrated from github.com)

I'm with Trusty on this and having it as two separate settings. Though I do like buttons, for menus, I'd prefer a selection menu, but that's not what's being talked about. In this case, I think leaving it up to the bot owner to set whether or not the bot were to use buttons should remain as-is and would be easier from a UX point to help differentiate what they do, rather than having it all in a single setting.

I'm with Trusty on this and having it as two separate settings. Though I do like buttons, for menus, I'd prefer a selection menu, but that's not what's being talked about. In this case, I think leaving it up to the bot owner to set whether or not the bot were to use buttons should remain as-is and would be easier from a UX point to help differentiate what they do, rather than having it all in a single setting.
Jackenmen commented 2022-04-03 05:01:16 +02:00 (Migrated from github.com)

What I meant by tribool would be sth like [p]helpset menus buttons/reactions/disable ([p]helpset menus being the command)

What I meant by tribool would be sth like `[p]helpset menus buttons/reactions/disable` (`[p]helpset menus` being the command)
TrustyJAID commented 2022-04-07 01:53:25 +02:00 (Migrated from github.com)

Something I have been thinking about is the possibility of attaching a select menu to the SimpleMenu. The idea being that if toggled the view would include the drop down selector showing up to 25 pages on the menu, if there's more than 25 the select menu would paginate e.g. if there's 50 pages and you're on page 25 it would show pages 13-37 on the drop down selector. Is this something people want included in this? Is this something people would want on [p]help as well? If it's included on [p]help how should it work? should it be included with all buttons menus or should there be a way to use just buttons with no drop down selector?

Something I have been thinking about is the possibility of attaching a select menu to the SimpleMenu. The idea being that if toggled the view would include the drop down selector showing up to 25 pages on the menu, if there's more than 25 the select menu would paginate e.g. if there's 50 pages and you're on page 25 it would show pages 13-37 on the drop down selector. Is this something people want included in this? Is this something people would want on `[p]help` as well? If it's included on `[p]help` how should it work? should it be included with all buttons menus or should there be a way to use just buttons with no drop down selector?
TrustyJAID commented 2022-04-08 01:05:19 +02:00 (Migrated from github.com)

I have implemented my idea mentioned above and included options for buttons, buttons with select menu, and select menu only.

I have implemented my idea mentioned above and included options for buttons, buttons with select menu, and select menu only.
Zephyrkul (Migrated from github.com) reviewed 2022-05-09 17:52:11 +02:00
@ -12,0 +235,4 @@
self.author = ctx.author
self.ctx = ctx
kwargs = await self.get_page(self.current_page)
self.message = await ctx.send(**kwargs, ephemeral=ephemeral)
Zephyrkul (Migrated from github.com) commented 2022-05-09 17:52:11 +02:00

I'm not sure if you plan on making this PR depend on a higher version of discord.py, but for the version of discord.py that Red currently installs this raises a TypeError for the unexpected ephemeral= kwarg.

I'm not sure if you plan on making this PR depend on a higher version of discord.py, but for the version of discord.py that Red currently installs this raises a `TypeError` for the unexpected `ephemeral=` kwarg.
TrustyJAID (Migrated from github.com) reviewed 2022-05-09 20:28:25 +02:00
@ -12,0 +235,4 @@
self.author = ctx.author
self.ctx = ctx
kwargs = await self.get_page(self.current_page)
self.message = await ctx.send(**kwargs, ephemeral=ephemeral)
TrustyJAID (Migrated from github.com) commented 2022-05-09 20:28:25 +02:00

I expect that by the time this PR gets fully reviewed and merged we will have bumped our d.py version to one that includes this kwarg on ctx. I added this as a sort of future-proof in the event cog creators want to use the menu as an ephemeral response from a slash command.

I expect that by the time this PR gets fully reviewed and merged we will have bumped our d.py version to one that includes this kwarg on ctx. I added this as a sort of future-proof in the event cog creators want to use the menu as an ephemeral response from a slash command.
Zephyrkul (Migrated from github.com) reviewed 2022-09-03 18:43:41 +02:00
Zephyrkul (Migrated from github.com) commented 2022-09-03 18:43:41 +02:00
            - `[p]helpset usemenus selectonly` - Enables a select menu only on help.
```suggestion - `[p]helpset usemenus selectonly` - Enables a select menu only on help. ```
Kowlin (Migrated from github.com) reviewed 2022-10-11 23:25:20 +02:00
@ -12,0 +70,4 @@
await interaction.message.delete()
class SimpleMenu(discord.ui.View):
Kowlin (Migrated from github.com) commented 2022-10-11 23:25:20 +02:00

I think SimpleMenu being placed here in views is totally fine and appropriate for its function and goal.

I think SimpleMenu being placed here in views is totally fine and appropriate for its function and goal.
Kowlin (Migrated from github.com) approved these changes 2022-10-12 16:29:01 +02:00
Kowlin (Migrated from github.com) left a comment

Working like a charm, thank you.

Working like a charm, thank you.
Sign in to join this conversation.
No reviewers
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!5634
No description provided.