Browse Source

Fix more issues relating to previous upstream pull

pull/10109/head
dolfies 2 years ago
parent
commit
72132efb78
  1. 1
      discord/channel.py
  2. 11
      discord/components.py
  3. 1
      discord/flags.py
  4. 7
      discord/gateway.py

1
discord/channel.py

@ -190,6 +190,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
def __init__(self, *, state: ConnectionState, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]): def __init__(self, *, state: ConnectionState, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]):
self._state: ConnectionState = state self._state: ConnectionState = state
self.id: int = int(data['id']) self.id: int = int(data['id'])
self._type: Literal[0, 5] = data['type']
self._update(guild, data) self._update(guild, data)
def __repr__(self) -> str: def __repr__(self) -> str:

11
discord/components.py

@ -449,7 +449,16 @@ class TextInput(Component):
'max_length', 'max_length',
) )
__repr_info__: ClassVar[Tuple[str, ...]] = __slots__ __repr_info__: ClassVar[Tuple[str, ...]] = (
'style',
'label',
'custom_id',
'placeholder',
'required',
'min_length',
'max_length',
'default',
)
def __init__(self, data: TextInputPayload, *args) -> None: def __init__(self, data: TextInputPayload, *args) -> None:
self.style: TextStyle = try_enum(TextStyle, data['style']) self.style: TextStyle = try_enum(TextStyle, data['style'])

1
discord/flags.py

@ -1938,6 +1938,7 @@ class ApplicationDiscoveryFlags(BaseFlags):
return 1 << 16 return 1 << 16
@fill_with_flags()
class FriendSourceFlags(BaseFlags): class FriendSourceFlags(BaseFlags):
r"""Wraps up the Discord friend source flags. r"""Wraps up the Discord friend source flags.

7
discord/gateway.py

@ -575,16 +575,15 @@ class DiscordWebSocket:
return return
if event == 'READY': if event == 'READY':
self._trace = trace = data.get('_trace', []) self._trace = data.get('_trace', [])
self.sequence = msg['s'] self.sequence = msg['s']
self.session_id = data['session_id'] self.session_id = data['session_id']
self.gateway = yarl.URL(data['resume_gateway_url']) self.gateway = yarl.URL(data['resume_gateway_url'])
_log.info('Connected to Gateway: %s (Session ID: %s).', ', '.join(trace), self.session_id) _log.info('Connected to Gateway (Session ID: %s).', self.session_id)
await self.voice_state() # Initial OP 4 await self.voice_state() # Initial OP 4
elif event == 'RESUMED': elif event == 'RESUMED':
self._trace = trace = data.get('_trace', []) _log.info('Gateway has successfully RESUMED session %s.', self.session_id)
_log.info('Gateway has successfully RESUMED session %s under trace %s.', self.session_id, ', '.join(trace))
try: try:
func = self._discord_parsers[event] func = self._discord_parsers[event]

Loading…
Cancel
Save