mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 05:51:39 +01:00
reworked !use and !info, moved functionality from timeout to item
This commit is contained in:
@@ -2,9 +2,9 @@ import { Command, sendMessage } from ".";
|
||||
import items from "../items";
|
||||
|
||||
export default new Command('iteminfo', ['iteminfo', 'itemhelp', 'info'], [], async msg => {
|
||||
const messageparts = msg.messageText.split(' ');
|
||||
if (!messageparts[1]) { await sendMessage('Please specify an item you would like to get info about', msg.messageId); return; };
|
||||
const selection = items.get(messageparts[1].toLowerCase());
|
||||
if (!selection) { await sendMessage(`'${messageparts[1]}' is not an item`, msg.messageId); return; };
|
||||
const messagequery = msg.messageText.trim().split(' ').slice(1).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; };
|
||||
await sendMessage(`Name: ${selection.prettyName}, Description: ${selection.description}, Aliases: ${selection.aliases.join(', ')}`, msg.messageId);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user