mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-26 02:53:07 +00:00 
			
		
		
		
	Handle voice websocket closure if it's a successful close.
This commit is contained in:
		| @@ -57,7 +57,7 @@ log = logging.getLogger(__name__) | |||||||
|  |  | ||||||
| from . import utils, opus | from . import utils, opus | ||||||
| from .gateway import * | from .gateway import * | ||||||
| from .errors import ClientException, InvalidArgument | from .errors import ClientException, InvalidArgument, ConnectionClosed | ||||||
|  |  | ||||||
| class StreamPlayer(threading.Thread): | class StreamPlayer(threading.Thread): | ||||||
|     def __init__(self, stream, encoder, connected, player, after, **kwargs): |     def __init__(self, stream, encoder, connected, player, after, **kwargs): | ||||||
| @@ -233,7 +233,13 @@ class VoiceClient: | |||||||
|         Reads from the voice websocket while connected. |         Reads from the voice websocket while connected. | ||||||
|         """ |         """ | ||||||
|         while self._connected.is_set(): |         while self._connected.is_set(): | ||||||
|  |             try: | ||||||
|                 yield from self.ws.poll_event() |                 yield from self.ws.poll_event() | ||||||
|  |             except ConnectionClosed as e: | ||||||
|  |                 if e.code == 1000: | ||||||
|  |                     break | ||||||
|  |                 else: | ||||||
|  |                     raise | ||||||
|  |  | ||||||
|     @asyncio.coroutine |     @asyncio.coroutine | ||||||
|     def disconnect(self): |     def disconnect(self): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user