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_data.lua

27 lines
668 B
Lua
Raw Normal View History

local get_data = {}
function get_data:init(config)
get_data.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('wget', true).table
get_data.doc = '\n*/wget* _<URL>_'
end
2016-08-25 15:22:41 +02:00
get_data.command = 'wget <URL>'
function get_data:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
2016-08-24 17:18:17 +02:00
utilities.send_reply(msg, get_data.doc, true)
return
end
2016-08-24 17:18:17 +02:00
utilities.send_typing(msg.chat.id, 'upload_document')
local file = download_to_file(input)
if not file then
2016-08-24 17:18:17 +02:00
utilities.send_reply(msg, config.errors.connection)
return
end
2016-08-24 17:18:17 +02:00
utilities.send_document(msg.chat.id, file, nil, msg.message_id)
end
return get_data