Files
discordeno/helpers/messages/deleteMessage.ts
2022-02-11 09:49:53 +00:00

20 lines
471 B
TypeScript

import type { Bot } from "../../bot.ts";
/** Delete a message with the channel id and message id only. */
export async function deleteMessage(
bot: Bot,
channelId: bigint,
messageId: bigint,
reason?: string,
delayMilliseconds = 0,
) {
if (delayMilliseconds) await bot.utils.delay(delayMilliseconds);
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_MESSAGE(channelId, messageId),
{ reason },
);
}