commit
dd0b83333c
3 changed files with 30 additions and 0 deletions
13
restapi.go
13
restapi.go
|
@ -665,6 +665,19 @@ func (s *Session) GuildMemberMove(guildID, userID, channelID string) (err error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GuildMemberNickname updates the nickname of a guild member
|
||||||
|
// guildID : The ID of a guild
|
||||||
|
// userID : The ID of a user
|
||||||
|
func (s *Session) GuildMemberNickname(guildID, userID, nickname string) (err error) {
|
||||||
|
|
||||||
|
data := struct {
|
||||||
|
Nick string `json:"nick"`
|
||||||
|
}{nickname}
|
||||||
|
|
||||||
|
_, err = s.Request("PATCH", GUILD_MEMBER(guildID, userID), data)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GuildChannels returns an array of Channel structures for all channels of a
|
// GuildChannels returns an array of Channel structures for all channels of a
|
||||||
// given guild.
|
// given guild.
|
||||||
// guildID : The ID of a Guild.
|
// guildID : The ID of a Guild.
|
||||||
|
|
|
@ -186,6 +186,22 @@ func TestGuildRoles(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGuildMemberNickname(t *testing.T) {
|
||||||
|
|
||||||
|
if envGuild == "" {
|
||||||
|
t.Skip("Skipping, DG_GUILD not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if dg == nil {
|
||||||
|
t.Skip("Skipping, dg not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := dg.GuildMemberNickname(envGuild, "@me/nick", "testnickname")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("GuildNickname returned error: %+v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestChannelMessageSend2 tests the ChannelMessageSend() function. This should not return an error.
|
// TestChannelMessageSend2 tests the ChannelMessageSend() function. This should not return an error.
|
||||||
func TestChannelMessageSend2(t *testing.T) {
|
func TestChannelMessageSend2(t *testing.T) {
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,7 @@ type Game struct {
|
||||||
type Member struct {
|
type Member struct {
|
||||||
GuildID string `json:"guild_id"`
|
GuildID string `json:"guild_id"`
|
||||||
JoinedAt string `json:"joined_at"`
|
JoinedAt string `json:"joined_at"`
|
||||||
|
Nick string `json:"nick"`
|
||||||
Deaf bool `json:"deaf"`
|
Deaf bool `json:"deaf"`
|
||||||
Mute bool `json:"mute"`
|
Mute bool `json:"mute"`
|
||||||
User *User `json:"user"`
|
User *User `json:"user"`
|
||||||
|
|
Loading…
Reference in a new issue