random_pic plugins with error message
This commit is contained in:
parent
6c2d953c93
commit
510184e398
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user