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:
parent
93d9323b3b
commit
6cc6d05f5f
|
@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue