mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-22 09:59:37 +00:00
Nitpicking function signature formatting
This commit is contained in:
parent
cd92feb03b
commit
966d14a32f
|
@ -8,7 +8,9 @@ import (
|
||||||
|
|
||||||
const EndpointChannels = Endpoint + "channels/"
|
const EndpointChannels = Endpoint + "channels/"
|
||||||
|
|
||||||
func (c *Client) Channels(guildID discord.Snowflake) ([]discord.Channel, error) {
|
func (c *Client) Channels(
|
||||||
|
guildID discord.Snowflake) ([]discord.Channel, error) {
|
||||||
|
|
||||||
var chs []discord.Channel
|
var chs []discord.Channel
|
||||||
return chs, c.RequestJSON(&chs, "GET",
|
return chs, c.RequestJSON(&chs, "GET",
|
||||||
EndpointGuilds+guildID.String()+"/channels")
|
EndpointGuilds+guildID.String()+"/channels")
|
||||||
|
@ -32,7 +34,8 @@ type CreateChannelData struct {
|
||||||
CategoryID discord.Snowflake `json:"parent_id,string,omitempty"`
|
CategoryID discord.Snowflake `json:"parent_id,string,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateChannel(guildID discord.Snowflake,
|
func (c *Client) CreateChannel(
|
||||||
|
guildID discord.Snowflake,
|
||||||
data CreateChannelData) (*discord.Channel, error) {
|
data CreateChannelData) (*discord.Channel, error) {
|
||||||
|
|
||||||
var ch *discord.Channel
|
var ch *discord.Channel
|
||||||
|
@ -106,8 +109,8 @@ func (c *Client) DeleteChannel(channelID discord.Snowflake) error {
|
||||||
return c.FastRequest("DELETE", EndpointChannels+channelID.String())
|
return c.FastRequest("DELETE", EndpointChannels+channelID.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) EditChannelPermission(channelID discord.Snowflake,
|
func (c *Client) EditChannelPermission(
|
||||||
overwrite discord.Overwrite) error {
|
channelID discord.Snowflake, overwrite discord.Overwrite) error {
|
||||||
|
|
||||||
url := EndpointChannels + channelID.String() + "/permissions/" +
|
url := EndpointChannels + channelID.String() + "/permissions/" +
|
||||||
overwrite.ID.String()
|
overwrite.ID.String()
|
||||||
|
@ -153,8 +156,8 @@ func (c *Client) UnpinMessage(channelID, messageID discord.Snowflake) error {
|
||||||
// AddRecipient adds a user to a group direct message. As accessToken is needed,
|
// AddRecipient adds a user to a group direct message. As accessToken is needed,
|
||||||
// clearly this endpoint should only be used for OAuth. AccessToken can be
|
// clearly this endpoint should only be used for OAuth. AccessToken can be
|
||||||
// obtained with the "gdm.join" scope.
|
// obtained with the "gdm.join" scope.
|
||||||
func (c *Client) AddRecipient(channelID, userID discord.Snowflake,
|
func (c *Client) AddRecipient(
|
||||||
accessToken, nickname string) error {
|
channelID, userID discord.Snowflake, accessToken, nickname string) error {
|
||||||
|
|
||||||
var params struct {
|
var params struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
|
|
21
api/guild.go
21
api/guild.go
|
@ -99,8 +99,8 @@ func (c *Client) Members(guildID discord.Snowflake) ([]discord.Member, error) {
|
||||||
|
|
||||||
// MembersAfter returns a list of all guild members, from 1-1000 for limits. The
|
// MembersAfter returns a list of all guild members, from 1-1000 for limits. The
|
||||||
// default limit is 1 and the maximum limit is 1000.
|
// default limit is 1 and the maximum limit is 1000.
|
||||||
func (c *Client) MembersAfter(guildID, after discord.Snowflake,
|
func (c *Client) MembersAfter(
|
||||||
limit uint) ([]discord.Member, error) {
|
guildID, after discord.Snowflake, limit uint) ([]discord.Member, error) {
|
||||||
|
|
||||||
if limit == 0 {
|
if limit == 0 {
|
||||||
limit = 1
|
limit = 1
|
||||||
|
@ -140,8 +140,9 @@ type AnyMemberData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddMember requires access(Token).
|
// AddMember requires access(Token).
|
||||||
func (c *Client) AddMember(guildID, userID discord.Snowflake,
|
func (c *Client) AddMember(
|
||||||
token string, data AnyMemberData) (*discord.Member, error) {
|
guildID, userID discord.Snowflake, token string,
|
||||||
|
data AnyMemberData) (*discord.Member, error) {
|
||||||
|
|
||||||
// VoiceChannel doesn't belong here
|
// VoiceChannel doesn't belong here
|
||||||
data.VoiceChannel = 0
|
data.VoiceChannel = 0
|
||||||
|
@ -297,7 +298,8 @@ func (c *Client) MoveRole(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ModifyRole(guildID, roleID discord.Snowflake,
|
func (c *Client) ModifyRole(
|
||||||
|
guildID, roleID discord.Snowflake,
|
||||||
data AnyRoleData) (*discord.Role, error) {
|
data AnyRoleData) (*discord.Role, error) {
|
||||||
|
|
||||||
var role *discord.Role
|
var role *discord.Role
|
||||||
|
@ -387,7 +389,8 @@ func (c *Client) Integrations(
|
||||||
}
|
}
|
||||||
|
|
||||||
// AttachIntegration requires MANAGE_GUILD.
|
// AttachIntegration requires MANAGE_GUILD.
|
||||||
func (c *Client) AttachIntegration(guildID, integrationID discord.Snowflake,
|
func (c *Client) AttachIntegration(
|
||||||
|
guildID, integrationID discord.Snowflake,
|
||||||
integrationType discord.IntegrationType) error {
|
integrationType discord.IntegrationType) error {
|
||||||
|
|
||||||
var param struct {
|
var param struct {
|
||||||
|
@ -403,7 +406,8 @@ func (c *Client) AttachIntegration(guildID, integrationID discord.Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModifyIntegration requires MANAGE_GUILD.
|
// ModifyIntegration requires MANAGE_GUILD.
|
||||||
func (c *Client) ModifyIntegration(guildID, integrationID discord.Snowflake,
|
func (c *Client) ModifyIntegration(
|
||||||
|
guildID, integrationID discord.Snowflake,
|
||||||
expireBehavior, expireGracePeriod int, emoticons bool) error {
|
expireBehavior, expireGracePeriod int, emoticons bool) error {
|
||||||
|
|
||||||
var param struct {
|
var param struct {
|
||||||
|
@ -440,7 +444,8 @@ func (c *Client) GuildEmbed(
|
||||||
// ModifyGuildEmbed should be used with care: if you still want the embed
|
// ModifyGuildEmbed should be used with care: if you still want the embed
|
||||||
// enabled, you need to set the Enabled boolean, even if it's already enabled.
|
// enabled, you need to set the Enabled boolean, even if it's already enabled.
|
||||||
// If you don't, JSON will default it to false.
|
// If you don't, JSON will default it to false.
|
||||||
func (c *Client) ModifyGuildEmbed(guildID discord.Snowflake,
|
func (c *Client) ModifyGuildEmbed(
|
||||||
|
guildID discord.Snowflake,
|
||||||
data discord.GuildEmbed) (*discord.GuildEmbed, error) {
|
data discord.GuildEmbed) (*discord.GuildEmbed, error) {
|
||||||
|
|
||||||
return &data, c.RequestJSON(&data, "PATCH",
|
return &data, c.RequestJSON(&data, "PATCH",
|
||||||
|
|
|
@ -35,21 +35,24 @@ func (c *Client) Messages(
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessagesAround returns messages around the ID, with a limit of 1-100.
|
// MessagesAround returns messages around the ID, with a limit of 1-100.
|
||||||
func (c *Client) MessagesAround(channelID, around discord.Snowflake,
|
func (c *Client) MessagesAround(
|
||||||
|
channelID, around discord.Snowflake,
|
||||||
limit uint) ([]discord.Message, error) {
|
limit uint) ([]discord.Message, error) {
|
||||||
|
|
||||||
return c.messagesRange(channelID, 0, 0, around, limit)
|
return c.messagesRange(channelID, 0, 0, around, limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessagesBefore returns messages before the ID, with a limit of 1-100.
|
// MessagesBefore returns messages before the ID, with a limit of 1-100.
|
||||||
func (c *Client) MessagesBefore(channelID, before discord.Snowflake,
|
func (c *Client) MessagesBefore(
|
||||||
|
channelID, before discord.Snowflake,
|
||||||
limit uint) ([]discord.Message, error) {
|
limit uint) ([]discord.Message, error) {
|
||||||
|
|
||||||
return c.messagesRange(channelID, before, 0, 0, limit)
|
return c.messagesRange(channelID, before, 0, 0, limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessagesAfter returns messages after the ID, with a limit of 1-100.
|
// MessagesAfter returns messages after the ID, with a limit of 1-100.
|
||||||
func (c *Client) MessagesAfter(channelID, after discord.Snowflake,
|
func (c *Client) MessagesAfter(
|
||||||
|
channelID, after discord.Snowflake,
|
||||||
limit uint) ([]discord.Message, error) {
|
limit uint) ([]discord.Message, error) {
|
||||||
|
|
||||||
return c.messagesRange(channelID, 0, after, 0, limit)
|
return c.messagesRange(channelID, 0, after, 0, limit)
|
||||||
|
@ -86,8 +89,9 @@ func (c *Client) Message(
|
||||||
EndpointChannels+channelID.String()+"/messages/"+messageID.String())
|
EndpointChannels+channelID.String()+"/messages/"+messageID.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SendMessage(channelID discord.Snowflake,
|
func (c *Client) SendMessage(
|
||||||
content string, embed *discord.Embed) (*discord.Message, error) {
|
channelID discord.Snowflake, content string,
|
||||||
|
embed *discord.Embed) (*discord.Message, error) {
|
||||||
|
|
||||||
return c.SendMessageComplex(channelID, SendMessageData{
|
return c.SendMessageComplex(channelID, SendMessageData{
|
||||||
Content: content,
|
Content: content,
|
||||||
|
@ -95,7 +99,8 @@ func (c *Client) SendMessage(channelID discord.Snowflake,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SendMessageComplex(channelID discord.Snowflake,
|
func (c *Client) SendMessageComplex(
|
||||||
|
channelID discord.Snowflake,
|
||||||
data SendMessageData) (*discord.Message, error) {
|
data SendMessageData) (*discord.Message, error) {
|
||||||
|
|
||||||
if data.Embed != nil {
|
if data.Embed != nil {
|
||||||
|
@ -127,9 +132,9 @@ func (c *Client) SendMessageComplex(channelID discord.Snowflake,
|
||||||
return msg, c.DecodeStream(resp.Body, &msg)
|
return msg, c.DecodeStream(resp.Body, &msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) EditMessage(channelID, messageID discord.Snowflake,
|
func (c *Client) EditMessage(
|
||||||
content string, embed *discord.Embed, suppressEmbeds bool,
|
channelID, messageID discord.Snowflake, content string,
|
||||||
) (*discord.Message, error) {
|
embed *discord.Embed, suppressEmbeds bool) (*discord.Message, error) {
|
||||||
|
|
||||||
var param struct {
|
var param struct {
|
||||||
Content string `json:"content,omitempty"`
|
Content string `json:"content,omitempty"`
|
||||||
|
@ -160,8 +165,8 @@ func (c *Client) DeleteMessage(channelID, messageID discord.Snowflake) error {
|
||||||
|
|
||||||
// DeleteMessages only works for bots. It can't delete messages older than 2
|
// DeleteMessages only works for bots. It can't delete messages older than 2
|
||||||
// weeks, and will fail if tried. This endpoint requires MANAGE_MESSAGES.
|
// weeks, and will fail if tried. This endpoint requires MANAGE_MESSAGES.
|
||||||
func (c *Client) DeleteMessages(channelID discord.Snowflake,
|
func (c *Client) DeleteMessages(
|
||||||
messageIDs []discord.Snowflake) error {
|
channelID discord.Snowflake, messageIDs []discord.Snowflake) error {
|
||||||
|
|
||||||
var param struct {
|
var param struct {
|
||||||
Messages []discord.Snowflake `json:"messages"`
|
Messages []discord.Snowflake `json:"messages"`
|
||||||
|
|
|
@ -7,17 +7,18 @@ import (
|
||||||
|
|
||||||
// React adds a reaction to the message. This requires READ_MESSAGE_HISTORY (and
|
// React adds a reaction to the message. This requires READ_MESSAGE_HISTORY (and
|
||||||
// additionally ADD_REACTIONS) to react.
|
// additionally ADD_REACTIONS) to react.
|
||||||
func (c *Client) React(chID, msgID discord.Snowflake,
|
func (c *Client) React(
|
||||||
emoji EmojiAPI) error {
|
channelID, messageID discord.Snowflake, emoji EmojiAPI) error {
|
||||||
|
|
||||||
var msgURL = EndpointChannels + chID.String() +
|
var msgURL = EndpointChannels + channelID.String() +
|
||||||
"/messages/" + msgID.String() +
|
"/messages/" + messageID.String() +
|
||||||
"/reactions/" + emoji + "/@me"
|
"/reactions/" + emoji + "/@me"
|
||||||
return c.FastRequest("PUT", msgURL)
|
return c.FastRequest("PUT", msgURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reactions returns all reactions. It will paginate automatically.
|
// Reactions returns all reactions. It will paginate automatically.
|
||||||
func (c *Client) Reactions(channelID, messageID discord.Snowflake,
|
func (c *Client) Reactions(
|
||||||
|
channelID, messageID discord.Snowflake,
|
||||||
emoji EmojiAPI) ([]discord.User, error) {
|
emoji EmojiAPI) ([]discord.User, error) {
|
||||||
|
|
||||||
var users []discord.User
|
var users []discord.User
|
||||||
|
|
Loading…
Reference in a new issue