Skip to content
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

Change CheckDecorator type #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Change CheckDecorator type #94

wants to merge 1 commit into from

Conversation

PythonCoderAS
Copy link
Contributor

The decorator returned by check() has an attribute, predicate, that is relied upon by check_any(). Therefore, a check decorator cannot just be anything that returns a function but must include this attribute as well. check_any() also relies on this attribute, which is not present in _CheckPredicate.

The decorator returned by `check()` has an attribute, `predicate`, that is relied upon by `check_any()`. Therefore, a check decorator cannot just be anything that returns a function but must include this attribute as well. `check_any()` also relies on this attribute, which is not present in `_CheckPredicate`.
@@ -37,7 +37,8 @@ class _CheckPredicate(Protocol[_T_contra]):
def __call__(self, __ctx: _T_contra) -> Union[bool, Coroutine[Any, Any, bool]]: ...

@type_check_only
class _CheckDecorator(Protocol):
class _CheckDecorator:
predicate: _CheckPredicate[_CT]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep _CheckDecorator so it's not generic, _CT needs to be chaned to Any here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be reasonable to set discord.ext.commands.Context, since that will always be a Context instance?

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.

2 participants