diff --git a/discord/__init__.py b/discord/__init__.py index c07aeb337..88b2719d7 100644 --- a/discord/__init__.py +++ b/discord/__init__.py @@ -19,7 +19,11 @@ __path__ = __import__('pkgutil').extend_path(__path__, __name__) import logging from typing import Literal, NamedTuple -from . import abc, opus, utils # type: ignore +from . import ( + abc as abc, + opus as opus, + utils as utils, +) from .activity import * from .appinfo import * from .asset import * diff --git a/discord/channel.py b/discord/channel.py index 877679e7f..f0c33d6fa 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2489,6 +2489,7 @@ class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable): self.id: int = int(data['id']) self.me: ClientUser = me self._update_group(data) + self._accessed: bool = False def _update_group(self, data: GroupChannelPayload) -> None: self.owner_id: Optional[int] = utils._get_as_snowflake(data, 'owner_id') @@ -2496,7 +2497,6 @@ class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable): self.name: Optional[str] = data.get('name') self.recipients: List[User] = [self._state.store_user(u) for u in data.get('recipients', [])] self.last_message_id: Optional[int] = utils._get_as_snowflake(data, 'last_message_id') - self._accessed: bool = False self.owner: Optional[BaseUser] if self.owner_id == self.me.id: diff --git a/discord/gateway.py b/discord/gateway.py index f4270db3b..a7ee1eb5c 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -431,9 +431,14 @@ class DiscordWebSocket: 'op': self.IDENTIFY, 'd': { 'token': self.token, - 'capabilities': 253, + 'capabilities': 509, 'properties': self._super_properties, - 'presence': {'status': 'online', 'since': 0, 'activities': [], 'afk': False}, + 'presence': { + 'status': 'online', + 'since': 0, + 'activities': [], + 'afk': False, + }, 'compress': False, 'client_state': { 'guild_hashes': {}, diff --git a/discord/state.py b/discord/state.py index 065e127cf..ac405f9c7 100644 --- a/discord/state.py +++ b/discord/state.py @@ -886,6 +886,9 @@ class ConnectionState: if 'sessions' in data: self.parse_sessions_replace(data['sessions']) + if 'auth_token' in data: + self.http._token(data['auth_token']) + # We're done del self._ready_data self.call_handlers('connect') diff --git a/discord/types/gateway.py b/discord/types/gateway.py index b424f54f8..f79912508 100644 --- a/discord/types/gateway.py +++ b/discord/types/gateway.py @@ -59,6 +59,7 @@ class ShardInfo(TypedDict): class ReadyEvent(TypedDict): analytics_token: str + auth_token: NotRequired[str] connected_accounts: List[dict] country_code: str friend_suggestion_count: int @@ -67,6 +68,7 @@ class ReadyEvent(TypedDict): merged_members: List[List[MemberWithUser]] private_channels: List[Union[DMChannel, GroupDMChannel]] relationships: List[dict] + required_action: NotRequired[str] sessions: List[dict] session_id: str user: User