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
1 changed files with 2 additions and 11 deletions

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),
)
}