Gateway helpers

This commit is contained in:
TriForMine
2021-10-21 17:41:47 +02:00
parent 9eed90f8ed
commit 17115e7681
50 changed files with 121 additions and 110 deletions
+4 -6
View File
@@ -1,10 +1,8 @@
import { rest } from "../../rest/rest.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
import type {Bot} from "../../bot.ts";
/** Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a undefined on success */
export async function deleteWebhook(channelId: bigint, webhookId: bigint) {
await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]);
export async function deleteWebhook(bot: Bot, channelId: bigint, webhookId: bigint) {
await bot.utils.requireBotChannelPermissions(bot, channelId, ["MANAGE_WEBHOOKS"]);
return await rest.runMethod<undefined>("delete", endpoints.WEBHOOK_ID(webhookId));
return await bot.rest.runMethod<undefined>(bot.rset,"delete", bot.constants.endpoints.WEBHOOK_ID(webhookId));
}