Files
discordeno/plugins/bot/helpers/webhooks/getWebhook.ts
Skillz4Killz ffe7cdbc6f feat: base plugin lib idea (#2308)
* feat: base plugin lib idea

* fix: stuff

* fmt

* fix: imports and exports

* fix: errors & tests

* fix: remove logs
2022-06-18 18:46:37 -04:00

16 lines
421 B
TypeScript

import { Bot } from "../../bot.ts";
import { DiscordWebhook } from "../../deps.ts";
/** Returns the new webhook object for the given id. */
export async function getWebhook(bot: Bot, webhookId: bigint) {
const result = await bot.rest.runMethod<DiscordWebhook>(
bot.rest,
"GET",
bot.constants.routes.WEBHOOK_ID(webhookId),
);
if (!result?.id) return;
return bot.transformers.webhook(bot, result);
}