Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/Discord/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,39 @@ protected function ready()
}
}

/**
* Updates the client's voice state in a guild.
*
* @param Guild|string $guild_id ID of the guild.
* @param Channel|string|null $channel_id ID of the voice channel to join, or null to disconnect.
* @param bool $self_mute Whether the client is muted.
* @param bool $self_deaf Whether the client is deafened.
*
* @since 10.19.0
*/
public function updateVoiceState($guild_id, $channel_id = null, bool $self_mute = false, bool $self_deaf = false): void
{
if (! is_string($guild_id)) {
$guild_id = $guild_id->id;
}

if (isset($channel_id) && ! is_string($channel_id)) {
$channel_id = $channel_id->id;
}

$payload = Payload::new(
Op::OP_UPDATE_VOICE_STATE,
[
'guild_id' => $guild_id,
'channel_id' => $channel_id,
'self_mute' => $self_mute,
'self_deaf' => $self_deaf,
]
);

$this->send($payload);
}

/**
* Updates the clients presence.
*
Expand Down Expand Up @@ -1287,7 +1320,7 @@ public function updatePresence(?Activity $activity = null, bool $idle = false, s
}

$payload = Payload::new(
Op::OP_PRESENCE_UPDATE,
Op::OP_UPDATE_PRESENCE,
[
'since' => $idle,
'activities' => [$activity],
Expand Down