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
|
|
|
|
|
|
|
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-25 11:03:35 +02:00
|
|
|
echo.doc = config.cmd_pat .. 'echo <text> \nRepeats a string of text.'
|
2016-04-11 06:04:47 +02:00
|
|
|
end
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
function echo:action(msg)
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-04-08 23:12:02 +02:00
|
|
|
local input = utilities.input(msg.text)
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-03-24 00:54:18 +01:00
|
|
|
if not input then
|
2016-05-29 19:08:39 +02:00
|
|
|
utilities.send_message(self, msg.chat.id, echo.doc, true, msg.message_id, true)
|
2016-03-24 00:54:18 +01:00
|
|
|
else
|
|
|
|
local output
|
|
|
|
if msg.chat.type == 'supergroup' then
|
2016-04-29 06:12:04 +02:00
|
|
|
output = '*Echo:*\n"' .. utilities.md_escape(input) .. '"'
|
2016-03-24 00:54:18 +01:00
|
|
|
else
|
2016-05-20 09:38:43 +02:00
|
|
|
output = utilities.md_escape(utilities.char.zwnj..input)
|
2016-03-24 00:54:18 +01:00
|
|
|
end
|
2016-05-29 19:08:39 +02:00
|
|
|
utilities.send_message(self, msg.chat.id, output, true, nil, true)
|
2015-11-25 03:22:04 +01:00
|
|
|
end
|
2015-07-03 00:15:52 +02:00
|
|
|
|
2016-03-24 00:54:18 +01:00
|
|
|
|
2015-07-03 00:15:52 +02:00
|
|
|
end
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
return echo
|