fix: webhook typings

This commit is contained in:
Skillz4Killz
2021-04-12 18:27:12 +00:00
committed by GitHub
parent 381ea450ac
commit c4352ea83f

View File

@@ -1,8 +1,10 @@
import { rest } from "../../rest/rest.ts";
import { Errors } from "../../types/misc/errors.ts";
import { CreateWebhook } from "../../types/webhooks/create_webhook.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts";
import { snakeKeysToCamelCase, urlToBase64 } from "../../util/utils.ts";
/**
* Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
@@ -11,7 +13,7 @@ import { urlToBase64 } from "../../util/utils.ts";
*/
export async function createWebhook(
channelId: string,
options: WebhookCreateOptions,
options: CreateWebhook,
) {
await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]);
@@ -34,5 +36,5 @@ export async function createWebhook(
},
);
return result as WebhookPayload;
return snakeKeysToCamelCase<Webhook>(result);
}