mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
15 lines
518 B
TypeScript
15 lines
518 B
TypeScript
import type { Webhook } from "../../types/webhooks/webhook.ts";
|
|
import { Collection } from "../../util/collection.ts";
|
|
import type { Bot } from "../../bot.ts";
|
|
|
|
/** Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS */
|
|
export async function getChannelWebhooks(bot: Bot, channelId: bigint) {
|
|
const result = await bot.rest.runMethod<Webhook[]>(
|
|
bot.rest,
|
|
"get",
|
|
bot.constants.endpoints.CHANNEL_WEBHOOKS(channelId),
|
|
);
|
|
|
|
return new Collection(result.map((webhook) => [webhook.id, webhook]));
|
|
}
|