aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-10 21:45:42 -0400
committerRapptz <[email protected]>2016-06-10 21:45:42 -0400
commitfe5c369fe9348b9d68aeab14949802fbd15ef46f (patch)
treea281aa2f0d9f967eed5d008e895c0755010d5d94
parent[commands] Fix @everyone elevation in the default help command. (diff)
downloaddiscord.py-fe5c369fe9348b9d68aeab14949802fbd15ef46f.tar.xz
discord.py-fe5c369fe9348b9d68aeab14949802fbd15ef46f.zip
Handle voice websocket closure if it's a successful close.
-rw-r--r--discord/voice_client.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py
index a49b3a35..6f62d4ef 100644
--- a/discord/voice_client.py
+++ b/discord/voice_client.py
@@ -57,7 +57,7 @@ log = logging.getLogger(__name__)
from . import utils, opus
from .gateway import *
-from .errors import ClientException, InvalidArgument
+from .errors import ClientException, InvalidArgument, ConnectionClosed
class StreamPlayer(threading.Thread):
def __init__(self, stream, encoder, connected, player, after, **kwargs):
@@ -233,7 +233,13 @@ class VoiceClient:
Reads from the voice websocket while connected.
"""
while self._connected.is_set():
- yield from self.ws.poll_event()
+ try:
+ yield from self.ws.poll_event()
+ except ConnectionClosed as e:
+ if e.code == 1000:
+ break
+ else:
+ raise
@asyncio.coroutine
def disconnect(self):