diff --git a/CHANGELOG.md b/CHANGELOG.md index 4444d79d1a..02294de6da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/discord/flags.py b/discord/flags.py index 308083d673..9f687ff9bc 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -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