2015-03-04 23:51:36 +01:00
|
|
|
do
|
2014-11-20 23:30:41 +01:00
|
|
|
|
|
|
|
function run(msg, matches)
|
2015-04-14 20:21:23 +02:00
|
|
|
local receiver = get_receiver(msg)
|
2015-03-31 20:17:14 +02:00
|
|
|
local file = download_to_file(matches[1])
|
2015-04-02 23:45:45 +02:00
|
|
|
send_document(get_receiver(msg), file, ok_cb, false)
|
2014-11-20 23:30:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
2015-03-04 23:51:36 +01:00
|
|
|
description = "When user sends media URL (ends with gif, mp4, pdf, etc.) download and send it to origin.",
|
|
|
|
usage = "",
|
|
|
|
patterns = {
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.gif)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.mp4)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.pdf)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.ogg)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.zip)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.mp3)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.rar)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.wmv)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.doc)$",
|
2015-04-14 20:21:23 +02:00
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.tar.gz)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.dlc)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.txt)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.deb)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.webm)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.avi)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.wav)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.exe)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.rpm)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.dmg)$",
|
|
|
|
"(https?://[%w-_%.%?%.:/%+=&]+%.apk)$"
|
2015-03-04 23:51:36 +01:00
|
|
|
},
|
|
|
|
run = run
|
2015-03-04 23:14:39 +01:00
|
|
|
}
|
2015-03-04 23:51:36 +01:00
|
|
|
|
2015-04-14 20:21:23 +02:00
|
|
|
end
|