From f2beeafc88744a6760e4e32440307ebb3d4365e7 Mon Sep 17 00:00:00 2001 From: Readeem Date: Wed, 10 Jul 2024 21:49:14 +0300 Subject: [PATCH 01/15] remove duplicates, fix unused parameter --- discord/http.py | 31 ++----------------------------- discord/utils.py | 1 + 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/discord/http.py b/discord/http.py index 8b3db319e7..efef85cfd9 100644 --- a/discord/http.py +++ b/discord/http.py @@ -2582,35 +2582,6 @@ def bulk_upsert_guild_commands( ) return self.request(r, json=payload) - # Application commands (permissions) - - def get_command_permissions( - self, - application_id: Snowflake, - guild_id: Snowflake, - command_id: Snowflake, - ) -> Response[interactions.GuildApplicationCommandPermissions]: - r = Route( - "GET", - "/applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions", - application_id=application_id, - guild_id=guild_id, - ) - return self.request(r) - - def get_guild_command_permissions( - self, - application_id: Snowflake, - guild_id: Snowflake, - ) -> Response[list[interactions.GuildApplicationCommandPermissions]]: - r = Route( - "GET", - "/applications/{application_id}/guilds/{guild_id}/commands/permissions", - application_id=application_id, - guild_id=guild_id, - ) - return self.request(r) - # Guild Automod Rules def get_auto_moderation_rules( @@ -2848,6 +2819,8 @@ def delete_followup_message( ) return self.request(r) + # Application commands (permissions) + def get_guild_application_command_permissions( self, application_id: Snowflake, diff --git a/discord/utils.py b/discord/utils.py index b95678a1c4..417fbc4f7e 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -377,6 +377,7 @@ def decorated(*args: P.args, **kwargs: P.kwargs) -> T: since=since, removed=removed, reference=reference, + stacklevel=stacklevel ) return func(*args, **kwargs) From 873a41e8427e3aa65be2429ed355c2723c2d97e8 Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:45:04 +0300 Subject: [PATCH 02/15] polls state storage typehint fix --- discord/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/state.py b/discord/state.py index c8d8d4dced..4170d33fef 100644 --- a/discord/state.py +++ b/discord/state.py @@ -276,7 +276,7 @@ def clear(self, *, views: bool = True) -> None: self._emojis: dict[int, Emoji] = {} self._stickers: dict[int, GuildSticker] = {} self._guilds: dict[int, Guild] = {} - self._polls: dict[int, Guild] = {} + self._polls: dict[int, Poll] = {} if views: self._view_store: ViewStore = ViewStore(self) self._modal_store: ModalStore = ModalStore(self) From aafcdf13803107aadec0bb89f21313439a15c19b Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:47:55 +0300 Subject: [PATCH 03/15] fix RawReactionClearEmojiEvent __slots__ --- discord/raw_models.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/discord/raw_models.py b/discord/raw_models.py index e59507dd48..8d23047474 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -327,7 +327,17 @@ class RawReactionClearEmojiEvent(_RawReprMixin): .. versionadded:: 2.5 """ - __slots__ = ("message_id", "channel_id", "guild_id", "emoji", "burst", "data") + __slots__ = ( + "message_id", + "channel_id", + "guild_id", + "emoji", + "burst", + "data", + "burst_colours", + "burst_colors", + "type" + ) def __init__(self, data: ReactionClearEmojiEvent, emoji: PartialEmoji) -> None: self.emoji: PartialEmoji = emoji From ac379ccdf822087d009917e50876ccc1646d084b Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:02:20 +0300 Subject: [PATCH 04/15] fix RawMessagePollVoteEvent __slots__ --- discord/raw_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/raw_models.py b/discord/raw_models.py index 8d23047474..e10674d17a 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -817,7 +817,7 @@ class RawMessagePollVoteEvent(_RawReprMixin): The raw data sent by the `gateway ` """ - __slots__ = ("user_id", "message_id", "channel_id", "guild_id", "data", "added") + __slots__ = ("user_id", "message_id", "answer_id", "channel_id", "guild_id", "data", "added") def __init__(self, data: MessagePollVoteEvent, added: bool) -> None: self.user_id: int = int(data["user_id"]) From bd4484e0a5a63b80a3c32ce0a613f2d829078c2d Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:15:29 +0300 Subject: [PATCH 05/15] fix ForumChannel.default_sort_order type the value were actually int instead of SortOrder enum --- discord/channel.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discord/channel.py b/discord/channel.py index 7608e1757d..27230a380f 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -1036,6 +1036,9 @@ def _update(self, guild: Guild, data: ForumChannelPayload) -> None: for tag in (data.get("available_tags") or []) ] self.default_sort_order: SortOrder | None = data.get("default_sort_order", None) + if self.default_sort_order is not None: + self.default_sort_order = try_enum(SortOrder, self.default_sort_order) + reaction_emoji_ctx: dict = data.get("default_reaction_emoji") if reaction_emoji_ctx is not None: emoji_name = reaction_emoji_ctx.get("emoji_name") From 7213c0a1a1a29a57cf294beb4ad967e73368fc88 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 22:26:36 +0000 Subject: [PATCH 06/15] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/raw_models.py | 12 ++++++++++-- discord/utils.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/discord/raw_models.py b/discord/raw_models.py index e10674d17a..a2881839a6 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -336,7 +336,7 @@ class RawReactionClearEmojiEvent(_RawReprMixin): "data", "burst_colours", "burst_colors", - "type" + "type", ) def __init__(self, data: ReactionClearEmojiEvent, emoji: PartialEmoji) -> None: @@ -817,7 +817,15 @@ class RawMessagePollVoteEvent(_RawReprMixin): The raw data sent by the `gateway ` """ - __slots__ = ("user_id", "message_id", "answer_id", "channel_id", "guild_id", "data", "added") + __slots__ = ( + "user_id", + "message_id", + "answer_id", + "channel_id", + "guild_id", + "data", + "added", + ) def __init__(self, data: MessagePollVoteEvent, added: bool) -> None: self.user_id: int = int(data["user_id"]) diff --git a/discord/utils.py b/discord/utils.py index 417fbc4f7e..9f01f53e71 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -377,7 +377,7 @@ def decorated(*args: P.args, **kwargs: P.kwargs) -> T: since=since, removed=removed, reference=reference, - stacklevel=stacklevel + stacklevel=stacklevel, ) return func(*args, **kwargs) From ce26f3640b8ebd8950a2d76c4f756a134b226037 Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:34:44 +0300 Subject: [PATCH 07/15] changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4712e2edbe..ecd59aa32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,16 @@ possible (see our [Version Guarantees] for more info). These changes are available on the `master` branch, but have not yet been released. +### Fixed +- Fixed missed `stacklevel` parameter in `warn_deprecated` function call inside `deprecated` decorator in utils. + ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed typehint in `ConnectionState._polls` incorrectly specified as `Guild` instead of `Poll`. + ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. + ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed `default_sort_order` variable type being `int` instead of typehinted `SortOrder` enum in `ForumChannel` class. + ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) + ## [2.6.0] - 2024-07-09 ### Added From 6d4b39f5c1e835b2f9c470bd3603fcb5a95e6070 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 08:37:44 +0000 Subject: [PATCH 08/15] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d53f70757..d05a962460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,13 +11,17 @@ possible (see our [Version Guarantees] for more info). These changes are available on the `master` branch, but have not yet been released. ### Fixed -- Fixed missed `stacklevel` parameter in `warn_deprecated` function call inside `deprecated` decorator in utils. - ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed typehint in `ConnectionState._polls` incorrectly specified as `Guild` instead of `Poll`. + +- Fixed missed `stacklevel` parameter in `warn_deprecated` function call inside + `deprecated` decorator in utils. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. +- Fixed typehint in `ConnectionState._polls` incorrectly specified as `Guild` instead of + `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and + `RawMessagePollVoteEvent` classes. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed `default_sort_order` variable type being `int` instead of typehinted `SortOrder` enum in `ForumChannel` class. +- Fixed `default_sort_order` variable type being `int` instead of typehinted `SortOrder` + enum in `ForumChannel` class. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) ### Changed From 3578b5eecddea8aa961a844cb3237f5f6cf1cc2f Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:35:28 +0300 Subject: [PATCH 09/15] Update CHANGELOG.md Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Readeem <99687127+Readeem@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d05a962460..d450abb42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed `default_sort_order` variable type being `int` instead of typehinted `SortOrder` +- Fixed the type of the `default_sort_order` attribute, changing it from `int` to `SortOrder`. enum in `ForumChannel` class. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) From cf1a103484480dad5b12315e17852344f2be3462 Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:35:37 +0300 Subject: [PATCH 10/15] Update CHANGELOG.md Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Readeem <99687127+Readeem@users.noreply.github.com> --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d450abb42a..b62a2f5f9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,8 @@ These changes are available on the `master` branch, but have not yet been releas ### Fixed -- Fixed missed `stacklevel` parameter in `warn_deprecated` function call inside - `deprecated` decorator in utils. +- Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside + `@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed typehint in `ConnectionState._polls` incorrectly specified as `Guild` instead of `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) From 83293e97a851127e44fd79ff9bfbe2d41ef68360 Mon Sep 17 00:00:00 2001 From: Readeem <99687127+Readeem@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:35:45 +0300 Subject: [PATCH 11/15] Update CHANGELOG.md Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Readeem <99687127+Readeem@users.noreply.github.com> --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b62a2f5f9d..85c7ea3770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,7 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside `@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed typehint in `ConnectionState._polls` incorrectly specified as `Guild` instead of - `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it from `Guild` to `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) From 3c8551c69b5960489daa72c7f28e3798f28be460 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:35:53 +0000 Subject: [PATCH 12/15] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c7ea3770..ae492c0f4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,8 +19,8 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed the type of the `default_sort_order` attribute, changing it from `int` to `SortOrder`. - enum in `ForumChannel` class. +- Fixed the type of the `default_sort_order` attribute, changing it from `int` to + `SortOrder`. enum in `ForumChannel` class. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) ### Changed From bd60cb5630cfeb93d34a7eb39a180fe9c962f1d4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:38:22 +0000 Subject: [PATCH 13/15] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae492c0f4c..37f2d6e360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,10 @@ These changes are available on the `master` branch, but have not yet been releas ### Fixed - Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside - `@utils.deprecated`. + `@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it + from `Guild` to `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it from `Guild` to `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent` classes. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) From d80f30b56810fd66317ef9be35313c925a12a064 Mon Sep 17 00:00:00 2001 From: plun1331 Date: Thu, 29 Aug 2024 11:34:52 -0700 Subject: [PATCH 14/15] Apply suggestions from code review Signed-off-by: plun1331 --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67166016a2..359bea1c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,10 +33,9 @@ These changes are available on the `master` branch, but have not yet been releas from `Guild` to `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and - `RawMessagePollVoteEvent` classes. + `RawMessagePollVoteEvent`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed the type of the `default_sort_order` attribute, changing it from `int` to - `SortOrder`. enum in `ForumChannel` class. +- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to `SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) ## [2.6.0] - 2024-07-09 From 9ab80d21e7f1c2839b982e066d739b1abec2308a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:35:18 +0000 Subject: [PATCH 15/15] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 359bea1c76..5a6e782881 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,8 +35,8 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to `SortOrder`. - ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to + `SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) ## [2.6.0] - 2024-07-09