1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 10:43:30 +00:00

API: use CreateWebhookData instead of direct arguments

This commit is contained in:
mavolin 2020-05-23 03:30:24 +02:00 committed by diamondburned
parent 93d9323b3b
commit 6cc6d05f5f

View file

@ -22,22 +22,13 @@ type CreateWebhookData struct {
//
// Requires the MANAGE_WEBHOOKS permission.
func (c *Client) CreateWebhook(
channelID discord.Snowflake,
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
channelID discord.Snowflake, data CreateWebhookData) (*discord.Webhook, error) {
var w *discord.Webhook
return w, c.RequestJSON(
&w, "POST",
EndpointChannels+channelID.String()+"/webhooks",
httputil.WithJSONBody(param),
httputil.WithJSONBody(data),
)
}