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
Akamaru 2c8c66cce3 tts verwendet nun Baidu (nur Englisch)
Shimakaze zum NSFW-Rpic-Plugin hinzugefügt
2016-04-07 19:46:11 +02:00

41 lines
1.1 KiB
Lua

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"] = "../Bilder/Mikubot/nsfw/",
["/nsfw gif"] = "../Bilder/Mikubot/nsfw/gifs/",
["/nsfw shimakaze"] = "../Bilder/Mikubot/nsfw/Shimakaze/"
}
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") then
send_document(receiver, img, function() end, function() end)
elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
send_photo(receiver, img, function() end, function() end)
else
return "Fehler: " .. img
end
else
return '"'..imgtype..'" gibt es nicht.\n/nsfw\n/nsfw gif\n/nsfw shimakaze'
end
end
return {
description = "Sendet ein zufälliges Bild (NSFW)",
usage = {"/nsfw","/nsfw gif","/nsfw shimakaze"},
patterns = {"^/nsfw$","^/nsfw gif$","^/nsfw shimakaze$"},
run = run
}
end