mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
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:
co-authored by
LTS20050703
parent
cfbfb67c8e
commit
14f44458f9
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user