Skip to content

Commit 25b2820

Browse files
KiloOscarSixarqunis
authored andcommitted
Add get_user_voice_state endpoint (#3394)
1 parent 0d1bd28 commit 25b2820

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/http/client.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,6 +4524,27 @@ impl Http {
45244524
.await
45254525
}
45264526

4527+
/// Get User Voice State
4528+
/// Returns the specified user's voice state in the guild.
4529+
pub async fn get_user_voice_state(
4530+
&self,
4531+
guild_id: GuildId,
4532+
user_id: UserId,
4533+
) -> Result<VoiceState> {
4534+
self.fire(Request {
4535+
body: None,
4536+
multipart: None,
4537+
headers: None,
4538+
method: LightMethod::Get,
4539+
route: Route::GuildVoiceStates {
4540+
guild_id,
4541+
user_id,
4542+
},
4543+
params: None,
4544+
})
4545+
.await
4546+
}
4547+
45274548
/// Retrieves a webhook given its Id.
45284549
///
45294550
/// This method requires authentication, whereas [`Http::get_webhook_with_token`] and

src/model/guild/guild_id.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,15 @@ impl GuildId {
11941194
MembersIter::<H>::stream(http, self)
11951195
}
11961196

1197+
/// Gets a user's voice state in this guild.
1198+
///
1199+
/// # Errors
1200+
///
1201+
/// Returns [`Error::Http`] if the user is not in a voice channel in this guild.
1202+
pub async fn get_user_voice_state(self, http: &Http, user_id: UserId) -> Result<VoiceState> {
1203+
http.get_user_voice_state(self, user_id).await
1204+
}
1205+
11971206
/// Moves a member to a specific voice channel.
11981207
///
11991208
/// **Note**: Requires the [Move Members] permission.

0 commit comments

Comments
 (0)