Acciones HTTP llevadas a plugins
This commit is contained in:
18
plugins/gifs.lua
Normal file
18
plugins/gifs.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
function send_file_from_url (msg, url)
|
||||
last = string.get_last_word(ul)
|
||||
file = download_to_file(last)
|
||||
send_document(get_receiver(msg), file, ok_cb, false)
|
||||
end
|
||||
|
||||
function run(msg, matches)
|
||||
send_file_from_url(msg, matches[1])
|
||||
end
|
||||
|
||||
return {
|
||||
description = "from gif URL downloads it and sends to origin",
|
||||
usage = "",
|
||||
patterns = {
|
||||
"(https?://[%w-_%.%?%.:/%+=&]+.gif)$"
|
||||
},
|
||||
run = run
|
||||
}
|
22
plugins/images.lua
Normal file
22
plugins/images.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
function send_image_from_url (msg)
|
||||
last = string.get_last_word(msg.text)
|
||||
file = download_to_file(last)
|
||||
print("I will send the image " .. file)
|
||||
send_photo(get_receiver(msg), file, ok_cb, false)
|
||||
end
|
||||
|
||||
function run(msg, matches)
|
||||
send_image_from_url(msg)
|
||||
end
|
||||
|
||||
return {
|
||||
description = "from image URL downloads it and sends to origin",
|
||||
usage = "",
|
||||
patterns = {
|
||||
"(https?://[%w-_%.%?%.:/%+=&]+.png)$",
|
||||
"(https?://[%w-_%.%?%.:/%+=&]+.jpg)$",
|
||||
"(https?://[%w-_%.%?%.:/%+=&]+.jpeg)$",
|
||||
},
|
||||
run = run
|
||||
}
|
20
plugins/youtube.lua
Normal file
20
plugins/youtube.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user