add !iteminfo and !use commands

This commit is contained in:
2025-06-25 00:03:11 +02:00
parent c0ae6eee7e
commit 8060aac6a7
2 changed files with 20 additions and 0 deletions

10
bot/commands/iteminfo.ts Normal file
View 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
View 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);
});