Skip to content

Commit 768db16

Browse files
authored
Add get_user_voice_state endpoint (#3394)
1 parent a1255e8 commit 768db16

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
@@ -4104,6 +4104,27 @@ impl Http {
41044104
.await
41054105
}
41064106

4107+
/// Get User Voice State
4108+
/// Returns the specified user's voice state in the guild.
4109+
pub async fn get_user_voice_state(
4110+
&self,
4111+
guild_id: GuildId,
4112+
user_id: UserId,
4113+
) -> Result<VoiceState> {
4114+
self.fire(Request {
4115+
body: None,
4116+
multipart: None,
4117+
headers: None,
4118+
method: LightMethod::Get,
4119+
route: Route::GuildVoiceStates {
4120+
guild_id,
4121+
user_id,
4122+
},
4123+
params: None
4124+
})
4125+
.await
4126+
}
4127+
41074128
/// Retrieves a webhook given its Id.
41084129
///
41094130
/// 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
@@ -1149,6 +1149,15 @@ impl GuildId {
11491149
MembersIter::stream(http, self)
11501150
}
11511151

1152+
/// Gets a user's voice state in this guild.
1153+
///
1154+
/// # Errors
1155+
///
1156+
/// Returns [`Error::Http`] if the user is not in a voice channel in this guild.
1157+
pub async fn get_user_voice_state(self, http: &Http, user_id: UserId) -> Result<VoiceState> {
1158+
http.get_user_voice_state(self, user_id).await
1159+
}
1160+
11521161
/// Moves a member to a specific voice channel.
11531162
///
11541163
/// **Note**: Requires the [Move Members] permission.

0 commit comments

Comments
 (0)