create stable command parser

This commit is contained in:
2025-06-25 02:11:17 +02:00
parent dc087c3599
commit 273f5e3674
3 changed files with 13 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
import { Command, sendMessage } from ".";
import items from "../items";
import parseCommandArgs from "../lib/parseCommandArgs";
export default new Command('iteminfo', ['iteminfo', 'itemhelp', 'info'], [], async msg => {
const messagequery = msg.messageText.trim().split(' ').slice(1).join(' ');
const messagequery = parseCommandArgs(msg.messageText).join(' ');
if (!messagequery) { await sendMessage('Please specify an item you would like to get info about', msg.messageId); return; };
const selection = items.get(messagequery.toLowerCase());
if (!selection) { await sendMessage(`'${messagequery}' is not an item`, msg.messageId); return; };