diff options
| author | cookkkie <[email protected]> | 2017-03-13 01:24:27 +0100 |
|---|---|---|
| committer | cookkkie <[email protected]> | 2017-03-13 01:24:27 +0100 |
| commit | 38ea40f403812dd3aa8164ea2e8ecdef2587d537 (patch) | |
| tree | 84d68dc489ca506b519a0ebfd716b95c18dd4571 | |
| parent | Version bump to v0.16.7 (diff) | |
| download | discord.py-38ea40f403812dd3aa8164ea2e8ecdef2587d537.tar.xz discord.py-38ea40f403812dd3aa8164ea2e8ecdef2587d537.zip | |
Add rollback strategy to Client.join_voice_channel
| -rw-r--r-- | discord/client.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/client.py b/discord/client.py index c7c7f08a..c9b051b1 100644 --- a/discord/client.py +++ b/discord/client.py @@ -3181,8 +3181,13 @@ class Client: # request joining yield from self.ws.voice_state(server.id, channel.id) - session_id_data = yield from asyncio.wait_for(session_id_future, timeout=10.0, loop=self.loop) - data = yield from asyncio.wait_for(voice_data_future, timeout=10.0, loop=self.loop) + + try: + session_id_data = yield from asyncio.wait_for(session_id_future, timeout=10.0, loop=self.loop) + data = yield from asyncio.wait_for(voice_data_future, timeout=10.0, loop=self.loop) + except asyncio.TimeoutError: + yield from self.ws.voice_state(server.id, None, self_mute=True) + return None kwargs = { 'user': self.user, |