Skip to content

Commit

Permalink
Fix call ringing
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Dec 4, 2024
1 parent a58b80c commit 6a0b972
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 10 additions & 10 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3593,13 +3593,15 @@ async def _get_channel(self) -> Self:
return self

async def _initial_ring(self) -> None:
ring = self.recipient.is_friend()
if not ring:
data = await self._state.http.get_ringability(self.id)
ring = data['ringable']
call = self.call
if not call or (call.connected and len(call.voice_states) == 1):
ring = self.recipient.is_friend()
if not ring:
data = await self._state.http.get_ringability(self.id)
ring = data['ringable']

if ring:
await self._state.http.ring(self.id)
if ring:
await self._state.http.ring(self.id)

def __str__(self) -> str:
if self.recipient:
Expand Down Expand Up @@ -3900,8 +3902,7 @@ async def connect(
await self._get_channel()
ret = await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)

call = self.call
if call is None and ring:
if ring:
await self._initial_ring()
return ret

Expand Down Expand Up @@ -4473,8 +4474,7 @@ async def connect(
await self._get_channel()
ret = await super().connect(timeout=timeout, reconnect=reconnect, cls=cls)

call = self.call
if call is None and ring:
if ring:
await self._initial_ring()
return ret

Expand Down
3 changes: 1 addition & 2 deletions discord/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,7 @@ async def connect(
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:
if ring:
await channel._initial_ring()
return ret

Expand Down

0 comments on commit 6a0b972

Please sign in to comment.