From e2737bbe081f9b779bda0725ead6174a04204430 Mon Sep 17 00:00:00 2001 From: fucksophie Date: Sat, 31 Jan 2026 22:00:09 +0200 Subject: [PATCH] add chatbox command `amount` --- src/modules/chatbox.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/modules/chatbox.lua b/src/modules/chatbox.lua index 798b349..d12e028 100644 --- a/src/modules/chatbox.lua +++ b/src/modules/chatbox.lua @@ -106,6 +106,30 @@ function run() else chatbox.tell(user, "You are not registered. Ask the creator of this SIS to be registered.", BOT_NAME) end + elseif args[1] == "amount" then + if not auth(user) then goto continue end + + if not args[2] then + chatbox.tell(user, "Supply a item (minecraft:`diamond` part) to view it's count.", BOT_NAME) + goto continue + end + + local best = findBest(inv:listNames(), args[2]) + + local itemName = "" + + if #best > 1 then + itemName = best[1][1] + if string.find(":", args[2]) then + itemName = args[2] + end + else + itemName = best[1][1] + end + + local amount = inv:listItemAmounts()[itemName] + + chatbox.tell(user, "There are " .. tostring(amount) .. " of `" .. itemName .. "`.") elseif args[1] == "deposit" then if not auth(user) then goto continue end