aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjack1142 <[email protected]>2020-07-01 20:43:13 +0200
committerRapptz <[email protected]>2020-07-22 23:13:29 -0400
commit1ca257bb6808bb8bb934f58126f42867e5aa581e (patch)
treedaba10de878075c82628537ab48485ff41dbeb76
parentFix detection of some JPEG images without JFIF or Exif info (diff)
downloaddiscord.py-1ca257bb6808bb8bb934f58126f42867e5aa581e.tar.xz
discord.py-1ca257bb6808bb8bb934f58126f42867e5aa581e.zip
Add Guild.change_voice_state to control our voice state.
-rw-r--r--discord/guild.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 56b8462b..cc2d5fa0 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -2064,3 +2064,23 @@ class Guild(Hashable):
limit = limit or 5
return await self._state.query_members(self, query=query, limit=limit, user_ids=user_ids, cache=cache)
+
+ async def change_voice_state(self, *, channel, self_mute=False, self_deaf=False):
+ """|coro|
+
+ Changes client's voice state in the guild.
+
+ .. versionadded:: 1.4
+
+ Parameters
+ -----------
+ channel: Optional[:class:`VoiceChannel`]
+ Channel the client wants to join. Use ``None`` to disconnect.
+ self_mute: :class:`bool`
+ Indicates if the client should be self-muted.
+ self_deaf: :class:`bool`
+ Indicates if the client should be self-deafened.
+ """
+ ws = self._state._get_websocket(self.id)
+ channel_id = channel.id if channel else None
+ await ws.voice_state(self.id, channel_id, self_mute, self_deaf)