@@ -1255,6 +1255,39 @@ protected function ready()
12551255 }
12561256 }
12571257
1258+ /**
1259+ * Updates the client's voice state in a guild.
1260+ *
1261+ * @param Guild|string $guild_id ID of the guild.
1262+ * @param Channel|string|null $channel_id ID of the voice channel to join, or null to disconnect.
1263+ * @param bool $self_mute Whether the client is muted.
1264+ * @param bool $self_deaf Whether the client is deafened.
1265+ *
1266+ * @since 10.19.0
1267+ */
1268+ public function updateVoiceState ($ guild_id , $ channel_id = null , bool $ self_mute = false , bool $ self_deaf = false ): void
1269+ {
1270+ if (! is_string ($ guild_id )) {
1271+ $ guild_id = $ guild_id ->id ;
1272+ }
1273+
1274+ if (isset ($ channel_id ) && ! is_string ($ channel_id )) {
1275+ $ channel_id = $ channel_id ->id ;
1276+ }
1277+
1278+ $ payload = Payload::new (
1279+ Op::OP_UPDATE_VOICE_STATE ,
1280+ [
1281+ 'guild_id ' => $ guild_id ,
1282+ 'channel_id ' => $ channel_id ,
1283+ 'self_mute ' => $ self_mute ,
1284+ 'self_deaf ' => $ self_deaf ,
1285+ ]
1286+ );
1287+
1288+ $ this ->send ($ payload );
1289+ }
1290+
12581291 /**
12591292 * Updates the clients presence.
12601293 *
@@ -1287,7 +1320,7 @@ public function updatePresence(?Activity $activity = null, bool $idle = false, s
12871320 }
12881321
12891322 $ payload = Payload::new (
1290- Op::OP_PRESENCE_UPDATE ,
1323+ Op::OP_UPDATE_PRESENCE ,
12911324 [
12921325 'since ' => $ idle ,
12931326 'activities ' => [$ activity ],
0 commit comments