feat: expand faketpa + add usage
This commit is contained in:
parent
c51f71c1f2
commit
9cacc2ca46
4
chat.lua
4
chat.lua
|
|
@ -100,11 +100,11 @@ local function sayserver(msg)
|
|||
end)
|
||||
end
|
||||
|
||||
local function faketpa(tgtplr, sender, fakeplr, fakemsg)
|
||||
local function faketpa(tgtplr, sender, fakeplr, fakemsg, url)
|
||||
dispatch(function(bx)
|
||||
local clickEvent = {
|
||||
action = "open_url",
|
||||
value = "https://picture.wtf/p/27wzu9.png",
|
||||
value = url,
|
||||
}
|
||||
|
||||
local msg = {
|
||||
|
|
|
|||
45
cmds.lua
45
cmds.lua
|
|
@ -211,15 +211,54 @@ cmds.faketpa = {
|
|||
{ match = "block", desc = "from who fake" },
|
||||
{ match = "block", desc = "from who carrier" },
|
||||
{ match = "block", desc = "carrier says what" },
|
||||
{ match = "block", desc = "what url to open", optional = true },
|
||||
},
|
||||
allowLimitedUser = true,
|
||||
proc = function(unm, tgt, fromwho, carrierwho, carrierwhat)
|
||||
ch.faketpa(tgt, fromwho, carrierwho, carrierwhat)
|
||||
proc = function(unm, tgt, fromwho, carrierwho, carrierwhat, openurl)
|
||||
openurl = openurl or "https://picture.wtf/p/27wzu9.png"
|
||||
ch.faketpa(tgt, fromwho, carrierwho, carrierwhat, openurl)
|
||||
end,
|
||||
}
|
||||
|
||||
cmds.usage = {
|
||||
alias = { "u", "cmd", "c" },
|
||||
desc = "how to use a command?",
|
||||
args = {
|
||||
{ match = "block", desc = "what command" },
|
||||
},
|
||||
allowLimitedUser = true,
|
||||
proc = function(unm, cmd)
|
||||
local xcmd
|
||||
for k, v in next, cmds do
|
||||
if k == cmd then
|
||||
xcmd = v
|
||||
break
|
||||
end
|
||||
for _, a in next, v.alias do
|
||||
if a == cmd then
|
||||
xcmd = v
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not xcmd then
|
||||
ch.send(unm, "could not find command \"" .. cmd .. "\"", "cmd")
|
||||
return
|
||||
end
|
||||
local msg = "the usage is- $" .. cmd
|
||||
for _, arg in next, xcmd.args do
|
||||
local br1, br2 = "<", ">"
|
||||
if arg.optional then
|
||||
br1, br2 = "[", "]"
|
||||
end
|
||||
msg = msg .. " " .. br1 .. arg.desc .. br2
|
||||
end
|
||||
ch.send(unm, msg, "help")
|
||||
end,
|
||||
}
|
||||
|
||||
cmds.help = {
|
||||
alias = {},
|
||||
alias = { "cmds", "?" },
|
||||
desc = "help with how to use",
|
||||
args = {
|
||||
{ match = "number", desc = "page", optional = true }
|
||||
|
|
|
|||
15
index.lua
15
index.lua
|
|
@ -83,20 +83,21 @@ local function processMessage(unm, msg, hidden)
|
|||
|
||||
if x.match == "block" then
|
||||
msg, arg = nextWord(msg)
|
||||
if not arg then
|
||||
if not arg and not x.optional then
|
||||
ch.send(unm, "missing arg: " .. x.desc, "cmd")
|
||||
return
|
||||
end
|
||||
elseif x.match == "player" then
|
||||
msg, arg = nextWord(msg)
|
||||
if not arg then
|
||||
if not arg and not x.optional then
|
||||
ch.send(unm, "missing player arg: " .. x.desc, "cmd")
|
||||
return
|
||||
end
|
||||
arg = tk:resTg(arg)
|
||||
if not arg then
|
||||
ch.send(unm, "target not found for: " .. x.desc, "cmd")
|
||||
return
|
||||
else
|
||||
arg = tk:resTg(arg)
|
||||
if not arg then
|
||||
ch.send(unm, "target not found for: " .. x.desc, "cmd")
|
||||
return
|
||||
end
|
||||
end
|
||||
elseif x.match == "rest" then
|
||||
arg = msg
|
||||
|
|
|
|||
Loading…
Reference in New Issue