Skip to content

Commit 7585e01

Browse files
Readeempre-commit-ci[bot]JustaSqu1dLulalabyplun1331
authored andcommitted
fix: Missing slots attributes, wrong variable type, duplicate http methods (#2500)
* remove duplicates, fix unused parameter * polls state storage typehint fix * fix RawReactionClearEmojiEvent __slots__ * fix RawMessagePollVoteEvent __slots__ * fix ForumChannel.default_sort_order type the value were actually int instead of SortOrder enum * style(pre-commit): auto fixes from pre-commit.com hooks * changelog * style(pre-commit): auto fixes from pre-commit.com hooks * Update CHANGELOG.md Co-authored-by: JustaSqu1d <[email protected]> Signed-off-by: Readeem <[email protected]> * Update CHANGELOG.md Co-authored-by: JustaSqu1d <[email protected]> Signed-off-by: Readeem <[email protected]> * Update CHANGELOG.md Co-authored-by: JustaSqu1d <[email protected]> Signed-off-by: Readeem <[email protected]> * style(pre-commit): auto fixes from pre-commit.com hooks * style(pre-commit): auto fixes from pre-commit.com hooks * Apply suggestions from code review Signed-off-by: plun1331 <[email protected]> * style(pre-commit): auto fixes from pre-commit.com hooks --------- Signed-off-by: Readeem <[email protected]> Signed-off-by: Lala Sabathil <[email protected]> Signed-off-by: plun1331 <[email protected]> Co-authored-by: Readeem <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: JustaSqu1d <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: plun1331 <[email protected]>
1 parent 222830d commit 7585e01

File tree

6 files changed

+40
-32
lines changed

6 files changed

+40
-32
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ These changes are available on the `master` branch, but have not yet been releas
6464
- Fixed `EntitlementIterator` behavior with `limit > 100`.
6565
([#2555](https://github.com/Pycord-Development/pycord/pull/2555))
6666

67+
### Fixed
68+
69+
- Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside
70+
`@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
71+
- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it
72+
from `Guild` to `Poll`.
73+
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
74+
- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and
75+
`RawMessagePollVoteEvent`.
76+
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
77+
- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to
78+
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
79+
6780
## [2.6.0] - 2024-07-09
6881

6982
### Added

discord/channel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,9 @@ def _update(self, guild: Guild, data: ForumChannelPayload) -> None:
10361036
for tag in (data.get("available_tags") or [])
10371037
]
10381038
self.default_sort_order: SortOrder | None = data.get("default_sort_order", None)
1039+
if self.default_sort_order is not None:
1040+
self.default_sort_order = try_enum(SortOrder, self.default_sort_order)
1041+
10391042
reaction_emoji_ctx: dict = data.get("default_reaction_emoji")
10401043
if reaction_emoji_ctx is not None:
10411044
emoji_name = reaction_emoji_ctx.get("emoji_name")

discord/http.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,35 +2582,6 @@ def bulk_upsert_guild_commands(
25822582
)
25832583
return self.request(r, json=payload)
25842584

2585-
# Application commands (permissions)
2586-
2587-
def get_command_permissions(
2588-
self,
2589-
application_id: Snowflake,
2590-
guild_id: Snowflake,
2591-
command_id: Snowflake,
2592-
) -> Response[interactions.GuildApplicationCommandPermissions]:
2593-
r = Route(
2594-
"GET",
2595-
"/applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions",
2596-
application_id=application_id,
2597-
guild_id=guild_id,
2598-
)
2599-
return self.request(r)
2600-
2601-
def get_guild_command_permissions(
2602-
self,
2603-
application_id: Snowflake,
2604-
guild_id: Snowflake,
2605-
) -> Response[list[interactions.GuildApplicationCommandPermissions]]:
2606-
r = Route(
2607-
"GET",
2608-
"/applications/{application_id}/guilds/{guild_id}/commands/permissions",
2609-
application_id=application_id,
2610-
guild_id=guild_id,
2611-
)
2612-
return self.request(r)
2613-
26142585
# Guild Automod Rules
26152586

26162587
def get_auto_moderation_rules(
@@ -2848,6 +2819,8 @@ def delete_followup_message(
28482819
)
28492820
return self.request(r)
28502821

2822+
# Application commands (permissions)
2823+
28512824
def get_guild_application_command_permissions(
28522825
self,
28532826
application_id: Snowflake,

discord/raw_models.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,17 @@ class RawReactionClearEmojiEvent(_RawReprMixin):
327327
.. versionadded:: 2.5
328328
"""
329329

330-
__slots__ = ("message_id", "channel_id", "guild_id", "emoji", "burst", "data")
330+
__slots__ = (
331+
"message_id",
332+
"channel_id",
333+
"guild_id",
334+
"emoji",
335+
"burst",
336+
"data",
337+
"burst_colours",
338+
"burst_colors",
339+
"type",
340+
)
331341

332342
def __init__(self, data: ReactionClearEmojiEvent, emoji: PartialEmoji) -> None:
333343
self.emoji: PartialEmoji = emoji
@@ -807,7 +817,15 @@ class RawMessagePollVoteEvent(_RawReprMixin):
807817
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway#message-poll-vote-add>`
808818
"""
809819

810-
__slots__ = ("user_id", "message_id", "channel_id", "guild_id", "data", "added")
820+
__slots__ = (
821+
"user_id",
822+
"message_id",
823+
"answer_id",
824+
"channel_id",
825+
"guild_id",
826+
"data",
827+
"added",
828+
)
811829

812830
def __init__(self, data: MessagePollVoteEvent, added: bool) -> None:
813831
self.user_id: int = int(data["user_id"])

discord/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def clear(self, *, views: bool = True) -> None:
276276
self._emojis: dict[int, Emoji] = {}
277277
self._stickers: dict[int, GuildSticker] = {}
278278
self._guilds: dict[int, Guild] = {}
279-
self._polls: dict[int, Guild] = {}
279+
self._polls: dict[int, Poll] = {}
280280
if views:
281281
self._view_store: ViewStore = ViewStore(self)
282282
self._modal_store: ModalStore = ModalStore(self)

discord/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def decorated(*args: P.args, **kwargs: P.kwargs) -> T:
377377
since=since,
378378
removed=removed,
379379
reference=reference,
380+
stacklevel=stacklevel,
380381
)
381382
return func(*args, **kwargs)
382383

0 commit comments

Comments
 (0)