2016-04-11 06:04:47 +02:00
|
|
|
local echo = {}
|
|
|
|
|
2016-06-20 19:11:31 +02:00
|
|
|
echo.command = 'echo <Text>'
|
2016-05-27 05:28:44 +02:00
|
|
|
|
|
|
|
function echo:init(config)
|
|
|
|
echo.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('echo', true).table
|
2016-07-13 01:00:32 +02:00
|
|
|
echo.inline_triggers = {
|
2016-07-17 17:45:20 +02:00
|
|
|
"^e (.+)",
|
|
|
|
"^bold (.+)"
|
2016-07-13 01:00:32 +02:00
|
|
|
}
|
2016-06-20 19:11:31 +02:00
|
|
|
echo.doc = [[*
|
|
|
|
]]..config.cmd_pat..[[echo* _<Text>_: Gibt den Text aus]]
|
2016-04-11 06:04:47 +02:00
|
|
|
end
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-07-13 01:00:32 +02:00
|
|
|
function echo:inline_callback(inline_query, config, matches)
|
2016-08-03 16:32:24 +02:00
|
|
|
local text = matches[1]
|
2016-07-13 01:00:32 +02:00
|
|
|
local results = '['
|
2016-07-13 01:21:50 +02:00
|
|
|
|
2016-07-13 01:00:32 +02:00
|
|
|
-- enable custom markdown button
|
|
|
|
if text:match('%[.*%]%(.*%)') or text:match('%*.*%*') or text:match('_.*_') or text:match('`.*`') then
|
2016-08-07 21:20:48 +02:00
|
|
|
results = results..'{"type":"article","id":"3","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"}},'
|
2016-07-13 01:00:32 +02:00
|
|
|
end
|
|
|
|
|
2016-08-07 21:20:48 +02:00
|
|
|
local results = results..'{"type":"article","id":"4","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fett.jpg","title":"Fett","description":"*'..text..'*","input_message_content":{"message_text":"<b>'..text..'</b>","parse_mode":"HTML"}},{"type":"article","id":"5","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/kursiv.jpg","title":"Kursiv","description":"_'..text..'_","input_message_content":{"message_text":"<i>'..text..'</i>","parse_mode":"HTML"}},{"type":"article","id":"6","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fixedsys.jpg","title":"Feste Breite","description":"`'..text..'`","input_message_content":{"message_text":"<code>'..text..'</code>","parse_mode":"HTML"}}]'
|
2016-07-13 01:00:32 +02:00
|
|
|
utilities.answer_inline_query(self, inline_query, results, 0)
|
|
|
|
end
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-07-13 01:00:32 +02:00
|
|
|
function echo:action(msg)
|
2016-08-14 16:30:06 +02:00
|
|
|
local input = utilities.input_from_msg(msg)
|
2016-07-13 01:00:32 +02:00
|
|
|
if not input then
|
|
|
|
utilities.send_message(self, msg.chat.id, echo.doc, true, msg.message_id, true)
|
|
|
|
else
|
|
|
|
local output
|
|
|
|
if msg.chat.type == 'supergroup' then
|
|
|
|
output = '*Echo:*\n"' .. utilities.md_escape(input) .. '"'
|
2016-07-31 21:29:44 +02:00
|
|
|
utilities.send_message(self, msg.chat.id, output, true, nil, true)
|
|
|
|
return
|
2015-11-25 03:22:04 +01:00
|
|
|
end
|
2016-07-13 01:00:32 +02:00
|
|
|
utilities.send_message(self, msg.chat.id, input, true, nil, true)
|
|
|
|
end
|
2015-07-03 00:15:52 +02:00
|
|
|
end
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
return echo
|