Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do
- function custom_func(cb_extra, success, result)
- if success then
- local start_time = cb_extra[2]
- local file_path = cb_extra[3].file_path
- local end_time = os.time()
- local elapsed_time = os.difftime(end_time,start_time)
- local message = "Elapsed Time: "..os.difftime(end_time,start_time).." second(s)"
- send_msg(cb_extra[1], message, ok_cb, false)
- if file_path ~= nil then
- os.remove(file_path)
- print("Deleted: "..file_path)
- end
- end
- end
- local function DownUp(receiver, url, ext)
- local start_time = os.time()
- local file = download_to_file(url)
- local cb_extra = {file_path=file}
- print('send_file')
- send_file(receiver, file, custom_func, {receiver, start_time, cb_extra})
- end
- local function run(msg,matches)
- DownUp(get_receiver(msg), matches[1], matches[2])
- end
- return {
- description = "Download and reupload requested file ",
- usage = "",
- patterns = {
- "!download (https?://[%w-_%.%?%.:/%+=&]+%.(.*))$"
- },
- run = run,
- hide = true,
- privileged = true
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement