This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/miku/plugins/get_img.lua

27 lines
667 B
Lua

local get_img = {}
function get_img:init(config)
get_img.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('getimg', true).table
get_img.doc = '\n*/getimg* _<URL>_'
end
get_img.command = 'getimg <URL>'
function get_img:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(msg, get_img.doc, true)
return
end
utilities.send_typing(msg.chat.id, 'upload_photo')
local img_url = download_to_file(input)
if not img_url then
utilities.send_reply(msg, config.errors.connection)
return
end
utilities.send_photo(msg.chat.id, input, nil, msg.message_id)
end
return get_img