From a963ea46f1dbda447eebd58b8a8ee7569ff4344e Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Fri, 15 May 2020 19:29:04 +0200 Subject: [PATCH 1/2] API: fix missing doc --- api/user.go | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/api/user.go b/api/user.go index 9b88bd3..93dbe8a 100644 --- a/api/user.go +++ b/api/user.go @@ -40,6 +40,25 @@ func (c *Client) ModifyMe(data ModifySelfData) (*discord.User, error) { return u, c.RequestJSON(&u, "PATCH", EndpointMe, httputil.WithJSONBody(data)) } +// ChangeOwnNickname modifies the nickname of the current user in a guild. +// +// Fires a Guild Member Update Gateway event. +func (c *Client) ChangeOwnNickname( + guildID discord.Snowflake, nick string) error { + + var param struct { + Nick string `json:"nick"` + } + + param.Nick = nick + + return c.FastRequest( + "PATCH", + EndpointGuilds+guildID.String()+"/members/@me/nick", + httputil.WithJSONBody(param), + ) +} + // PrivateChannels returns a list of DM channel objects. For bots, this is no // longer a supported method of getting recent DMs, and will return an empty // array. @@ -60,24 +79,6 @@ func (c *Client) CreatePrivateChannel(recipientID discord.Snowflake) (*discord.C return dm, c.RequestJSON(&dm, "POST", EndpointMe+"/channels", httputil.WithJSONBody(param)) } -// ChangeOwnNickname only replies with the nickname back, so we're not even -// going to bother. -func (c *Client) ChangeOwnNickname( - guildID discord.Snowflake, nick string) error { - - var param struct { - Nick string `json:"nick"` - } - - param.Nick = nick - - return c.FastRequest( - "PATCH", - EndpointGuilds+guildID.String()+"/members/@me/nick", - httputil.WithJSONBody(param), - ) -} - // shitty SDK, don't care, PR welcomed // func (c *Client) CreateGroup(tokens []string, nicks map[]) From 4eef15ec7d5be5a1172f755c4d6bde5f83ce5f77 Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Fri, 15 May 2020 19:31:23 +0200 Subject: [PATCH 2/2] API: add UserConnections method (#55) --- api/user.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/user.go b/api/user.go index 93dbe8a..fa1ebcc 100644 --- a/api/user.go +++ b/api/user.go @@ -82,4 +82,9 @@ func (c *Client) CreatePrivateChannel(recipientID discord.Snowflake) (*discord.C // shitty SDK, don't care, PR welcomed // func (c *Client) CreateGroup(tokens []string, nicks map[]) -// func (c *Client) UserConnections() ([]discord.Connection, error) {} +// UserConnections returns a list of connection objects. Requires the +// connections OAuth2 scope. +func (c *Client) UserConnections() ([]discord.Connection, error) { + var conn []discord.Connection + return conn, c.RequestJSON(&conn, "GET", EndpointMe+"/connections") +}