From 5461a06ad819fb1cec2d7e29a851703459c1f2bf Mon Sep 17 00:00:00 2001 From: Aityz Date: Wed, 8 Nov 2023 21:57:14 +1100 Subject: [PATCH 1/7] Fixed bug! --- discord/flags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/flags.py b/discord/flags.py index 308083d673..6a2e266df6 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -637,7 +637,7 @@ def __init__(self, **kwargs: bool): 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 = ((1 << bits) - 1) - (1 << 19) - (1 << 18) - (1 << 17) # Removing the unused flags self = cls.__new__(cls) self.value = value return self From 6667bbee5ad3e08cf498a4ad36c3f7d3a50507dd Mon Sep 17 00:00:00 2001 From: Aityz Date: Wed, 8 Nov 2023 22:25:42 +1100 Subject: [PATCH 2/7] Fixed Bug! --- discord/flags.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/flags.py b/discord/flags.py index 6a2e266df6..8f64135f1a 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -636,8 +636,9 @@ 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) - (1 << 19) - (1 << 18) - (1 << 17) # Removing the unused flags + shifts = list(dict.fromkeys([flag.bit_length() - 1 for flag in cls.VALID_FLAGS.values()])) + value = sum(1 << shift for shift in shifts) + self = cls.__new__(cls) self.value = value return self From ccb24e77b84b4d7a9b76d30602fe8ef97a98e288 Mon Sep 17 00:00:00 2001 From: Aityz Date: Wed, 8 Nov 2023 22:31:10 +1100 Subject: [PATCH 3/7] added bug fix to change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f9e96c11..91c0e9201a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -180,6 +180,7 @@ These changes are available on the `master` branch, but have not yet been releas ([#2192](https://github.com/Pycord-Development/pycord/pull/2192)) - Fixed `DMChannel.recipient` being `None` and consequently `User.dm_channel` also being `None`. ([#2219](https://github.com/Pycord-Development/pycord/pull/2219)) +- Fixed `discord.Intents.all()` returning the wrong value. ([#2195](https://github.com/Pycord-Development/pycord/issues/2195)) ## [2.4.1] - 2023-03-20 From 90a2e413af0324420dcc481777b211e39cb58a08 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 11:33:10 +0000 Subject: [PATCH 4/7] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 3 ++- discord/flags.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c0e9201a..63e0a3f6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -180,7 +180,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2192](https://github.com/Pycord-Development/pycord/pull/2192)) - Fixed `DMChannel.recipient` being `None` and consequently `User.dm_channel` also being `None`. ([#2219](https://github.com/Pycord-Development/pycord/pull/2219)) -- Fixed `discord.Intents.all()` returning the wrong value. ([#2195](https://github.com/Pycord-Development/pycord/issues/2195)) +- Fixed `discord.Intents.all()` returning the wrong value. + ([#2195](https://github.com/Pycord-Development/pycord/issues/2195)) ## [2.4.1] - 2023-03-20 diff --git a/discord/flags.py b/discord/flags.py index 8f64135f1a..994d53072c 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -636,7 +636,9 @@ def __init__(self, **kwargs: bool): @classmethod def all(cls: type[Intents]) -> Intents: """A factory method that creates a :class:`Intents` with everything enabled.""" - shifts = list(dict.fromkeys([flag.bit_length() - 1 for flag in cls.VALID_FLAGS.values()])) + shifts = list( + dict.fromkeys([flag.bit_length() - 1 for flag in cls.VALID_FLAGS.values()]) + ) value = sum(1 << shift for shift in shifts) self = cls.__new__(cls) From c5c9a2622f75b55983db35e3ee1e95c34acba788 Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Thu, 30 Nov 2023 19:10:08 +0300 Subject: [PATCH 5/7] Update CHANGELOG.md Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e0a3f6bc..7181d6757c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -180,8 +180,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2192](https://github.com/Pycord-Development/pycord/pull/2192)) - Fixed `DMChannel.recipient` being `None` and consequently `User.dm_channel` also being `None`. ([#2219](https://github.com/Pycord-Development/pycord/pull/2219)) -- Fixed `discord.Intents.all()` returning the wrong value. - ([#2195](https://github.com/Pycord-Development/pycord/issues/2195)) +- Fixed `Intents.all()` returning the wrong value. + ([#2257](https://github.com/Pycord-Development/pycord/issues/2257)) ## [2.4.1] - 2023-03-20 From 42d0c938140af7daa3d47cad946cad84b7609f57 Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Fri, 1 Dec 2023 07:59:44 +0300 Subject: [PATCH 6/7] Use set Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> --- discord/flags.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/discord/flags.py b/discord/flags.py index 994d53072c..ec41c9c48f 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -636,10 +636,7 @@ def __init__(self, **kwargs: bool): @classmethod def all(cls: type[Intents]) -> Intents: """A factory method that creates a :class:`Intents` with everything enabled.""" - shifts = list( - dict.fromkeys([flag.bit_length() - 1 for flag in cls.VALID_FLAGS.values()]) - ) - value = sum(1 << shift for shift in shifts) + value = sum(set(1 << (flag.bit_length() - 1) for flag in cls.VALID_FLAGS.values())) self = cls.__new__(cls) self.value = value From e403a45ede05b9f4e7febc2bb29f352b810ec5e1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 16:01:59 +0000 Subject: [PATCH 7/7] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/flags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/flags.py b/discord/flags.py index ec41c9c48f..9f687ff9bc 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -636,7 +636,7 @@ def __init__(self, **kwargs: bool): @classmethod def all(cls: type[Intents]) -> Intents: """A factory method that creates a :class:`Intents` with everything enabled.""" - value = sum(set(1 << (flag.bit_length() - 1) for flag in cls.VALID_FLAGS.values())) + value = sum({1 << (flag.bit_length() - 1) for flag in cls.VALID_FLAGS.values()}) self = cls.__new__(cls) self.value = value