diff options
| author | Fuwn <[email protected]> | 2025-09-28 19:27:11 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-28 19:27:11 -0700 |
| commit | 0ffbe3907a2d61a02a60fad626942b1abf1455df (patch) | |
| tree | c6793d4f631ba5676675af0c82f8ec12539f2257 /packages/gateway/src/commands/delete.ts | |
| parent | feat(commands:delete): Update delete command parameters (diff) | |
| download | umabotdiscord-0ffbe3907a2d61a02a60fad626942b1abf1455df.tar.xz umabotdiscord-0ffbe3907a2d61a02a60fad626942b1abf1455df.zip | |
feat(listeners): Add AI command handler
Diffstat (limited to 'packages/gateway/src/commands/delete.ts')
| -rw-r--r-- | packages/gateway/src/commands/delete.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/gateway/src/commands/delete.ts b/packages/gateway/src/commands/delete.ts index 78b17be..8b36eb9 100644 --- a/packages/gateway/src/commands/delete.ts +++ b/packages/gateway/src/commands/delete.ts @@ -17,7 +17,7 @@ export const handleDeleteCommand = async (message: Message) => { if (parameters.length < 1) { await message.reply( - "❌ Usage: `uma!delete <message_id> [channel_id]`\nExamples:\n- `uma!delete 1234567890123456789` (current channel)\n- `uma!delete 1234567890123456789 9876543210987654321` (specific channel)" + "❌ Usage: `uma!delete <message_id> [channel_id]`\nExamples:\n- `uma!delete 1234567890123456789` (current channel)\n- `uma!delete 1234567890123456789 9876543210987654321` (specific channel)", ); return; @@ -27,13 +27,17 @@ export const handleDeleteCommand = async (message: Message) => { const channelId = parameters[1]; if (!/^\d{17,19}$/.test(messageId)) { - await message.reply("❌ Invalid message ID format. Please provide a valid Discord message ID."); + await message.reply( + "❌ Invalid message ID format. Please provide a valid Discord message ID.", + ); return; } if (channelId && !/^\d{17,19}$/.test(channelId)) { - await message.reply("❌ Invalid channel ID format. Please provide a valid Discord channel ID."); + await message.reply( + "❌ Invalid channel ID format. Please provide a valid Discord channel ID.", + ); return; } @@ -44,7 +48,7 @@ export const handleDeleteCommand = async (message: Message) => { if (channelId) { targetChannel = message.client.channels.cache.get(channelId); - + if (!targetChannel || !targetChannel.isTextBased()) { await message.reply("❌ Channel not found or is not a text channel."); @@ -62,12 +66,13 @@ export const handleDeleteCommand = async (message: Message) => { return; } - await targetMessage.delete(); await message.delete(); } catch (error) { console.error("Error deleting message:", error); - await message.reply("❌ Failed to delete the message. Check bot permissions and try again."); + await message.reply( + "❌ Failed to delete the message. Check bot permissions and try again.", + ); } } }; |