1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-29 02:03:35 +00:00

Merge pull request #67 from mavolin/55-user-connections

This commit is contained in:
diamondburned 2020-05-15 10:50:11 -07:00 committed by GitHub
commit 65641652c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,6 +40,25 @@ func (c *Client) ModifyMe(data ModifySelfData) (*discord.User, error) {
return u, c.RequestJSON(&u, "PATCH", EndpointMe, httputil.WithJSONBody(data)) 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 // 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 // longer a supported method of getting recent DMs, and will return an empty
// array. // array.
@ -60,22 +79,9 @@ func (c *Client) CreatePrivateChannel(recipientID discord.Snowflake) (*discord.C
return dm, c.RequestJSON(&dm, "POST", EndpointMe+"/channels", httputil.WithJSONBody(param)) return dm, c.RequestJSON(&dm, "POST", EndpointMe+"/channels", httputil.WithJSONBody(param))
} }
// ChangeOwnNickname only replies with the nickname back, so we're not even // UserConnections returns a list of connection objects. Requires the
// going to bother. // connections OAuth2 scope.
func (c *Client) ChangeOwnNickname( func (c *Client) UserConnections() ([]discord.Connection, error) {
guildID discord.Snowflake, nick string) error { var conn []discord.Connection
return conn, c.RequestJSON(&conn, "GET", EndpointMe+"/connections")
var param struct { }
Nick string `json:"nick"`
}
param.Nick = nick
return c.FastRequest(
"PATCH",
EndpointGuilds+guildID.String()+"/members/@me/nick",
httputil.WithJSONBody(param),
)
}
// func (c *Client) UserConnections() ([]discord.Connection, error) {}