From 0f2e1460cb7ebbb24a4070915cf228516dea7c44 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Wed, 13 Jul 2016 01:21:50 +0200 Subject: [PATCH] =?UTF-8?q?-=20Echo:=20Fix=20f=C3=BCr=20Anf=C3=BChrungszei?= =?UTF-8?q?chen=20in=20InlineQuerys=20-=20Core:=20Kennzeichne=20Inline-Que?= =?UTF-8?q?rys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/bot.lua | 2 +- otouto/plugins/echo.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/otouto/bot.lua b/otouto/bot.lua index d468e56..e0b16f0 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -225,7 +225,7 @@ function match_inline_plugins(self, inline_query, config, plugin) break; end end - print(plugin.name..' triggered') + print('Inline: '..plugin.name..' triggered') return plugin.inline_callback(self, inline_query, config, matches) end) if not success then diff --git a/otouto/plugins/echo.lua b/otouto/plugins/echo.lua index aff73d8..8cbd862 100644 --- a/otouto/plugins/echo.lua +++ b/otouto/plugins/echo.lua @@ -16,7 +16,10 @@ end function echo:inline_callback(inline_query, config, matches) local text = matches[1] local results = '[' - + if text:match('"') then + text = text:gsub('"', '\\"') + end + -- enable custom markdown button if text:match('%[.*%]%(.*%)') or text:match('%*.*%*') or text:match('_.*_') or text:match('`.*`') then results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/custom.jpg","title":"Eigenes Markdown","description":"'..text..'","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}},'