diff --git a/plugins/helpers/mod.ts b/plugins/helpers/mod.ts index e492c31ce..3691ffb35 100644 --- a/plugins/helpers/mod.ts +++ b/plugins/helpers/mod.ts @@ -25,6 +25,10 @@ export interface BotWithHelpersPlugin extends Bot { userId: bigint, content: string | CreateMessage, ) => Promise; + sendTextMessage: ( + channelId: bigint, + content: string | CreateMessage, + ) => Promise; suppressEmbeds: ( channelId: bigint, messageId: bigint, @@ -70,6 +74,10 @@ export function enableHelpersPlugin(rawBot: Bot): BotWithHelpersPlugin { userId: bigint, content: string | CreateMessage, ) => sendDirectMessage(bot, userId, content); + bot.helpers.sendTextMessage = ( + channelId: bigint, + content: string | CreateMessage, + ) => sendTextMessage(bot, channelId, content); bot.helpers.suppressEmbeds = (channelId: bigint, messageId: bigint) => suppressEmbeds(bot, channelId, messageId); bot.helpers.archiveThread = (threadId: bigint) => archiveThread(bot, threadId); bot.helpers.unarchiveThread = (threadId: bigint) => unarchiveThread(bot, threadId); diff --git a/plugins/helpers/src/sendTextMessage.ts b/plugins/helpers/src/sendTextMessage.ts new file mode 100644 index 000000000..76162e210 --- /dev/null +++ b/plugins/helpers/src/sendTextMessage.ts @@ -0,0 +1,11 @@ +import { Bot, CreateMessage } from "../deps.ts"; + +/** Sends a text message. */ +export async function sendTextMessage( + bot: Bot, + channelId: bigint, + content: string | CreateMessage, +) { + if (typeof content === "string") content = { content }; + return bot.helpers.sendMessage(channelId, content); +}