From f9c2ac9d25fe65a99bf92b60002920b20fe55c1d Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 18 Apr 2017 19:05:34 -0400 Subject: Better handling of VOICE_SERVER_UPDATE. This now sort of respects "Awaiting Endpoint..." waiting. I haven't actually tested out this case since it's hard to get it. However this new code does work with the regular connection flow. --- discord/abc.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'discord/abc.py') diff --git a/discord/abc.py b/discord/abc.py index 07d72093..863d6d76 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -796,7 +796,7 @@ class Callable(metaclass=abc.ABCMeta): raise NotImplementedError @asyncio.coroutine - def connect(self, *, timeout=10.0, reconnect=True): + def connect(self, *, timeout=60.0, reconnect=True): """|coro| Connects to voice and creates a :class:`VoiceClient` to establish @@ -805,8 +805,7 @@ class Callable(metaclass=abc.ABCMeta): Parameters ----------- timeout: float - The timeout in seconds to wait for the - initial handshake to be completed. + The timeout in seconds to wait for the voice endpoint. reconnect: bool Whether the bot should automatically attempt a reconnect if a part of the handshake fails @@ -833,6 +832,7 @@ class Callable(metaclass=abc.ABCMeta): raise ClientException('Already connected to a voice channel.') voice = VoiceClient(state=state, timeout=timeout, channel=self) + state._add_voice_client(key_id, voice) try: yield from voice.connect(reconnect=reconnect) @@ -844,5 +844,4 @@ class Callable(metaclass=abc.ABCMeta): pass raise e # re-raise - state._add_voice_client(key_id, voice) return voice -- cgit v1.2.3