fix: remove invoke_without_command anti-pattern from hybrid groups#155
Merged
psykzz merged 1 commit intoMay 27, 2026
Conversation
Remove invoke_without_command=True (and Red-bot's autohelp=False) from hybrid_group decorators that only used it to manually call send_help(). The Red-bot/Discord.py framework already shows help automatically when a group command is invoked without a subcommand. Affected cogs: - access: access group - activity_stats: activity_group and set_config subgroup - albion_bandits: bandits group - game_embed: gameserver_group (also fix misplaced docstring) - hat: _hat and _sethat groups - movie_vote: movie group — remove autohelp=False + invoked_subcommand check; extract guild config display into new 'movie status' subcommand - psymin: psymin group - user: _user group assign_roles is intentionally unchanged — its group body does real work (role assignment), making invoke_without_command=True legitimate there. Closes #150 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Several hybrid command groups across the codebase used
invoke_without_command=True(or Red-bot'sautohelp=False) solely to manually callctx.send_help()when no subcommand was given. The Red-bot/Discord.py framework already handles this automatically, so the extra code was dead weight that added maintenance risk and diverged from framework conventions.What changed
For each affected group,
invoke_without_command=True(orautohelp=False) was removed from the decorator and the body was reduced to just the docstring. The framework now handles the no-subcommand case natively.Cogs fixed:
access--accessgroupactivity_stats--activity_groupandset_configsubgroupalbion_bandits--banditsgroupgame_embed--gameserver_group(also fixes a misplaced docstring that appeared afterawait ctx.defer())hat--_hatand_sethatgroupspsymin--psymingroupuser--_usergroupSpecial case: movie_vote
The
moviegroup usedautohelp=Falseandinvoked_subcommand is not Nonechecks, but also ran real logic (displaying active channels and emoji config) when called without a subcommand. The anti-pattern was removed and the config display was extracted into a newmovie statussubcommand so the functionality is preserved under an explicit, discoverable command.Not changed: assign_roles
assign_rolesusesinvoke_without_command=Truelegitimately -- its group body performs actual role assignment rather than just showing help. This is a valid use of the pattern and was left untouched.Fixes: #150