add chatbox command amount
This commit is contained in:
parent
2dac4c10fd
commit
e2737bbe08
1 changed files with 24 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue