diff options
Diffstat (limited to 'packages/gateway/src/commands/say.ts')
| -rw-r--r-- | packages/gateway/src/commands/say.ts | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/packages/gateway/src/commands/say.ts b/packages/gateway/src/commands/say.ts index ec19a33..8a9ab5a 100644 --- a/packages/gateway/src/commands/say.ts +++ b/packages/gateway/src/commands/say.ts @@ -1,5 +1,6 @@ import { Message } from "discord.js"; import { GUILD_ID } from "../constants"; +import { replyWithCleanup } from "../utilities"; export const handleSayCommand = async (message: Message) => { if (message.author.bot) return; @@ -13,7 +14,8 @@ export const handleSayCommand = async (message: Message) => { const parameters = message.content.split(" ").slice(1); if (parameters.length < 2) { - await message.reply( + await replyWithCleanup( + message, "❌ Usage: `uma!say <channel_mention_or_message_id> <message>`\nExamples:\n- `uma!say #general Hello everyone!`\n- `uma!say 1234567890123456789 Thanks for the info!`", ); @@ -31,7 +33,7 @@ export const handleSayCommand = async (message: Message) => { const guild = message.client.guilds.cache.get(GUILD_ID); if (!guild) { - await message.reply("❌ Guild not found."); + await replyWithCleanup(message, "❌ Guild not found."); return; } @@ -56,12 +58,12 @@ export const handleSayCommand = async (message: Message) => { } if (!foundMessage) { - await message.reply("❌ Message not found."); + await replyWithCleanup(message, "❌ Message not found."); return; } } catch { - await message.reply("❌ Error finding message."); + await replyWithCleanup(message, "❌ Error finding message."); return; } @@ -69,7 +71,8 @@ export const handleSayCommand = async (message: Message) => { const channelMatch = firstParameter.match(/<#(\d+)>/); if (!channelMatch) { - await message.reply( + await replyWithCleanup( + message, "❌ Please mention a channel or provide a message ID. Example: `#general` or `1234567890123456789`", ); @@ -81,7 +84,10 @@ export const handleSayCommand = async (message: Message) => { targetChannel = message.client.channels.cache.get(channelId); if (!targetChannel || !targetChannel.isTextBased()) { - await message.reply("❌ Channel not found or is not a text channel."); + await replyWithCleanup( + message, + "❌ Channel not found or is not a text channel.", + ); return; } @@ -114,7 +120,8 @@ export const handleSayCommand = async (message: Message) => { console.error("Error executing say command:", error); try { - await message.reply( + await replyWithCleanup( + message, "❌ Failed to execute the say command. Please check permissions.", ); } catch (replyError) { |