Skip to content

fix: remove invoke_without_command anti-pattern from hybrid groups#155

Merged
psykzz merged 1 commit into
mainfrom
msmith-riot/issue-150-standardize-hybrid-group-no-subcommand-h-c9eb49
May 27, 2026
Merged

fix: remove invoke_without_command anti-pattern from hybrid groups#155
psykzz merged 1 commit into
mainfrom
msmith-riot/issue-150-standardize-hybrid-group-no-subcommand-h-c9eb49

Conversation

@psykzz

@psykzz psykzz commented May 27, 2026

Copy link
Copy Markdown
Owner

Why

Several hybrid command groups across the codebase used invoke_without_command=True (or Red-bot's autohelp=False) solely to manually call ctx.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 (or autohelp=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 -- access group
  • activity_stats -- activity_group and set_config subgroup
  • albion_bandits -- bandits group
  • game_embed -- gameserver_group (also fixes a misplaced docstring that appeared after await ctx.defer())
  • hat -- _hat and _sethat groups
  • psymin -- psymin group
  • user -- _user group

Special case: movie_vote

The movie group used autohelp=False and invoked_subcommand is not None checks, 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 new movie status subcommand so the functionality is preserved under an explicit, discoverable command.

Not changed: assign_roles

assign_roles uses invoke_without_command=True legitimately -- 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

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>
@psykzz psykzz merged commit 565719f into main May 27, 2026
3 checks passed
@psykzz psykzz deleted the msmith-riot/issue-150-standardize-hybrid-group-no-subcommand-h-c9eb49 branch May 27, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize hybrid group no-subcommand handling across cogs

1 participant