mirror of
https://github.com/bwmarrin/discordgo.git
synced 2025-12-23 23:17:45 -05:00
feat(restapi): Add support for voice state API endpoints (#1671)
This commit is contained in:
@@ -121,6 +121,9 @@ var (
|
||||
EndpointGuildMemberBannerAnimated = func(gId, uID, hash string) string {
|
||||
return EndpointCDNGuilds + gId + "/users/" + uID + "/banners/" + hash + ".gif"
|
||||
}
|
||||
EndpointGuildMemberVoiceState = func(gID, uID string) string {
|
||||
return EndpointGuild(gID) + "/voice-states/" + uID
|
||||
}
|
||||
|
||||
EndpointRoleIcon = func(rID, hash string) string {
|
||||
return EndpointCDNRoleIcons + rID + "/" + hash + ".png"
|
||||
|
||||
16
restapi.go
16
restapi.go
@@ -3745,3 +3745,19 @@ func (s *Session) Subscription(skuID, subscriptionID, userID string, options ...
|
||||
err = unmarshal(body, &subscription)
|
||||
return
|
||||
}
|
||||
|
||||
// UserVoiceState returns the voice state of the current user (the bot) in a guild.
|
||||
// guildID : The ID of the guild.
|
||||
// userID : The ID of the user.
|
||||
// Note: Using @me will return the bot's voice state for the given guild.
|
||||
func (s *Session) UserVoiceState(guildID string, userID string, options ...RequestOption) (state *VoiceState, err error) {
|
||||
endpoint := EndpointGuildMemberVoiceState(guildID, userID)
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", endpoint, nil, endpoint, options...)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &state)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2882,6 +2882,7 @@ const (
|
||||
ErrCodeUnknownSticker = 10060
|
||||
ErrCodeUnknownInteraction = 10062
|
||||
ErrCodeUnknownApplicationCommand = 10063
|
||||
ErrCodeUnknownVoiceState = 10065
|
||||
ErrCodeUnknownApplicationCommandPermissions = 10066
|
||||
ErrCodeUnknownStageInstance = 10067
|
||||
ErrCodeUnknownGuildMemberVerificationForm = 10068
|
||||
|
||||
Reference in New Issue
Block a user