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

fix: Intents.all returning the wrong value #2257

Merged
merged 9 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2271](https://github.com/Pycord-Development/pycord/pull/2271))
- Fixed `AttributeError` when serializing commands with `Annotated` type hints.
([#2243](https://github.com/Pycord-Development/pycord/pull/2243))
- Fixed `Intents.all()` returning the wrong value.
([#2257](https://github.com/Pycord-Development/pycord/issues/2257))

## [2.4.1] - 2023-03-20

Expand Down
4 changes: 2 additions & 2 deletions discord/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ def __init__(self, **kwargs: bool):
@classmethod
def all(cls: type[Intents]) -> Intents:
"""A factory method that creates a :class:`Intents` with everything enabled."""
bits = max(cls.VALID_FLAGS.values()).bit_length()
value = (1 << bits) - 1
value = sum({1 << (flag.bit_length() - 1) for flag in cls.VALID_FLAGS.values()})

self = cls.__new__(cls)
self.value = value
return self
Expand Down
Loading