aboutsummaryrefslogtreecommitdiff
path: root/discord/abc.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-04-18 19:05:34 -0400
committerRapptz <[email protected]>2017-04-18 19:05:34 -0400
commitf9c2ac9d25fe65a99bf92b60002920b20fe55c1d (patch)
tree21d922c8ff36e8e7e2b8e066cef9c3868fe11502 /discord/abc.py
parentFix FFmpegPCMAudio not working with spaces in filename. (diff)
downloaddiscord.py-f9c2ac9d25fe65a99bf92b60002920b20fe55c1d.tar.xz
discord.py-f9c2ac9d25fe65a99bf92b60002920b20fe55c1d.zip
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.
Diffstat (limited to 'discord/abc.py')
-rw-r--r--discord/abc.py7
1 files changed, 3 insertions, 4 deletions
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