30 lines
860 B
Lua
30 lines
860 B
Lua
|
local dogify = {}
|
||
|
|
||
|
function dogify:init(config)
|
||
|
dogify.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('dogify', true).table
|
||
|
dogify.doc = [[*
|
||
|
]]..config.cmd_pat..[[dogify* _text/den/du/willst_: Wow, much doge!
|
||
|
]]
|
||
|
end
|
||
|
|
||
|
dogify.command = 'dogify text/den/du/willst'
|
||
|
|
||
|
function dogify:action(msg, config, matches)
|
||
|
local input = utilities.input_from_msg(msg)
|
||
|
if not input then
|
||
|
utilities.send_reply(self, msg, dogify.doc, true)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
utilities.send_typing(self, msg.chat.id, 'upload_photo')
|
||
|
local path = input:gsub(" ", "%%20")
|
||
|
local photo_url = 'http://dogr.io/'..path..'.png?split=false&.png'
|
||
|
local file = download_to_file(photo_url)
|
||
|
if not file then
|
||
|
utilities.send_reply(self, msg, config.errors.connection)
|
||
|
return
|
||
|
end
|
||
|
utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id)
|
||
|
end
|
||
|
|
||
|
return dogify
|