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* __' end cowsay.command = 'cowsay ' function cowsay:inline_callback(inline_query, config, matches) local input = matches[1] if string.match(input, '"') then abort_inline_query(inline_query) return end local text = '```'..run_command('cowsay "'..input..'"')..'```' local text = text:gsub('\\', '\\\\') local results = '[{"type":"article","id":"7912","title":"Muh!","description":"'..input..'","thumb_url":"http://img.ponywave.de/di/DQG2/cow.jpg","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}}]' utilities.answer_inline_query(inline_query, results, 2) end function cowsay:action(msg, config) local input = utilities.input_from_msg(msg) if not input then utilities.send_reply(msg, cowsay.doc, true) return end if string.match(input, '"') then text = 'Vergiss es!' else text = '```'..run_command('cowsay "'..input..'"')..'```' end utilities.send_reply(msg, text, true) end return cowsay