mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 00:51:37 +01:00
add !iteminfo and !use commands
This commit is contained in:
10
bot/commands/iteminfo.ts
Normal file
10
bot/commands/iteminfo.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
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; };
|
||||
await sendMessage(`Name: ${selection.prettyName}, Description: ${selection.description}, Aliases: ${selection.aliases.join(', ')}`, msg.messageId);
|
||||
});
|
||||
10
bot/commands/useitem.ts
Normal file
10
bot/commands/useitem.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Command, sendMessage } from ".";
|
||||
import items from "../items";
|
||||
|
||||
export default new Command('use', ['use'], [], async (msg, user) => {
|
||||
const messageparts = msg.messageText.split(' ');
|
||||
if (!messageparts[1]) { await sendMessage('Please specify an item you would like to use', msg.messageId); return; };
|
||||
const selection = items.get(messageparts[1].toLowerCase());
|
||||
if (!selection) { await sendMessage(`'${messageparts[1]}' is not an item`, msg.messageId); return; };
|
||||
await selection.execute(msg, user);
|
||||
});
|
||||
Reference in New Issue
Block a user