2016-04-11 06:04:47 +02:00
|
|
|
local echo = {}
|
|
|
|
|
2016-06-07 06:31:34 +02:00
|
|
|
local utilities = require('otouto.utilities')
|
2016-04-11 06:04:47 +02:00
|
|
|
|
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)
|
|
|
|
local text = matches[1]
|
|
|
|
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
|
|
|
|
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"}},'
|
|
|
|
end
|
|
|
|
|
|
|
|
local results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fett.jpg","title":"Fett","description":"*'..text..'*","input_message_content":{"message_text":"*'..text..'*","parse_mode":"Markdown"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/kursiv.jpg","title":"Kursiv","description":"_'..text..'_","input_message_content":{"message_text":"_'..text..'_","parse_mode":"Markdown"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fixedsys.jpg","title":"Feste Breite","description":"`'..text..'`","input_message_content":{"message_text":"`'..text..'`","parse_mode":"Markdown"}}]'
|
|
|
|
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)
|
|
|
|
local input = utilities.input(msg.text)
|
|
|
|
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) .. '"'
|
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
|