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/plugins/media.lua

24 lines
755 B
Lua
Raw Normal View History

2014-11-20 23:30:41 +01:00
function run(msg, matches)
file = download_to_file(matches[1])
send_document(get_receiver(msg), file, ok_cb, false)
end
return {
2014-11-22 15:05:54 +01:00
description = "When user sends media URL (ends with gif, mp4, pdf, etc.) download and send it to origin.",
2014-11-20 23:30:41 +01:00
usage = "",
patterns = {
2015-03-04 23:14:39 +01:00
"(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)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.avi)$"
2014-11-20 23:30:41 +01:00
},
run = run
2015-03-04 23:14:39 +01:00
}