Files
discordeno/src/helpers/messages/get_message.ts
ayntee e9cbbbff7c refactor(helpers): separate functions into files (#667)
* refactor(helpers): separate functions into files

* idk

* idk
2021-03-13 08:10:31 -05:00

20 lines
742 B
TypeScript

import { RequestManager } from "../../rest/request_manager.ts";
import { structures } from "../../structures/mod.ts";
import { MessageCreateOptions } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
/** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
export async function getMessage(channelID: string, id: string) {
await requireBotChannelPermissions(channelID, [
"VIEW_CHANNEL",
"READ_MESSAGE_HISTORY",
]);
const result = (await RequestManager.get(
endpoints.CHANNEL_MESSAGE(channelID, id),
)) as MessageCreateOptions;
return structures.createMessageStruct(result);
}