2015-07-03 00:15:52 +02:00
|
|
|
local PLUGIN = {}
|
|
|
|
|
|
|
|
PLUGIN.doc = [[
|
2015-07-08 09:38:04 +02:00
|
|
|
/help [command]
|
2015-07-03 00:15:52 +02:00
|
|
|
Get list of basic information for all commands, or more detailed documentation on a specified command.
|
|
|
|
]]
|
|
|
|
|
|
|
|
PLUGIN.triggers = {
|
2015-07-08 09:38:04 +02:00
|
|
|
'^/help',
|
|
|
|
'^/h$',
|
2015-07-08 22:01:15 +02:00
|
|
|
'^/start$'
|
2015-07-03 00:15:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function PLUGIN.action(msg)
|
|
|
|
|
2015-07-08 09:46:03 +02:00
|
|
|
if string.find(msg.text, '@') and not string.match(msg.text, 'help@'..bot.username) then return end
|
2015-07-08 04:24:12 +02:00
|
|
|
|
2015-07-03 00:15:52 +02:00
|
|
|
local input = get_input(msg.text)
|
|
|
|
|
|
|
|
if input then
|
|
|
|
for i,v in ipairs(plugins) do
|
|
|
|
if v.doc then
|
2015-07-09 01:59:35 +02:00
|
|
|
if '/' .. input == trim_string(first_word(v.doc)) then
|
2015-07-03 00:15:52 +02:00
|
|
|
return send_msg(msg, v.doc)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-07-04 16:54:41 +02:00
|
|
|
local message = 'Available commands:\n' .. help_message .. [[
|
|
|
|
*Arguments: <required> [optional]
|
|
|
|
Use "!help <command>" for specific information.
|
|
|
|
otouto v]] .. VERSION .. [[ by @topkecleon.
|
2015-07-08 04:24:12 +02:00
|
|
|
Fork me on github! github.com/topkecleon/otouto
|
2015-07-04 16:54:41 +02:00
|
|
|
]]
|
|
|
|
|
2015-07-03 00:15:52 +02:00
|
|
|
if msg.from.id ~= msg.chat.id then
|
2015-07-04 16:54:41 +02:00
|
|
|
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.
|
2015-07-03 00:15:52 +02:00
|
|
|
end
|
|
|
|
return send_msg(msg, 'I have sent you the requested information in a private message.')
|
|
|
|
else
|
2015-07-04 16:54:41 +02:00
|
|
|
return send_msg(msg, message)
|
2015-07-03 00:15:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return PLUGIN
|