random_pic plugins with error message

This commit is contained in:
Akamaru 2015-08-19 15:16:44 +02:00
parent 6c2d953c93
commit 510184e398
2 changed files with 15 additions and 6 deletions

View File

@ -7,10 +7,11 @@ end
function run(msg, matches) function run(msg, matches)
local pics = { local pics = {
-- add more below! -- add more below!
["anime"] = "/home/pi/USB/sfw/anime/", ["test"] = "../USB/test/",
["mlp"] = "/home/pi/USB/sfw/mlp/" ["anime"] = "../USB/sfw/anime/",
} ["mlp"] = "../USB/sfw/mlp/"
}
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
local imgtype = matches[1] local imgtype = matches[1]
@ -20,9 +21,13 @@ function run(msg, matches)
print("Sende... "..img) print("Sende... "..img)
if string.ends(img, ".gif") then if string.ends(img, ".gif") then
send_document(receiver, img, function() end, function() end) send_document(receiver, img, function() end, function() end)
else elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
send_photo(receiver, img, function() end, function() end) send_photo(receiver, img, function() end, function() end)
else
return "Fehler: " .. img
end end
else
return '"'..imgtype..'" gibt es nicht.\nEs gibt:\nanime\nmlp'
end end
end end

View File

@ -19,9 +19,13 @@ function run(msg, matches)
print("Sende... "..img) print("Sende... "..img)
if string.ends(img, ".gif") then if string.ends(img, ".gif") then
send_document(receiver, img, function() end, function() end) send_document(receiver, img, function() end, function() end)
else elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
send_photo(receiver, img, function() end, function() end) send_photo(receiver, img, function() end, function() end)
else
return "Fehler: " .. img
end end
else
return '"'..imgtype..'" gibt es nicht.\n'
end end
end end