Skip to content

Commit c2aff9c

Browse files
Readeempre-commit-ci[bot]JustaSqu1dLulalabyplun1331
authored
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 7f2beb7 commit c2aff9c

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
@@ -32,6 +32,19 @@ These changes are available on the `master` branch, but have not yet been releas
3232
- Fixed `EntitlementIterator` behavior with `limit > 100`.
3333
([#2555](https://github.com/Pycord-Development/pycord/pull/2555))
3434

35+
### Fixed
36+
37+
- Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside
38+
`@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
39+
- Fixed the typehint in `ConnectionState._polls` to reflect actual behavior, changing it
40+
from `Guild` to `Poll`.
41+
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
42+
- Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and
43+
`RawMessagePollVoteEvent`.
44+
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
45+
- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to
46+
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
47+
3548
## [2.6.0] - 2024-07-09
3649

3750
### 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
@@ -2592,35 +2592,6 @@ def bulk_upsert_guild_commands(
25922592
)
25932593
return self.request(r, json=payload)
25942594

2595-
# Application commands (permissions)
2596-
2597-
def get_command_permissions(
2598-
self,
2599-
application_id: Snowflake,
2600-
guild_id: Snowflake,
2601-
command_id: Snowflake,
2602-
) -> Response[interactions.GuildApplicationCommandPermissions]:
2603-
r = Route(
2604-
"GET",
2605-
"/applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions",
2606-
application_id=application_id,
2607-
guild_id=guild_id,
2608-
)
2609-
return self.request(r)
2610-
2611-
def get_guild_command_permissions(
2612-
self,
2613-
application_id: Snowflake,
2614-
guild_id: Snowflake,
2615-
) -> Response[list[interactions.GuildApplicationCommandPermissions]]:
2616-
r = Route(
2617-
"GET",
2618-
"/applications/{application_id}/guilds/{guild_id}/commands/permissions",
2619-
application_id=application_id,
2620-
guild_id=guild_id,
2621-
)
2622-
return self.request(r)
2623-
26242595
# Guild Automod Rules
26252596

26262597
def get_auto_moderation_rules(
@@ -2858,6 +2829,8 @@ def delete_followup_message(
28582829
)
28592830
return self.request(r)
28602831

2832+
# Application commands (permissions)
2833+
28612834
def get_guild_application_command_permissions(
28622835
self,
28632836
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)