[Help] Send menus to dm if maxpages is 0 #5375

Merged
Dav-Git merged 7 commits from usemenus-dm into V3/develop 2024-01-19 21:06:15 +01:00
Dav-Git commented 2021-10-07 17:35:57 +02:00 (Migrated from github.com)

Description of the changes

Blocked by #6282
Closes #5093

This PR will change help to send help menus to DMs if maxpages is 0.
Inconsistent with the "non-menu" mode the menus would always send in the invocation context even if maxpages was 0.

Currently i am a little stuck on the menus in the DM. For a reason i have yet to figure out the menu_ctx context does not play nicely with the menu.
While all messages and reactions can be sent/added, I can not flip the pages in the menu.

### Description of the changes ~~Blocked by #6282~~ Closes #5093 This PR will change help to send help menus to DMs if maxpages is 0. Inconsistent with the "non-menu" mode the menus would always send in the invocation context even if maxpages was 0. Currently i am a little stuck on the menus in the DM. For a reason i have yet to figure out the menu_ctx context does not play nicely with the menu. While all messages and reactions can be sent/added, I can not flip the pages in the menu.
Dav-Git commented 2021-10-11 10:45:52 +02:00 (Migrated from github.com)

I can‘t seem to find the issue here. The menu works fine with the old implementation when invoked in dms but for some reason my context for m doesn‘t want to work with it.

I can‘t seem to find the issue here. The menu works fine with the old implementation when invoked in dms but for some reason my context for m doesn‘t want to work with it.
Flame442 (Migrated from github.com) reviewed 2022-08-19 19:54:34 +02:00
Flame442 (Migrated from github.com) left a comment
No description provided.
`[p]helpset maxpages`'s help currently states: > Note: This setting does not apply to menu help. This needs to be changed to explain the new behavior specific to menus as a part of this PR.
Flame442 commented 2024-01-02 23:54:08 +01:00 (Migrated from github.com)

This PR has conflicts due to the addition of button support to help's menu options. Looking at the SimpleMenu class, it requires a ctx object to send the menu in, which won't exist for DMs. It does not support the message= kwarg that the older menu supported, to put a menu onto an existing message. Continuing to include this change would require a different approach to support button menus.

@TrustyJAID, you wrote the PR to add buttons to help, do you have any insight as to the best way to approach this?

This PR has conflicts due to the addition of button support to help's menu options. Looking at the `SimpleMenu` class, it requires a `ctx` object to send the menu in, which won't exist for DMs. It does not support the `message=` kwarg that the older `menu` supported, to put a menu onto an existing message. Continuing to include this change would require a different approach to support button menus. @TrustyJAID, you wrote the PR to add buttons to help, do you have any insight as to the best way to approach this?
TrustyJAID commented 2024-01-03 00:02:44 +01:00 (Migrated from github.com)

I think the best path forward would be adding a new option on SimpleMenu called start_dm which accepts a user parameter instead. This way it's a new feature for the menu and would allow this to happen. Looking at the SimpleMenu ctx is only used to extract the author and provide a messageable which can be simply replaced with the author in the new method.

I think the best path forward would be adding a new option on SimpleMenu called `start_dm` which accepts a user parameter instead. This way it's a new feature for the menu and would allow this to happen. Looking at the SimpleMenu ctx is only used to extract the author and provide a messageable which can be simply replaced with the author in the new method.
Flame442 commented 2024-01-03 00:12:43 +01:00 (Migrated from github.com)

Blocked until #6282 is resolved and this PR can use the new method.

Blocked until #6282 is resolved and this PR can use the new method.
Flame442 commented 2024-01-15 23:38:09 +01:00 (Migrated from github.com)

I can‘t seem to find the issue here. The menu works fine with the old implementation when invoked in dms but for some reason my context for m doesn‘t want to work with it.

The issue appears to be that generating ctx from a message sent by the bot sets ctx.author equal to the bot, rather than the invoker of help. This means the menu is listening for reactions from the bot, rather than from the user.
github.com/Cog-Creators/Red-DiscordBot@409ece427f/redbot/core/utils/menus.py (L200)
It should be possible to monkeypatch the author attribute to fix this issue.

> I can‘t seem to find the issue here. The menu works fine with the old implementation when invoked in dms but for some reason my context for m doesn‘t want to work with it. The issue appears to be that generating `ctx` from a message sent by the _bot_ sets `ctx.author` equal to the bot, rather than the invoker of `help`. This means the menu is listening for reactions from the bot, rather than from the user. https://github.com/Cog-Creators/Red-DiscordBot/blob/409ece427f9b8014cf0f28ff03a019cab323107e/redbot/core/utils/menus.py#L200 It should be possible to monkeypatch the author attribute to fix this issue.
Flame442 (Migrated from github.com) approved these changes 2024-01-19 21:06:04 +01:00
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!5375
No description provided.