diff --git a/CHANGELOG.md b/CHANGELOG.md index c25bdf480c..efcfdd7a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -196,6 +196,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 diff --git a/discord/flags.py b/discord/flags.py index 7429215fb6..9fab0fe221 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -637,8 +637,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