feat(plugins/helpers): add sendTextMessage to send a simple string (#2033)

* feat: sendTextMessage to send simple string

* fix: clean up imports

* Update plugins/helpers/mod.ts

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
This commit is contained in:
Skillz4Killz
2022-02-11 17:14:49 +00:00
committed by GitHub
co-authored by LTS20050703
parent cfbfb67c8e
commit 14f44458f9
2 changed files with 19 additions and 0 deletions
+8
View File
@@ -25,6 +25,10 @@ export interface BotWithHelpersPlugin extends Bot {
userId: bigint,
content: string | CreateMessage,
) => Promise<DiscordenoMessage>;
sendTextMessage: (
channelId: bigint,
content: string | CreateMessage,
) => Promise<DiscordenoMessage>;
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);
+11
View File
@@ -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);
}