Browse Source

Fix calls

pull/10109/head
dolfies 6 months ago
parent
commit
e116918d7b
  1. 8
      discord/channel.py
  2. 4
      discord/message.py
  3. 2
      discord/types/voice.py
  4. 4
      discord/user.py
  5. 2
      discord/voice_state.py

8
discord/channel.py

@ -3898,10 +3898,12 @@ class DMChannel(discord.abc.Messageable, discord.abc.Connectable, discord.abc.Pr
A voice client that is fully connected to the voice server.
"""
await self._get_channel()
ret = await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)
call = self.call
if call is None and ring:
await self._initial_ring()
return await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)
return ret
async def accept(self) -> DMChannel:
"""|coro|
@ -4469,10 +4471,12 @@ class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, discord.abc
ring: bool = True,
) -> T:
await self._get_channel()
ret = await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)
call = self.call
if call is None and ring:
await self._initial_ring()
return await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)
return ret
class PartialMessageable(discord.abc.Messageable, Hashable):

4
discord/message.py

@ -47,8 +47,6 @@ from typing import (
overload,
)
from discord.types.components import MessageActionRow
from . import utils
from .reaction import Reaction
from .emoji import Emoji
@ -563,7 +561,7 @@ class MessageSnapshot(Hashable):
self.flags: MessageFlags = MessageFlags._from_value(data.get('flags', 0))
self.stickers: List[StickerItem] = [StickerItem(data=d, state=state) for d in data.get('sticker_items', [])]
self.components: List[MessageActionRow] = []
self.components: List[ComponentPayload] = []
for component_data in data.get('components', []):
component = _component_factory(component_data)
if component is not None:

2
discord/types/voice.py

@ -76,7 +76,7 @@ class VoiceRegion(TypedDict):
class VoiceServerUpdate(TypedDict):
token: str
guild_id: NotRequired[Snowflake]
guild_id: Optional[Snowflake]
channel_id: Snowflake
endpoint: Optional[str]

4
discord/user.py

@ -1142,10 +1142,12 @@ class User(BaseUser, discord.abc.Connectable, discord.abc.Messageable):
ring: bool = True,
) -> ConnectReturn:
channel = await self._get_channel()
ret = await super().connect(timeout=timeout, reconnect=reconnect, cls=cls, _channel=channel)
call = channel.call
if call is None and ring:
await channel._initial_ring()
return await super().connect(timeout=timeout, reconnect=reconnect, cls=cls, _channel=channel)
return ret
async def create_dm(self) -> DMChannel:
"""|coro|

2
discord/voice_state.py

@ -312,7 +312,7 @@ class VoiceConnectionState:
previous_endpoint = self.endpoint
self.token = data['token']
self.server_id = int(data.get('guild_id', data['channel_id']))
self.server_id = int(data.get('guild_id') or data['channel_id'])
endpoint = data.get('endpoint')
if self.token is None or endpoint is None:

Loading…
Cancel
Save