This commit is contained in:
dupie 2015-07-04 10:54:41 -04:00
parent 5a3d3e282a
commit 46fa425f5a
3 changed files with 11 additions and 10 deletions

View File

@ -57,7 +57,7 @@ function bot_init()
print('Done! Plugins loaded: ' .. #plugins .. '\n')
print('Generating help message...')
help_message = 'Available commands:\n'
help_message = ''
for i,v in ipairs(plugins) do
if v.doc then
local a = string.sub(v.doc, 1, string.find(v.doc, '\n')-1)
@ -65,11 +65,6 @@ function bot_init()
help_message = help_message .. ' - ' .. a .. '\n'
end
end
help_message = help_message .. [[
*Arguments: <required> [optional]
Use "!help <command>" for specific information.
otouto v]] .. VERSION .. [[ by @topkecleon.
]]
print('Help message generated!\n')

View File

@ -25,13 +25,19 @@ function PLUGIN.action(msg)
end
end
local message = 'Available commands:\n' .. help_message .. [[
*Arguments: <required> [optional]
Use "!help <command>" for specific information.
otouto v]] .. VERSION .. [[ by @topkecleon.
]]
if msg.from.id ~= msg.chat.id then
if not send_message(msg.from.id, help_message, true, msg.message_id) then
return send_msg(msg, help_message) -- Unable to PM user who hasn't PM'd first.
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, help_message)
return send_msg(msg, message)
end
end

View File

@ -108,7 +108,7 @@ function PLUGIN.action(msg)
slapper = bot.username
end
local message = latcyr(PLUGIN.getSlap(slapper, victim))
local message = PLUGIN.getSlap(slapper, victim)
send_message(msg.chat.id, latcyr(message))
end