Files
discordeno/helpers/messages/getMessage.ts
ITOH 03996c5f58 refactor: revert "feat: base plugin lib idea (#2308)" (#2336)
* Revert "feat: base plugin lib idea (#2308)"

This reverts commit ffe7cdbc6f.

* fmt
2022-07-02 14:24:43 +01:00

17 lines
529 B
TypeScript

import type { Bot } from "../../bot.ts";
import { DiscordMessage } from "../../types/discord.ts";
/** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
export async function getMessage(bot: Bot, channelId: bigint, id: bigint) {
const result = await bot.rest.runMethod<DiscordMessage>(
bot.rest,
"GET",
bot.constants.routes.CHANNEL_MESSAGE(channelId, id),
);
// If the message does not exist
if (!result?.id) return;
return bot.transformers.message(bot, result);
}