Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace UpdateSelfNick with UpdateCurrentMember #199

Merged
merged 3 commits into from Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions discord/member.go
Expand Up @@ -83,7 +83,7 @@ type MemberUpdate struct {
CommunicationDisabledUntil *json.Nullable[time.Time] `json:"communication_disabled_until,omitempty"`
}

// SelfNickUpdate is used to update your own nick
type SelfNickUpdate struct {
Nick string `json:"nick"`
// CurrentMemberUpdate is used to update the current member
type CurrentMemberUpdate struct {
Nick *string `json:"nick"`
mlnrDev marked this conversation as resolved.
Show resolved Hide resolved
}
6 changes: 3 additions & 3 deletions rest/members.go
Expand Up @@ -22,7 +22,7 @@ type Members interface {
AddMemberRole(guildID snowflake.ID, userID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) error
RemoveMemberRole(guildID snowflake.ID, userID snowflake.ID, roleID snowflake.ID, opts ...RequestOpt) error

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

UpdateCurrentUserVoiceState(guildID snowflake.ID, currentUserVoiceStateUpdate discord.UserVoiceStateUpdate, opts ...RequestOpt) error
UpdateUserVoiceState(guildID snowflake.ID, userID snowflake.ID, userVoiceStateUpdate discord.UserVoiceStateUpdate, opts ...RequestOpt) error
Expand Down Expand Up @@ -95,8 +95,8 @@ func (s *memberImpl) RemoveMemberRole(guildID snowflake.ID, userID snowflake.ID,
return s.client.Do(RemoveMemberRole.Compile(nil, guildID, userID, roleID), nil, nil, opts...)
}

func (s *memberImpl) UpdateSelfNick(guildID snowflake.ID, nick string, opts ...RequestOpt) (nickName *string, err error) {
err = s.client.Do(UpdateSelfNick.Compile(nil, guildID), discord.SelfNickUpdate{Nick: nick}, nickName, opts...)
func (s *memberImpl) UpdateCurrentMember(guildID snowflake.ID, nick *string, opts ...RequestOpt) (nickName *string, err error) {
err = s.client.Do(UpdateCurrentMember.Compile(nil, guildID), discord.CurrentMemberUpdate{Nick: nick}, nickName, opts...)
return
}

Expand Down
2 changes: 1 addition & 1 deletion rest/rest_endpoints.go
Expand Up @@ -73,7 +73,7 @@ var (
AddMemberRole = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/members/{user.id}/roles/{role.id}")
RemoveMemberRole = NewEndpoint(http.MethodDelete, "/guilds/{guild.id}/members/{user.id}/roles/{role.id}")

UpdateSelfNick = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/members/@me/nick")
UpdateCurrentMember = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/members/@me")

GetPruneMembersCount = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/prune")
PruneMembers = NewEndpoint(http.MethodPost, "/guilds/{guild.id}/prune")
Expand Down