Help well formatted

This commit is contained in:
yago 2015-02-04 23:03:42 +01:00
parent bd7264f496
commit 9fc9383ab7
14 changed files with 44 additions and 34 deletions

View File

@ -4,8 +4,8 @@ function run(msg, matches)
end
return {
description = "echoes the msg",
usage = "!echo [whatever]",
description = "Simplest plugin ever!",
usage = "!echo [whatever]: echoes the msg",
patterns = {"^!echo (.*)$"},
run = run
}

View File

@ -72,11 +72,11 @@ function lex(msg, text)
end
return {
description = "retrieves variables saved with !set",
usage = "!get (value_name)",
description = "Retrieves variables saved with !set",
usage = "!get (value_name): Returns the value_name value.",
patterns = {
"^!get (%a+)$",
"^!get$"},
"^!get$"},
run = run,
lex = lex
}

View File

@ -29,7 +29,7 @@ end
return {
description = "Searches Google and send results",
usage = "!google [terms]",
usage = "!google [terms]: Searches Google and send results",
patterns = {
"^!google (.*)$",
"^%.[g|G]oogle (.*)$"

View File

@ -25,7 +25,7 @@ end
return {
description = "generates a map showing the given GPS coordinates",
usage = "!gps latitude,longitude",
usage = "!gps latitude,longitude: generates a map showing the given GPS coordinates",
patterns = {"^!gps ([^,]*)[,%s]([^,]*)$"},
run = run
}

View File

@ -30,18 +30,23 @@ function html_help()
return text
end
function has_usage_data(dict)
if (dict.usage == nil or dict.usage == '') then
return false
end
return true
end
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.." "
end
else
ret = ret..dict.usage
if (type(dict.usage) == "table") then
for ku,usage in pairs(dict.usage) do
ret = ret..usage..'\n'
end
ret = ret .. " -> " .. dict.description .. "\n"
ret = ret..'\n'
elseif has_usage_data(dict) then -- Is not empty
ret = ret..dict.usage..'\n\n'
end
end
return ret
@ -56,8 +61,11 @@ function run(msg, matches)
end
return {
description = "Lists all available commands",
usage = {"!help", "!help md"},
description = "Help plugin. Get info from other plugins. ",
usage = {
"!help: Show all the help",
"!help md: Generate a GitHub Markdown table"
},
patterns = {
"^!help$",
"^!help md$"

View File

@ -25,8 +25,8 @@ function run(msg, matches)
end
return {
description = "search image with Google API and sends it",
usage = "!img [topic]",
description = "Search image with Google API and sends it.",
usage = "!img [term]: Random search an image with Google API.",
patterns = {"^!img (.*)$"},
run = run
}

View File

@ -64,7 +64,7 @@ end
return {
description = "Gets information about a location, maplink and overview",
usage = "!loc (location)",
usage = "!loc (location): Gets information about a location, maplink and overview",
patterns = {"^!loc (.*)$"},
run = run
}

View File

@ -100,12 +100,12 @@ function run(msg, matches)
end
return {
description = "Enables, disables and reloads plugins. Privileged users only.",
description = "Plugin to manage other plugins. Enable, disable or reload.",
usage = {
"!plugins: list all plugins",
"!plugins enable [plugin]",
"!plugins disable [plugin]",
"!plugins reload" },
"!plugins enable [plugin]: enable plugin",
"!plugins disable [plugin]: disable plugin",
"!plugins reload: reloads all plugins" },
patterns = {
"^!plugins$",
"^!plugins? (enable) (.*)$",

View File

@ -41,7 +41,7 @@ end
return {
description = "Spanish dictionary",
usage = "!rae [word]",
usage = "!rae [word]: Search that word in Spanish dictionary. Powered by https://github.com/javierhonduco/dulcinea",
patterns = {"^!rae (.*)$"},
run = run
}

View File

@ -23,8 +23,8 @@ function run(msg, matches)
end
return {
description = "Set value",
usage = "!set [value_name] [data]",
description = "Plugin for saving values. get.lua plugin is necesary to retrieve them.",
usage = "!set [value_name] [data]: Saves the data with the value_name name.",
patterns = {"^!set (%a+) (.+)$"},
run = run
}

View File

@ -102,8 +102,8 @@ end
_stats = read_file_stats()
return {
description = "Number of messages by user",
usage = "!stats",
description = "Plugin to update user stats.",
usage = "!stats: Returns a list of Username [telegram_id]: msg_num",
patterns = {
".*",
"^!(stats)"

View File

@ -94,7 +94,7 @@ end
return {
description = "Displays the local time in an area",
usage = "!time [area]",
usage = "!time [area]: Displays the local time in that area",
patterns = {"^!time (.*)$"},
run = run
run = run
}

View File

@ -44,7 +44,7 @@ end
return {
description = "Sends a tweet",
usage = "!tw [text]",
usage = "!tw [text]: Sends the Tweet with the configured accout.",
patterns = {"^!tw (.+)"},
run = run
}

View File

@ -7,8 +7,10 @@ end
return {
description = "Shows bot version",
usage = "!version",
patterns = {"^!version$"},
usage = "!version: Shows bot version",
patterns = {
"^!version$"
},
run = run
}