add chatbox command amount

This commit is contained in:
Soph :3 2026-01-31 22:00:09 +02:00
parent 2dac4c10fd
commit e2737bbe08

View file

@ -106,6 +106,30 @@ function run()
else else
chatbox.tell(user, "You are not registered. Ask the creator of this SIS to be registered.", BOT_NAME) chatbox.tell(user, "You are not registered. Ask the creator of this SIS to be registered.", BOT_NAME)
end 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 elseif args[1] == "deposit" then
if not auth(user) then goto continue end if not auth(user) then goto continue end