From 46fa425f5af852f5c0029b79a5616d955d8fb90f Mon Sep 17 00:00:00 2001 From: dupie Date: Sat, 4 Jul 2015 10:54:41 -0400 Subject: [PATCH] bugfixes --- bot.lua | 7 +------ plugins/help.lua | 12 +++++++++--- plugins/slap.lua | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bot.lua b/bot.lua index 2df7a2a..2df2b9f 100644 --- a/bot.lua +++ b/bot.lua @@ -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: [optional] - Use "!help " for specific information. - otouto v]] .. VERSION .. [[ by @topkecleon. - ]] print('Help message generated!\n') diff --git a/plugins/help.lua b/plugins/help.lua index 63750c1..3209bd0 100644 --- a/plugins/help.lua +++ b/plugins/help.lua @@ -25,13 +25,19 @@ function PLUGIN.action(msg) end end + local message = 'Available commands:\n' .. help_message .. [[ + *Arguments: [optional] + Use "!help " 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 diff --git a/plugins/slap.lua b/plugins/slap.lua index 5d2ff39..9e9a0b8 100644 --- a/plugins/slap.lua +++ b/plugins/slap.lua @@ -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