Refactor fuzzy help and clean up help command #2122
No reviewers
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 project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2122
Loading…
Reference in a new issue
No description provided.
Delete branch "V3/bugfix/2031"
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?
I'm really sorry this is a big diff. There was lots to refactor though.
What's changed:
clean_prefixfrom the help formatter tocommands.ContextCommand.can_see(ctx: Context) -> boolmethod, which tries to mimic help formatter behaviour over whether a command can be seen in the current context.Okay, first of all, this works wonderfully, and I love the improvements this makes from a UX perspective.
There are a couple mostly small things I've noted below, and while I would not call any of them "must change", I'd prefer discussing them if you think there's a reason not to.
@ -106,6 +106,36 @@ class Command(commands.Command):# We should expose anything which might be a bug in the converterraise excIs this really worth importing itertools for? This could easily just be
for cmd in (self, *self.parents):@ -109,0 +135,4 @@return Falsereturn TrueThis logic only holds up with the default help formatter behavior, which can be changed while the bot is running by cogs. Do we care about this, or should we query the behavior of how the help formatter handles check failures?
@ -237,3 +237,20 @@ class Context(commands.Context):)I think it might be worth adding
metocontextasAnd use that here inside clean_prefix. There are many cases where the user/member object may be desired, and such a shortcut is nice to have.
@ -20,25 +20,24 @@ message to help page.e.g. format_help_for(ctx, ctx.command, "Missing required arguments")These credits at the top don't seem accurate anymore. The majority of the logic below is not equivalent to the work Danny or SirThane did. I'd like to see this modified to more appropriately credit their work as the work this is now building off of, rather than all of this being their work.
@ -106,6 +106,36 @@ class Command(commands.Command):# We should expose anything which might be a bug in the converterraise excGood point, it's not like
parentsis going to be a particular memory-hungry sequence.@ -109,0 +135,4 @@return Falsereturn TrueI'm happy with
can_seebeing a simple combination of check verification andhidden, however I am happy to make that more clear in the docstring. This method could yet see a little tweak in the upcoming permissions overhaul too.@ -109,0 +135,4 @@return Falsereturn TrueI guess that's fair enough. Anything calling it should be aware that if the formatter has been told to display all visible commands, this loses meaning, and a doc string change is enough to signal that.
👍 This one's ready to go.