feat: expand faketpa + add usage

This commit is contained in:
minish 2026-02-20 05:56:57 -05:00
parent c51f71c1f2
commit 9cacc2ca46
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
3 changed files with 52 additions and 12 deletions

View File

@ -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 = {

View File

@ -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 }

View File

@ -83,21 +83,22 @@ 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
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
msg = ""