mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 05:51:39 +01:00
create stable command parser
This commit is contained in:
@@ -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; };
|
||||
|
||||
Reference in New Issue
Block a user