Skip to content

Commit 8e9d18d

Browse files
authored
Add get voice state endpoints (#375)
1 parent 8f3c66b commit 8e9d18d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

rest/members.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type Members interface {
2525

2626
UpdateCurrentMember(guildID snowflake.ID, nick string, opts ...RequestOpt) (*string, error)
2727

28+
GetCurrentUserVoiceState(guildID snowflake.ID, opts ...RequestOpt) (*discord.VoiceState, error)
29+
GetUserVoiceState(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (*discord.VoiceState, error)
2830
UpdateCurrentUserVoiceState(guildID snowflake.ID, currentUserVoiceStateUpdate discord.CurrentUserVoiceStateUpdate, opts ...RequestOpt) error
2931
UpdateUserVoiceState(guildID snowflake.ID, userID snowflake.ID, userVoiceStateUpdate discord.UserVoiceStateUpdate, opts ...RequestOpt) error
3032
}
@@ -105,6 +107,16 @@ func (s *memberImpl) UpdateCurrentMember(guildID snowflake.ID, nick string, opts
105107
return
106108
}
107109

110+
func (s *memberImpl) GetCurrentUserVoiceState(guildID snowflake.ID, opts ...RequestOpt) (state *discord.VoiceState, err error) {
111+
err = s.client.Do(GetCurrentUserVoiceState.Compile(nil, guildID), nil, &state, opts...)
112+
return
113+
}
114+
115+
func (s *memberImpl) GetUserVoiceState(guildID snowflake.ID, userID snowflake.ID, opts ...RequestOpt) (state *discord.VoiceState, err error) {
116+
err = s.client.Do(GetUserVoiceState.Compile(nil, guildID, userID), nil, &state, opts...)
117+
return
118+
}
119+
108120
func (s *memberImpl) UpdateCurrentUserVoiceState(guildID snowflake.ID, currentUserVoiceStateUpdate discord.CurrentUserVoiceStateUpdate, opts ...RequestOpt) error {
109121
return s.client.Do(UpdateCurrentUserVoiceState.Compile(nil, guildID), currentUserVoiceStateUpdate, nil, opts...)
110122
}

rest/rest_endpoints.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ var (
9393
GetGuildOnboarding = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/onboarding")
9494
UpdateGuildOnboarding = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/onboarding")
9595

96+
GetCurrentUserVoiceState = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/voice-states/@me")
97+
GetUserVoiceState = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/voice-states/{user.id}")
9698
UpdateCurrentUserVoiceState = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/@me")
9799
UpdateUserVoiceState = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/{user.id}")
98100
)

0 commit comments

Comments
 (0)