mirror of
https://github.com/swc-project/swc.git
synced 2025-01-02 10:37:56 +03:00
swc_bundler: - Fix cycle detection for complex circular imports. (denoland/deno#10752) swc_ecma_transforms_typescript: - Allow using large values for an enum variant.
18 lines
768 B
TypeScript
18 lines
768 B
TypeScript
// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/channels/get_channel_webhooks.ts
|
|
|
|
|
|
import { rest } from "../../rest/rest.ts";
|
|
import type { Webhook } from "../../types/webhooks/webhook.ts";
|
|
import { Collection } from "../../util/collection.ts";
|
|
import { endpoints } from "../../util/constants.ts";
|
|
import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
|
|
|
/** Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS */
|
|
export async function getChannelWebhooks(channelId: bigint) {
|
|
await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]);
|
|
|
|
const result = await rest.runMethod<Webhook[]>("get", endpoints.CHANNEL_WEBHOOKS(channelId));
|
|
|
|
return new Collection(result.map((webhook) => [webhook.id, webhook]));
|
|
}
|