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/youtube.lua
2014-11-04 22:39:14 +01:00

20 lines
484 B
Lua

function send_youtube_thumbnail(msg, yt_code)
yt_thumbnail = "http://img.youtube.com/vi/".. yt_code .."/hqdefault.jpg"
file = download_to_file(yt_thumbnail)
send_photo(get_receiver(msg), file, ok_cb, false)
end
function run(msg, matches)
send_youtube_thumbnail(msg, matches[1])
end
return {
description = "sends YouTube image",
usage = "",
patterns = {
"youtu.be/([A-Za-z0-9-]+)",
"youtube.com/watch%?v=([A-Za-z0-9-]+)",
},
run = run
}