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/random_pic_nsfw.lua

42 lines
1.2 KiB
Lua
Raw Normal View History

2015-08-10 15:18:55 +02:00
do
function get_random_image(dir)
files = scandir(dir)
file = files[math.random(#files)]
return file
end
function run(msg, matches)
local pics = {
-- add more below!
["#nsfw"] = "../Festplatten/Dragoran/Mikubot/nsfw/",
["#nsfw gif"] = "../Festplatten/Dragoran/Mikubot/nsfw/gifs/",
["#nsfw rl"] = "../Festplatten/Dragoran/Mikubot/nsfw/rl/",
["#nsfw shimakaze"] = "../Festplatten/Dragoran/Mikubot/nsfw/Shimakaze/"
2015-08-10 15:18:55 +02:00
}
local receiver = get_receiver(msg)
local imgtype = matches[1]
if pics[imgtype] then
local img = pics[imgtype]..get_random_image(pics[imgtype])
print("Sende... "..img)
if string.ends(img, ".gif") or string.ends(img, ".mp4") then
2015-08-10 15:18:55 +02:00
send_document(receiver, img, function() end, function() end)
2015-08-19 15:16:44 +02:00
elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
2015-08-10 15:18:55 +02:00
send_photo(receiver, img, function() end, function() end)
2015-08-19 15:16:44 +02:00
else
return "Fehler: " .. img
2015-08-10 15:18:55 +02:00
end
2015-08-19 15:16:44 +02:00
else
return '"'..imgtype..'" gibt es nicht.\n#nsfw\n#nsfw gif\n#nsfw rl\n#nsfw shimakaze'
2015-08-10 15:18:55 +02:00
end
end
return {
description = "Sendet ein zufälliges Bild (NSFW)",
usage = {"#nsfw","#nsfw gif","#nsfw rl","#nsfw shimakaze"},
patterns = {"^#nsfw$","^#nsfw gif$","^#nsfw rl$","^#nsfw shimakaze$"},
2015-08-10 15:18:55 +02:00
run = run
}
2016-04-01 22:11:30 +02:00
end