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

43 lines
1.4 KiB
Lua
Raw Normal View History

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)
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-04-20 18:52:25 +02:00
description = "Wenn ein Link zu einer Datei gesendet wird, läd und sendet der Bot die Datei.",
usage = "Link zur Datei",
2015-03-04 23:51:36 +01:00
patterns = {
"(https?://[%w-_%.%?%.:/%+=&]+%.gif)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.mp4)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.pdf)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.ogg)$",
2015-04-16 20:13:42 +02:00
"(https?://[%w-_%.%?%.:/%+=&]+%.ogv)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.oga)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.ogx)$",
2015-03-04 23:51:36 +01:00
"(https?://[%w-_%.%?%.:/%+=&]+%.zip)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.mp3)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.rar)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.wmv)$",
2015-04-16 20:13:42 +02:00
"(https?://[%w-_%.%?%.:/%+=&]+%.wma)$",
2015-03-04 23:51:36 +01:00
"(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)$",
2015-04-16 20:13:42 +02:00
"(https?://[%w-_%.%?%.:/%+=&]+%.apk)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.ipa)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.webp)$"
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