mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-04-23 14:26:05 +00:00
API: use CreateWebhookData instead of direct arguments
This commit is contained in:
parent
93d9323b3b
commit
6cc6d05f5f
|
@ -22,22 +22,13 @@ type CreateWebhookData struct {
|
||||||
//
|
//
|
||||||
// Requires the MANAGE_WEBHOOKS permission.
|
// Requires the MANAGE_WEBHOOKS permission.
|
||||||
func (c *Client) CreateWebhook(
|
func (c *Client) CreateWebhook(
|
||||||
channelID discord.Snowflake,
|
channelID discord.Snowflake, data CreateWebhookData) (*discord.Webhook, error) {
|
||||||
name string, avatar discord.Hash) (*discord.Webhook, error) {
|
|
||||||
|
|
||||||
var param struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Avatar discord.Hash `json:"avatar"`
|
|
||||||
}
|
|
||||||
|
|
||||||
param.Name = name
|
|
||||||
param.Avatar = avatar
|
|
||||||
|
|
||||||
var w *discord.Webhook
|
var w *discord.Webhook
|
||||||
return w, c.RequestJSON(
|
return w, c.RequestJSON(
|
||||||
&w, "POST",
|
&w, "POST",
|
||||||
EndpointChannels+channelID.String()+"/webhooks",
|
EndpointChannels+channelID.String()+"/webhooks",
|
||||||
httputil.WithJSONBody(param),
|
httputil.WithJSONBody(data),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue