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

Payload for member edit #1122

Merged
merged 10 commits into from Apr 4, 2022
9 changes: 9 additions & 0 deletions restapi.go
Expand Up @@ -710,6 +710,15 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e
return
}

// GuildMemberEditComplex edits the roles & nickname of a member.
FedorLap2006 marked this conversation as resolved.
Show resolved Hide resolved
// guildID : The ID of a Guild.
// userID : The ID of a User.
// data : Struct of GuildMemberEditData
func (s *Session) GuildMemberEditComplex(guildID, userID string, data *GuildMemberEditData) (err error) {
FedorLap2006 marked this conversation as resolved.
Show resolved Hide resolved
_, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
return
}

// GuildMemberMove moves a guild member from one voice channel to another/none
// guildID : The ID of a Guild.
// userID : The ID of a User.
Expand Down
11 changes: 11 additions & 0 deletions structs.go
Expand Up @@ -1566,6 +1566,17 @@ type UserGuildSettingsEdit struct {
ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"`
}

// A GuildMemberEditData stores a payload to use in Session.GuildMemberEditComplex
FedorLap2006 marked this conversation as resolved.
Show resolved Hide resolved
// https://discord.com/developers/docs/resources/guild#modify-guild-member
type GuildMemberEditData struct {
FedorLap2006 marked this conversation as resolved.
Show resolved Hide resolved

// Value to set user's nickname to
Nick string `json:"nick,omitempty"`

// Array of role ids the member is assigned
Roles *[]string `json:"roles,omitempty"`
}

// An APIErrorMessage is an api error message returned from discord
type APIErrorMessage struct {
Code int `json:"code"`
Expand Down