aboutsummaryrefslogtreecommitdiff
path: root/discord/voice_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/voice_client.py')
-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 e93b5180..51f8929b 100644
--- a/discord/voice_client.py
+++ b/discord/voice_client.py
@@ -134,14 +134,16 @@ class VoiceClient:
The endpoint we are connecting to.
channel : :class:`Channel`
The voice channel connected to.
+ loop
+ The event loop that the voice client is running on.
"""
- def __init__(self, user, connected, main_ws, session_id, channel, data, loop):
+ def __init__(self, user, main_ws, session_id, channel, data, loop):
self.user = user
- self._connected = connected
self.main_ws = main_ws
self.channel = channel
self.session_id = session_id
self.loop = loop
+ self._connected = asyncio.Event(loop=self.loop)
self.token = data.get('token')
self.guild_id = data.get('guild_id')
self.endpoint = data.get('endpoint')
@@ -296,6 +298,10 @@ class VoiceClient:
yield from self.main_ws.send(utils.to_json(payload))
+ def is_connected(self):
+ """bool : Indicates if the voice client is connected to voice."""
+ return self._connected.is_set()
+
# audio related
def _get_voice_packet(self, data):