From 8060aac6a74ade3de77b40b789e4b770d35cc5bf Mon Sep 17 00:00:00 2001 From: qwerinope Date: Wed, 25 Jun 2025 00:03:11 +0200 Subject: [PATCH] add !iteminfo and !use commands --- bot/commands/iteminfo.ts | 10 ++++++++++ bot/commands/useitem.ts | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 bot/commands/iteminfo.ts create mode 100644 bot/commands/useitem.ts diff --git a/bot/commands/iteminfo.ts b/bot/commands/iteminfo.ts new file mode 100644 index 0000000..aac7971 --- /dev/null +++ b/bot/commands/iteminfo.ts @@ -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); +}); diff --git a/bot/commands/useitem.ts b/bot/commands/useitem.ts new file mode 100644 index 0000000..2021195 --- /dev/null +++ b/bot/commands/useitem.ts @@ -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); +});