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! ["test"] = "../Festplatten/Dragoran/Mikubot/sfw/test/", ["anime"] = "../Festplatten/Dragoran/Mikubot/sfw/anime/", ["mlp"] = "../Festplatten/Dragoran/Mikubot/sfw/mlp/", ["doge"] = "../Festplatten/Dragoran/Mikubot/sfw/doge/", ["faktillon"] = "../Festplatten/Dragoran/Mikubot/sfw/faktillon/", ["faktastisch"] = "../Festplatten/Dragoran/Mikubot/sfw/faktastisch/", ["gamefakt"] = "../Festplatten/Dragoran/Mikubot/sfw/gamefakt/", ["faktglaublich"] = "../Festplatten/Dragoran/Mikubot/sfw/faktglaublich/" } 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 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.\nEs gibt:\nanime\nmlp\ndoge\nfaktillon\nfaktastisch\ngamefakt\nfaktglaublich' end end return { description = "Sendet ein zufälliges Bild", usage = {"#rpic [Thema]","Themen:","anime","mlp","doge","faktillon","faktastisch","gamefakt","faktglaublich"}, patterns = {"^#rpic (.*)$"}, run = run } end