mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 08:17:47 +00:00
Add VoiceClient.move_to for quick switching of voice channels.
This commit is contained in:
parent
132873d159
commit
339e26275f
@ -227,6 +227,32 @@ class VoiceClient:
|
||||
yield from self.ws.close()
|
||||
yield from self.main_ws.voice_state(self.guild_id, None, self_mute=True)
|
||||
|
||||
@asyncio.coroutine
|
||||
def move_to(self, channel):
|
||||
"""|coro|
|
||||
|
||||
Moves you to a different voice channel.
|
||||
|
||||
.. warning::
|
||||
|
||||
:class:`Object` instances do not work with this function.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
channel : :class:`Channel`
|
||||
The channel to move to. Must be a voice channel.
|
||||
|
||||
Raises
|
||||
-------
|
||||
InvalidArgument
|
||||
Not a voice channel.
|
||||
"""
|
||||
|
||||
if str(getattr(channel, 'type', 'text')) != 'voice':
|
||||
raise InvalidArgument('Must be a voice channel.')
|
||||
|
||||
yield from self.main_ws.voice_state(self.guild_id, channel.id)
|
||||
|
||||
def is_connected(self):
|
||||
"""bool : Indicates if the voice client is connected to voice."""
|
||||
return self._connected.is_set()
|
||||
|
Loading…
x
Reference in New Issue
Block a user