aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-04-18 02:29:43 -0400
committerRapptz <[email protected]>2017-04-18 03:49:48 -0400
commit3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07 (patch)
treedcaac87b10f4d2a2bdf82f260a5738c1367f425f /discord/channel.py
parentDon't clear state when READY is reached for auto sharded clients. (diff)
downloaddiscord.py-3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07.tar.xz
discord.py-3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07.zip
Re-implement voice sending.
This is a complete redesign of the old voice code. A list of major changes is as follows: * The voice websocket will now automatically reconnect with exponential back-off just like the regular Client does. * Removal of the stream player concept. * Audio now gracefully pauses and resumes when a disconnect is found. * Introduce a discord.AudioSource concept to abstract streams * Flatten previous stream player functionality with the VoiceClient, e.g. player.stop() is now voice_client.stop() * With the above re-coupling this means you no longer have to store players anywhere. * The after function now requires a single parameter, the error, if any existed. This will typically be None. A lot of this design is experimental.
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 67259f44..6478c47b 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -290,7 +290,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
count += 1
ret.append(msg)
-class VoiceChannel(discord.abc.GuildChannel, Hashable):
+class VoiceChannel(discord.abc.Callable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild voice channel.
Supported Operations:
@@ -335,6 +335,12 @@ class VoiceChannel(discord.abc.GuildChannel, Hashable):
def __repr__(self):
return '<VoiceChannel id={0.id} name={0.name!r} position={0.position}>'.format(self)
+ def _get_voice_client_key(self):
+ return self.guild.id, 'guild_id'
+
+ def _get_voice_state_pair(self):
+ return self.guild.id, self.id
+
def _update(self, guild, data):
self.guild = guild
self.name = data['name']