This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/plugins/help.lua
topkecleon 60570e90f3 added cron jobs for plugins
added example plugin with documentation
added liberbot-compliant flood control
	see Liberbot Support for details on getting compliant
added Kickass Torrent plugin
various bugfixes
all files seem to have been marked changed due to a shift in platform
	I will do a clean clone and testing to ensure there is no issue.
2015-08-28 23:15:01 -07:00

46 lines
1012 B
Lua
Executable File

local PLUGIN = {}
PLUGIN.doc = [[
/help [command]
Get list of basic information for all commands, or more detailed documentation on a specified command.
]]
PLUGIN.triggers = {
'^/help',
'^/h$',
'^/start$'
}
function PLUGIN.action(msg)
if string.find(msg.text, '@') and not string.match(msg.text, 'help@'..bot.username) then return end
local input = get_input(msg.text)
if input then
for i,v in ipairs(plugins) do
if v.doc then
if '/' .. input == trim_string(first_word(v.doc)) then
return send_msg(msg, v.doc)
end
end
end
end
local message = 'Available commands:\n' .. help_message .. [[
*Arguments: <required> [optional]
]]
if msg.from.id ~= msg.chat.id then
if not send_message(msg.from.id, message, true, msg.message_id) then
return send_msg(msg, message) -- Unable to PM user who hasn't PM'd first.
end
return send_msg(msg, 'I have sent you the requested information in a private message.')
else
return send_msg(msg, message)
end
end
return PLUGIN