local cowsay = {}
function cowsay:init(config)
cowsay.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('cowsay', true).table
cowsay.inline_triggers = {'^cow (.+)$'}
cowsay.doc = '\n*/cowsay* _<Text>_'
end
cowsay.command = 'cowsay <Text>'
function cowsay:inline_callback(inline_query, config, matches)
local input = matches[1]
if string.match(input, '"') then utilities.answer_inline_query(self, inline_query) return end
local text = '```'..run_command('cowsay "'..input..'"')..'```'
local text = text:gsub('\\', '\\\\')
local results = '[{"type":"article","id":"7912","title":"Muh!","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}}]'
utilities.answer_inline_query(self, inline_query, results, 2)
function cowsay:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, cowsay.doc, true)
return
if string.match(input, '"') then
text = 'Vergiss es!'
else
text = '```'..run_command('cowsay "'..input..'"')..'```'
utilities.send_reply(self, msg, text, true)
return cowsay