Skip to content

Commit

Permalink
fix: Fixed discord.Intents.all() returning the wrong value. (#2257)
Browse files Browse the repository at this point in the history
* Fixed bug!

* Fixed Bug!

* added bug fix to change log

* style(pre-commit): auto fixes from pre-commit.com hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Aityz and pre-commit-ci[bot] authored Dec 2, 2023
1 parent 5849d64 commit 6bfae7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 6bfae7f

Please sign in to comment.