mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-12-26 23:16:41 +00:00
Webhook: fix incorrect order of parameters
This commit is contained in:
parent
ba1fc650d1
commit
362929fad5
|
@ -22,24 +22,24 @@ var DefaultHTTPClient = httputil.NewClient()
|
||||||
type Client struct {
|
type Client struct {
|
||||||
// Client is the httputil.Client used to call Discord's API.
|
// Client is the httputil.Client used to call Discord's API.
|
||||||
*httputil.Client
|
*httputil.Client
|
||||||
// Token is the token of the webhook.
|
|
||||||
Token string
|
|
||||||
// ID is the id of the webhook.
|
// ID is the id of the webhook.
|
||||||
ID discord.WebhookID
|
ID discord.WebhookID
|
||||||
|
// Token is the token of the webhook.
|
||||||
|
Token string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient creates a new Client using the passed token and id.
|
// NewClient creates a new Client using the passed token and id.
|
||||||
func NewClient(token string, id discord.WebhookID) *Client {
|
func NewClient(id discord.WebhookID, token string) *Client {
|
||||||
return NewCustomClient(token, id, httputil.NewClient())
|
return NewCustomClient(id, token, httputil.NewClient())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCustomClient creates a new Client creates a new Client using the passed
|
// NewCustomClient creates a new Client creates a new Client using the passed
|
||||||
// token and id and makes API calls using the passed httputil.Client
|
// token and id and makes API calls using the passed httputil.Client
|
||||||
func NewCustomClient(token string, id discord.WebhookID, c *httputil.Client) *Client {
|
func NewCustomClient(id discord.WebhookID, token string, c *httputil.Client) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
Client: c,
|
Client: c,
|
||||||
Token: token,
|
|
||||||
ID: id,
|
ID: id,
|
||||||
|
Token: token,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,34 +130,34 @@ func (c *Client) execute(data api.ExecuteWebhookData, wait bool) (*discord.Messa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get is a shortcut for NewCustomClient(token, id, DefaultHTTPClient).Get().
|
// Get is a shortcut for NewCustomClient(token, id, DefaultHTTPClient).Get().
|
||||||
func Get(token string, id discord.WebhookID) (*discord.Webhook, error) {
|
func Get(id discord.WebhookID, token string) (*discord.Webhook, error) {
|
||||||
return NewCustomClient(token, id, DefaultHTTPClient).Get()
|
return NewCustomClient(id, token, DefaultHTTPClient).Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify is a shortcut for
|
// Modify is a shortcut for
|
||||||
// NewCustomClient(token, id, DefaultHTTPClient).Modify(data).
|
// NewCustomClient(token, id, DefaultHTTPClient).Modify(data).
|
||||||
func Modify(
|
func Modify(
|
||||||
token string, id discord.WebhookID, data api.ModifyWebhookData) (*discord.Webhook, error) {
|
id discord.WebhookID, token string, data api.ModifyWebhookData) (*discord.Webhook, error) {
|
||||||
|
|
||||||
return NewCustomClient(token, id, DefaultHTTPClient).Modify(data)
|
return NewCustomClient(id, token, DefaultHTTPClient).Modify(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete is a shortcut for
|
// Delete is a shortcut for
|
||||||
// NewCustomClient(token, id, DefaultHTTPClient).Delete().
|
// NewCustomClient(token, id, DefaultHTTPClient).Delete().
|
||||||
func Delete(token string, id discord.WebhookID) error {
|
func Delete(id discord.WebhookID, token string) error {
|
||||||
return NewCustomClient(token, id, DefaultHTTPClient).Delete()
|
return NewCustomClient(id, token, DefaultHTTPClient).Delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute is a shortcut for
|
// Execute is a shortcut for
|
||||||
// NewCustomClient(token, id, DefaultHTTPClient).Execute(data).
|
// NewCustomClient(token, id, DefaultHTTPClient).Execute(data).
|
||||||
func Execute(token string, id discord.WebhookID, data api.ExecuteWebhookData) error {
|
func Execute(id discord.WebhookID, token string, data api.ExecuteWebhookData) error {
|
||||||
return NewCustomClient(token, id, DefaultHTTPClient).Execute(data)
|
return NewCustomClient(id, token, DefaultHTTPClient).Execute(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteAndWait is a shortcut for
|
// ExecuteAndWait is a shortcut for
|
||||||
// NewCustomClient(token, id, DefaultHTTPClient).ExecuteAndWait(data).
|
// NewCustomClient(token, id, DefaultHTTPClient).ExecuteAndWait(data).
|
||||||
func ExecuteAndWait(
|
func ExecuteAndWait(
|
||||||
token string, id discord.WebhookID, data api.ExecuteWebhookData) (*discord.Message, error) {
|
id discord.WebhookID, token string, data api.ExecuteWebhookData) (*discord.Message, error) {
|
||||||
|
|
||||||
return NewCustomClient(token, id, DefaultHTTPClient).ExecuteAndWait(data)
|
return NewCustomClient(id, token, DefaultHTTPClient).ExecuteAndWait(data)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue