From 33ea8a0876d564ee872356e4b8f22b0b42b99d46 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Mon, 8 Aug 2016 17:23:36 +0200 Subject: [PATCH] Weitere Optimierungen --- otouto/bot.lua | 3 --- otouto/plugins/help.lua | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/otouto/bot.lua b/otouto/bot.lua index 8a69333..d146b6a 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -203,9 +203,6 @@ function match_inline_plugins(self, inline_query, config, plugin) print('Inline: '..plugin.name..' triggered') return plugin.inline_callback(self, inline_query, config, matches) end) - if not success then - print(result) - end end end end diff --git a/otouto/plugins/help.lua b/otouto/plugins/help.lua index f890e13..f7796a3 100644 --- a/otouto/plugins/help.lua +++ b/otouto/plugins/help.lua @@ -21,7 +21,8 @@ end function help:inline_callback(inline_query, config, matches) local query = matches[1] - for _,plugin in ipairs(self.plugins) do + for n=1, #self.plugins do + local plugin = self.plugins[n] if plugin.command and utilities.get_word(plugin.command, 1) == query and plugin.doc then local doc = plugin.doc local doc = doc:gsub('"', '\\"') @@ -49,7 +50,8 @@ function help:action(msg, config, matches) if not input then local commandlist = {} local help_text = '*Verfügbare Befehle:*\n• '..config.cmd_pat - for _,plugin in ipairs(self.plugins) do + for n=1, #self.plugins do + local plugin = self.plugins[n] if plugin.command then commandlist[#commandlist+1] = plugin.command end @@ -69,7 +71,8 @@ function help:action(msg, config, matches) return end - for _,plugin in ipairs(self.plugins) do + for n=1, #self.plugins do + local plugin = self.plugins[n] if plugin.command and utilities.get_word(plugin.command, 1) == input and plugin.doc then local output = '*Hilfe für* _' .. utilities.get_word(plugin.command, 1) .. '_ *:*' .. plugin.doc utilities.send_message(self, msg.chat.id, output, true, nil, true)