Skip to content

Fix checks not properly handling Group commands type #6577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: V3/develop
Choose a base branch
from

Conversation

Sutaai
Copy link

@Sutaai Sutaai commented May 25, 2025

Description of the changes

This PR propose to add the type Group to the type variable used in Requires.get_decorator (Which is used by Red's checks).

This was made as creating a command group, in addition of one of Red's provided check, would alert Pylance of incorrect type, expecting type Command only.

Before

image

After
image
image

The correct type is now reflected.
Same issue and fix apply for @commands.hybrid_group

Have the changes in this PR been tested?

Yes

@github-actions github-actions bot added the Category: Core - API - Commands Package This is related to the `redbot.core.commands` package or `redbot.core.checks` module. label May 25, 2025
@Flame442
Copy link
Member

I would be interested to know if swapping the order of your checks on the group would make the error go away - put the is_owner below the @commands.group().

@Sutaai
Copy link
Author

Sutaai commented May 25, 2025

It does, but raise another error that I believe is rather more of an issue from discord.py.
image

This issue (This screenshot) apply to anything as long as @commands.group()/.command() is not the last decorator as far as I've seen. Some other combination could work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Commands Package This is related to the `redbot.core.commands` package or `redbot.core.checks` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants