diff --git a/plugins/dicks.lua b/plugins/dicks.lua new file mode 100644 index 0000000..cf2d98f --- /dev/null +++ b/plugins/dicks.lua @@ -0,0 +1,44 @@ + +do + + +local dicks = { + "http://i.imgur.com/A5IdNU7.jpg", + "http://i.imgur.com/0pEACyI.jpg", + "http://i.imgur.com/x2NNn9P.jpg", + "http://i.imgur.com/9FA7NJr.jpg", + "http://t.co/7LOy7LNSzV", +} + + +function getRandomDicks() + return dicks[ math.random( #dicks ) ] +end + + +function run(msg, matches) + local url = nil + url = getRandomDicks() + + if url ~= nil then + local receiver = get_receiver(msg) + send_photo_from_url(receiver, url) + else + return 'Error getting dicks for you, please try again later.' + end +end + + +return { + description = "Gets a random dicks pic", + usage = { + "/dicks: Get a dicks NSFW image. 🔞" + }, + patterns = { + "^/dicks$" + }, + run = run +} + + +end diff --git a/plugins/wallpaper.lua b/plugins/wallpaper.lua new file mode 100644 index 0000000..d32c222 --- /dev/null +++ b/plugins/wallpaper.lua @@ -0,0 +1,50 @@ + +do + +function getWallpaper(text) + local text = URL.escape(text) + local api = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&safe=active&tbs=isz:l&tbm=isch&q=wallpaper+" + local res, code = http.request(api..text) + if code ~= 200 then return nil end + local google = json:decode(res) + + if google.responseStatus ~= 200 then + return nil + end + + local data = google.responseData + + if not data or not data.results then + return nil + end + + if #data.results == 0 then + return nil + end + + -- Random image from table + local i = math.random(#data.results) + return data.results[i].url +end + +function run(msg, matches) + local receiver = get_receiver(msg) + local text = matches[1] + local url = getWallpaper(text) + + if not url then + return "Kein Bild gefunden." + end + + print("Bilder-URL: ", url) + send_photo_from_url(receiver, url) + return "Source: "..url +end + +return { + description = "Sucht Bild mit Google-API und versendet es (SafeSearch aktiv)", + usage = "/wallpaper [Suchbegriff]", + patterns = {"^/wallpaper (.*)$","^/wp (.*)$"}, + run = run +} +end diff --git a/plugins/wallpaper_nsfw.lua b/plugins/wallpaper_nsfw.lua new file mode 100644 index 0000000..f6bb8b8 --- /dev/null +++ b/plugins/wallpaper_nsfw.lua @@ -0,0 +1,50 @@ + +do + +function getWallpaper2(text) + local text = URL.escape(text) + local api = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&tbs=isz:l&tbm=isch&q=wallpaper+" + local res, code = http.request(api..text) + if code ~= 200 then return nil end + local google = json:decode(res) + + if google.responseStatus ~= 200 then + return nil + end + + local data = google.responseData + + if not data or not data.results then + return nil + end + + if #data.results == 0 then + return nil + end + + -- Random image from table + local i = math.random(#data.results) + return data.results[i].url +end + +function run(msg, matches) + local receiver = get_receiver(msg) + local text = matches[1] + local url = getWallpaper2(text) + + if not url then + return "Kein Bild gefunden." + end + + print("Bilder-URL: ", url) + send_photo_from_url(receiver, url) + return "Source: "..url +end + +return { + description = "Sucht Bild mit Google-API und versendet es", + usage = "/wallpaper2 [Suchbegriff]", + patterns = {"^/wallpaper2 (.*)$","^/wp2 (.*)$"}, + run = run +} +end