-- Generate an HTML table for GitHub
function html_help()
local text = [[<table>
<thead>
<tr>
<td><strong>Name</strong></td>
<td><strong>Description</strong></td>
<td><strong>Usage</strong></td>
</tr>
</thead>
<tbody>]]
for k,v in pairs(plugins_names()) do
t = loadfile("plugins/"..v)()
text = text.."<tr>"
text = text.."<td>"..v.."</td>"
text = text.."<td>"..t.description.."</td>"
text = text.."<td>"
if (type(t.usage) == "table") then
for ku,vu in pairs(t.usage) do
text = text..vu.."<br>"
end
else
text = text..t.usage
text = text.."</td>"
text = text.."</tr>"
text = text.."</tbody></table>"
return text
function telegram_help( )
local ret = ""
for k, dict in pairs(plugins) do
if dict.usage ~= "" then
if (type(dict.usage) == "table") then
for ku,vu in pairs(dict.usage) do
ret = ret..vu.." "
ret = ret..dict.usage
ret = ret .. " -> " .. dict.description .. "\n"
return ret
function run(msg, matches)
if matches[1] == "!help md" then
return html_help()
return telegram_help()
return {
description = "Lists all available commands",
usage = {"!help", "!help md"},
patterns = {
"^!help$",
"^!help md$"
},
run = run
}