From 93b1a1eab2768d7e74d946b0175dd61329803789 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Thu, 8 Sep 2016 16:50:42 +0200 Subject: [PATCH] =?UTF-8?q?Fixes=20f=C3=BCr=20CallbackQuerys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/bot.lua | 6 ++++-- otouto/plugins/pocket.lua | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/otouto/bot.lua b/otouto/bot.lua index 4bdb26f..5c9a63f 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -132,7 +132,7 @@ function bot:on_callback_receive(callback, msg, config) -- whenever a new callba -- Check if whitelist is enabled and user/chat is whitelisted local whitelist = redis:get('whitelist:enabled') - if whitelist and not is_sudo(msg, config) then + if whitelist and not is_sudo(callback, config) then local hash = 'whitelist:user#id'..user_id local allowed = redis:get(hash) or false if not allowed then @@ -160,10 +160,12 @@ function bot:on_callback_receive(callback, msg, config) -- whenever a new callba for n=1, #self.plugins do local plugin = self.plugins[n] if plugin.name == called_plugin then - if is_plugin_disabled_on_chat(plugin.name, msg) then return end + if is_plugin_disabled_on_chat(plugin.name, msg) then utilities.answer_callback_query(callback, 'Plugin wurde in diesem Chat deaktiviert.') return end plugin:callback(callback, msg, self, config, param) end end + + utilities.answer_callback_query(callback, 'Ungültiger CallbackQuery: Kein Plugin gefunden.') end -- NOTE: To enable InlineQuerys, send /setinline to @BotFather diff --git a/otouto/plugins/pocket.lua b/otouto/plugins/pocket.lua index beb69af..6d07a16 100644 --- a/otouto/plugins/pocket.lua +++ b/otouto/plugins/pocket.lua @@ -74,6 +74,7 @@ function pocket:add_pocket_item(access_token, url) local code = result.item.response_code local text = title..' ('..given_url..') hinzugefügt!' + if not code then return text end if code ~= "200" and code ~= "0" then text = text..'\nAber die Seite liefert Fehler '..code..' zurück.' end return text end