Portiere EINEN HAUFEN an Imageboard-Plugins, NSFW-Plugins, etc. Im Folgenden:

- boobs
- danbooru
- derpibooru(_nsfw)
- e621
- gifeye
- konachan(_nsfw)
- riko & yagyuu >> moe
- porndoge
- pornhub_gif
- pr0gramm
- random_pic(_nsfw)
- rule34
- sankakucomplex
- yandere
- z0r
This commit is contained in:
Andreas Bielawski 2016-08-18 17:23:55 +02:00
parent d457b39b06
commit 345e33dcb0
18 changed files with 884 additions and 0 deletions

68
miku/plugins/boobs.lua Normal file
View File

@ -0,0 +1,68 @@
local boobs = {}
boobs.triggers = {
"^/([Bb][Oo][Oo][Bb][Ss])$",
"^/([Bb][Uu][Tt][Tt][Ss])$"
}
boobs.command = 'boobs, /butts'
-- Recursive function
function boobs:getRandomButts(attempt)
attempt = attempt or 0
attempt = attempt + 1
local res,status = http.request("http://api.obutts.ru/noise/1")
if status ~= 200 then return nil end
local data = json.decode(res)[1]
-- The OpenBoobs API sometimes returns an empty array
if not data and attempt <= 3 then
print('Keine Butts gefunden!')
return getRandomButts(attempt)
end
return 'http://media.obutts.ru/' .. data.preview
end
function boobs:getRandomBoobs(attempt)
attempt = attempt or 0
attempt = attempt + 1
local res,status = http.request("http://api.oboobs.ru/noise/1")
if status ~= 200 then return nil end
local data = json.decode(res)[1]
-- The OpenBoobs API sometimes returns an empty array
if not data and attempt < 10 then
print('Keine Boobs gefunden!')
return getRandomBoobs(attempt)
end
return 'http://media.oboobs.ru/' .. data.preview
end
function boobs:action(msg, config, matches)
local url
if matches[1]:match("[Bb][Oo][Oo][Bb][Ss]") then
url = boobs:getRandomBoobs()
end
if matches[1]:match("[Bb][Uu][Tt][Tt][Ss]") then
url = boobs:getRandomButts()
end
if url ~= nil then
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file, url)
return
else
utilities.send_reply(self, msg, 'Nichts gefunden :(')
return
end
end
return boobs

112
miku/plugins/danbooru.lua Normal file
View File

@ -0,0 +1,112 @@
local danbooru = {}
function danbooru:init(config)
danbooru.triggers = {
"^/dan$",
"^/dan (d)$",
"^/dan (w)$",
"^/dan (m)$",
"^/(dan) (.+)$",
"(danbooru.donmai.us)/posts/([0-9]+)"
}
danbooru.doc = [[*
]]..config.cmd_pat..[[dan*: Zufälliges Bild von Danbooru
*]]..config.cmd_pat..[[dan* _<d/w/m>_: Zufälliges Bild von Danbooru (populär heute/in der Woche/im Monat)
*]]..config.cmd_pat..[[dan* _<Tags>_: Sucht auf Danbooru mit diesen Tags
]]
end
danbooru.command = 'dan <Tags>'
local BASE_URL = "http://danbooru.donmai.us"
local URL_NEW = "/posts.json"
local URL_POP = "/explore/posts/popular.json"
local scale_day = "?scale=day"
local scale_week = "?scale=week"
local scale_month = "?scale=month"
function danbooru:get_post(url)
local res, code = http.request(url)
if code ~= 200 then return nil end
local posts = json.decode(res)
if not posts[1] then return nil end
return posts[math.random(#posts)]
end
function danbooru:get_specific_post(id)
local url = BASE_URL..'/posts/'..id..'.json'
local res, code = http.request(url)
if code ~= 200 then return nil end
local db = json.decode(res)
local link_image = BASE_URL..db.file_url
return link_image
end
function danbooru:action(msg, config, matches)
if matches[1] == 'danbooru.donmai.us' and matches[2] then
local url = danbooru:get_specific_post(matches[2])
if not url then utilities.send_reply(self, msg, config.errors.connection) return end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
if string.ends(url, ".gif") or string.ends(url, ".zip") or string.ends(url, ".webm") then
utilities.send_document(self, msg.chat.id, file)
else
utilities.send_photo(self, msg.chat.id, file)
end
return
end
if matches[1] == "d" or matches[1] == "w" or matches[1] == "m" then
url = BASE_URL..URL_POP
else
url = BASE_URL..URL_NEW
end
if matches[1] == "d" then
url = url..scale_day
elseif matches[1] == "w" then
url = url..scale_week
elseif matches[1] == "m" then
url = url..scale_month
elseif matches[1] == "dan" and matches[2] then
local tag = string.gsub(matches[2], " ", '_' )
local tag = string.gsub(tag, ":", '%%3A' )
url = url..'?tags='..tag
end
local post = danbooru:get_post(url)
if post then
local download_url = BASE_URL..post.large_file_url
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local img = download_to_file(download_url)
if string.ends(download_url, ".gif") or string.ends(download_url, ".zip") or string.ends(download_url, ".webm") then
utilities.send_document(self, msg.chat.id, img)
else
utilities.send_photo(self, msg.chat.id, img)
end
local txt = ''
if post.tag_string_artist ~= '' then
txt = 'Artist: ' .. post.tag_string_artist .. '\n'
end
if post.tag_string_character ~= '' then
txt = txt .. 'Charakter: ' .. post.tag_string_character .. '\n'
end
if post.file_size ~= '' then
txt = txt .. '[' .. math.ceil(post.file_size/1000) .. 'kb] ' .. BASE_URL .. post.file_url
end
if txt ~= '' then
utilities.send_reply(self, msg, txt)
end
return
else
utilities.send_reply(self, msg, config.errors.results)
return
end
end
return danbooru

View File

@ -0,0 +1,43 @@
local derpibooru = {}
function derpibooru:init(config)
derpibooru.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('dp', true):t('derpibooru', true).table
derpibooru.doc = [[*
]]..config.cmd_pat..[[dp* _<Tags>_: Sucht auf Derpibooru mit diesen Tags]]
end
derpibooru.command = 'dp <Tags>'
function derpibooru:get_dp(tag)
local BASE_URL = 'https://derpiboo.ru/'
local url = BASE_URL..'/search.json?q='..tag
local res, code = https.request(url)
if code ~= 200 then return nil end
local dp = json.decode(res).search
if not dp[1] then return nil end
local i = math.random(#dp)
local link_image = 'https:'..dp[i].image
local source = 'https://derpiboo.ru/'..dp[i].id
return link_image, source
end
function derpibooru:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, derpibooru.doc, true)
return
end
local tag = string.gsub(input, " ", '+' )
local url, source = derpibooru:get_dp(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file, source)
end
return derpibooru

View File

@ -0,0 +1,49 @@
local derpibooru_nsfw = {}
function derpibooru_nsfw:init(config)
if not cred_data.derpibooru_apikey then
print('Fehlender Key: derpibooru_apikey.')
print('derpibooru_nsfw.lua wird nicht aktiviert.')
return
end
derpibooru_nsfw.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('dp_nsfw', true):t('derpibooru_nsfw', true).table
derpibooru_nsfw.doc = [[*
]]..config.cmd_pat..[[dp_nsfw* _<Tags>_: Sucht auf Derpibooru mit diesen Tags (NSFW)]]
end
derpibooru_nsfw.command = 'dp_nsfw <Tags>'
function derpibooru_nsfw:get_dp(tag)
local BASE_URL = 'https://derpiboo.ru/'
local apikey = cred_data.derpibooru_apikey
local url = BASE_URL..'/search.json?key='..apikey..'&q='..tag
local res, code = https.request(url)
if code ~= 200 then return nil end
local dp = json.decode(res).search
if not dp[1] then return nil end
local i = math.random(#dp)
local link_image = 'https:'..dp[i].image
local source = 'https://derpiboo.ru/'..dp[i].id
return link_image, source
end
function derpibooru_nsfw:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, derpibooru_nsfw.doc, true)
return
end
local tag = string.gsub(input, " ", '+' )
local url, source = derpibooru_nsfw:get_dp(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file, source)
end
return derpibooru_nsfw

40
miku/plugins/e621.lua Normal file
View File

@ -0,0 +1,40 @@
local e621 = {}
function e621:init(config)
e621.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('e621', true).table
e621.doc = [[*
]]..config.cmd_pat..[[e621* _<Tags>_: Sucht auf e621 mit diesen Tags]]
end
e621.command = 'e621 <Tags>'
function e621:get_e621(tag)
local BASE_URL = 'https://e621.net'
local url = BASE_URL..'/post/index.json?tags='..tag
local res, code = https.request(url)
if code ~= 200 then return nil end
local data = json.decode(res)
if not data[1] then return nil end
local i = math.random(#data)
local link_image = data[i].file_url
return link_image
end
function e621:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, e621.doc, true)
return
end
local url = e621:get_e621(input)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file, url)
end
return e621

32
miku/plugins/gifeye.lua Normal file
View File

@ -0,0 +1,32 @@
local gifeye = {}
function gifeye:init(config)
gifeye.triggers = {
"https?://gifeye.com/(%d+)$",
"^/gifeye (%d+)$",
"^/ge (%d+)$"
}
gifeye.doc = [[*
]]..config.cmd_pat..[[ge* _<ID>_: Sendet Bild von Gifeye (NSFW)]]
end
gifeye.command = 'ge <ID>'
function gifeye:action(msg, config, matches)
local url = 'http://i.gifeye.com/'..matches[1]..'.gif'
utilities.send_typing(self, msg.chat.id, 'upload_document')
local file = download_to_file(url)
if not file then
utilities.send_reply(self, msg, config.errors.results)
return
end
if string.starts(msg.text_lower, '/ge') or string.starts(msg.text_lower, '/gifeye') then
source = 'http://gifeye.com/'..matches[1]
else
source = nil
end
utilities.send_document(self, msg.chat.id, file, source)
end
return gifeye

41
miku/plugins/konachan.lua Normal file
View File

@ -0,0 +1,41 @@
local konachan = {}
function konachan:init(config)
konachan.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('kc', true):t('konachan', true).table
konachan.doc = [[*
]]..config.cmd_pat..[[kc* _<Tags>_: Sucht auf Konachan mit diesen Tags]]
end
konachan.command = 'kc <Tags>'
function konachan:get_kc(tag)
local url = 'http://konachan.net/post.json?tags='..tag..'%20-rating:explicit'
local res, code = http.request(url)
if code ~= 200 then return nil end
local data = json.decode(res)
if not data[1] then return nil end
local i = math.random(#data)
local link_image = data[i].file_url
return link_image
end
function konachan:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, konachan.doc, true)
return
end
local tag = string.gsub(input, " ", '+' )
local url = konachan:get_kc(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file)
utilities.send_reply(self, msg, url)
end
return konachan

View File

@ -0,0 +1,41 @@
local konachan_nsfw = {}
function konachan_nsfw:init(config)
konachan_nsfw.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('kcn', true):t('konachan_nsfw', true).table
konachan_nsfw.doc = [[*
]]..config.cmd_pat..[[kcn* _<Tags>_: Sucht auf Konachan mit diesen Tags (NSFW)]]
end
konachan_nsfw.command = 'kcn <Tags>'
function konachan_nsfw:get_kc(tag)
local url = 'http://konachan.net/post.json?tags='..tag
local res, code = http.request(url)
if code ~= 200 then return nil end
local data = json.decode(res)
if not data[1] then return nil end
local i = math.random(#data)
local link_image = data[i].file_url
return link_image
end
function konachan_nsfw:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, konachan_nsfw.doc, true)
return
end
local tag = string.gsub(input, " ", '+' )
local url = konachan_nsfw:get_kc(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file)
utilities.send_reply(self, msg, url)
end
return konachan_nsfw

41
miku/plugins/moe.lua Normal file
View File

@ -0,0 +1,41 @@
local moe = {}
function moe:init(config)
moe.triggers = {
"^/([Rr][Ii][Kk][Oo])$",
"^/([Yy][Aa][Gg][Yy][Uu][Uu])$"
}
moe.doc = [[*
]]..config.cmd_pat..[[riko*: Postet ein Bild von riko.moe
*]]..config.cmd_pat..[[yagyuu*: Postet ein Bild von yagyuu.moe
]]
end
moe.command = 'riko, /yagyuu'
function moe:get_url(site_url)
local res,code = http.request(site_url)
if code ~= 200 then return nil end
local photo_url = res:match("<img src%=\"(.-)\" alt")
local photo_url = site_url..'/'..photo_url
return photo_url
end
function moe:action(msg, config, matches)
if matches[1]:match('[Rr][Ii][Kk][Oo]') then
site_url = 'http://riko.moe'
elseif matches[1]:match('[Yy][Aa][Gg][Yy][Uu][Uu]') then
site_url = 'http://yagyuu.moe'
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local photo_url = moe:get_url(site_url)
if not photo_url then
utilities.send_reply(self, msg, config.errors.connection)
return
end
local file = download_to_file(photo_url)
utilities.send_photo(self, msg.chat.id, file)
end
return moe

22
miku/plugins/porndoge.lua Normal file
View File

@ -0,0 +1,22 @@
local porndoge = {}
function porndoge:init(config)
porndoge.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('pdoge', true).table
porndoge.doc = [[*
]]..config.cmd_pat..[[pdoge*]]
end
porndoge.command = 'pdoge'
function porndoge:action(msg, config)
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local url = 'https://porndoge.herokuapp.com/'
local file = download_to_file(url, 'porndoge.png')
if not file then
utilities.send_reply(self, msg, config.errors.connection)
return
end
utilities.send_photo(self, msg.chat.id, file)
end
return porndoge

View File

@ -0,0 +1,32 @@
local pornhub = {}
function pornhub:init(config)
pornhub.triggers = {
"pornhub.com/gif/(.+)$",
"^/phg (.+)$",
"^/porngif (.+)$"
}
pornhub.doc = [[*
]]..config.cmd_pat..[[phg* _<ID>_: Sendet GIF von PornHub (NSFW)]]
end
pornhub.command = 'ge <ID>'
function pornhub:action(msg, config, matches)
local url = 'http://img.pornhub.com/gif/'..matches[1]..'.gif'
utilities.send_typing(self, msg.chat.id, 'upload_document')
local file = download_to_file(url)
if not file then
utilities.send_reply(self, msg, config.errors.results)
return
end
if string.starts(msg.text_lower, '/phg') or string.starts(msg.text_lower, '/porngif') then
source = 'http://www.pornhub.com/gif/'..matches[1]
else
source = nil
end
utilities.send_document(self, msg.chat.id, file, source)
end
return pornhub

43
miku/plugins/pr0gramm.lua Normal file
View File

@ -0,0 +1,43 @@
local pr0gramm = {}
function pr0gramm:init(config)
pr0gramm.triggers = {
"pr0gramm.com/.*/(%d+)",
"^/[Pp][Rr]0 (%d+)$"
}
pr0gramm.doc = [[*
]]..config.cmd_pat..[[pr0* _<ID>_: Sendet Bild von pr0gramm]]
end
pr0gramm.command = 'pr0 <ID>'
function pr0gramm:get_post(id)
local url = 'http://pr0gramm.com/api/items/get.json?id='..id
local res, code = http.request(url)
if code ~= 200 then return nil end
local data = json.decode(res).items[1]
if not data then return nil end
local img = data.image
return 'http://img.pr0gramm.com/'..img
end
function pr0gramm:action(msg, config, matches)
local id = matches[1]
local url = pr0gramm:get_post(id)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
if string.match(url, ".gif") or string.match(url, ".zip") or string.match(url, ".webm") or string.match(url, ".mp4") then
utilities.send_document(self, msg.chat.id, file)
else
utilities.send_photo(self, msg.chat.id, file)
end
end
return pr0gramm

View File

@ -0,0 +1,63 @@
local rpic = {}
function rpic:init(config)
rpic.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('rpic', true).table
rpic.doc = [[*
]]..config.cmd_pat..[[rpic* _<Thema>_
*Themen:*
- anime
- mlp
- doge
- faktillion
- faktastisch
- gamefakt
- faktglaublich]]
end
rpic.command = 'rpic <Thema>'
function rpic:get_random_image(dir)
files = scandir(dir)
if not files[1] then return ': Keine Dateien vorhanden!' end
file = files[math.random(#files)]
return file
end
function rpic:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, rpic.doc, true)
return
end
local pics = {
["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/"
}
if pics[input] then
local img = pics[input]..rpic:get_random_image(pics[input])
print("Sende... "..img)
if string.ends(img, ".gif") or string.ends(img, ".mp4") then
utilities.send_document(self, msg.chat.id, img)
return
elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
utilities.send_photo(self, msg.chat.id, img)
return
else
utilities.send_reply(self, msg, 'Fehler: '..img)
return
end
else
utilities.send_reply(self, msg, '*Dieses Thema gibt es nicht!*'..rpic.doc, true)
return
end
end
return rpic

View File

@ -0,0 +1,54 @@
local rpic_nsfw = {}
function rpic_nsfw:init(config)
rpic_nsfw.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('nsfw', true).table
rpic_nsfw.doc = [[*
]]..config.cmd_pat..[[nsfw* _<Thema>_
*Themen:*
- gif
- rl
- shimakaze]]
end
rpic_nsfw.command = 'nsfw <Thema>'
function rpic_nsfw:get_random_image(dir)
files = scandir(dir)
if not files[1] then return ': Keine Dateien vorhanden!' end
file = files[math.random(#files)]
return file
end
function rpic_nsfw:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
input = 'general'
end
local pics = {
["general"] = "../Festplatten/Dragoran/Mikubot/nsfw/",
["gif"] = "../Festplatten/Dragoran/Mikubot/nsfw/gifs/",
["rl"] = "../Festplatten/Dragoran/Mikubot/nsfw/rl/",
["shimakaze"] = "../Festplatten/Dragoran/Mikubot/nsfw/Shimakaze/"
}
if pics[input] then
local img = pics[input]..rpic_nsfw:get_random_image(pics[input])
print("Sende... "..img)
if string.ends(img, ".gif") or string.ends(img, ".mp4") then
utilities.send_document(self, msg.chat.id, img)
return
elseif string.ends(img, ".jpg") or string.ends(img, ".jpeg") or string.ends(img, ".png") then
utilities.send_photo(self, msg.chat.id, img)
return
else
utilities.send_reply(self, msg, 'Fehler: '..img)
return
end
else
utilities.send_reply(self, msg, '*Dieses Thema gibt es nicht!*'..rpic_nsfw.doc, true)
return
end
end
return rpic_nsfw

81
miku/plugins/rule34.lua Normal file
View File

@ -0,0 +1,81 @@
local rule34 = {}
function rule34:init(config)
rule34.triggers = {
"^/r34 (.+)$",
"^/rule34 (.+)$",
"https?://(rule34.xxx)/index.php%?page=post&s=view&id=(%d+)"
}
rule34.doc = [[*
]]..config.cmd_pat..[[r34* _<Tags>_: Sucht auf Rule34 mit diesen Tags (NSFW)]]
end
rule34.command = 'r34 <Tags>'
function rule34:get_r34_info(tag)
local limit = 100 -- number of posts to return (higher = more choices for random, but longer load times, hard limit of 100 posts)
local BASE_URL = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%27http%3A%2F%2Frule34.xxx%2Findex.php%3Fpage%3Ddapi%26s%3Dpost%26q%3Dindex%26limit%3D'..limit..'%26tags%3D'
local END_URL = '%27&format=json'
local url = BASE_URL..tag..END_URL
local res, code = https.request(url)
if code ~= 200 then return nil end
local r34 = json.decode(res).query.results.posts.post
if not r34[1] then return nil end
local i = math.random(#r34)
local url = r34[i].file_url
local source_url = 'http://rule34.xxx/index.php?page=post&s=view&id='..r34[i].id
return url, source_url
end
function rule34:get_r34_post(id)
local url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%27http%3A%2F%2Frule34.xxx%2Findex.php%3Fpage%3Ddapi%26s%3Dpost%26q%3Dindex%26id%3D'..id..'%27&format=json'
local res ,code = https.request(url)
if code ~= 200 then return nil end
local r34 = json.decode(res).query.results.posts.post
if not r34 then return nil end
local img_url = r34.file_url
return img_url
end
function rule34:action(msg, config, matches)
if matches[1] == 'rule34.xxx' and matches[2] then
local id = matches[2]
local img_url = rule34:get_r34_post(id)
if not img_url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(img_url)
if string.ends(img_url, ".gif") then
utilities.send_document(self, msg.chat.id, file)
else
utilities.send_photo(self, msg.chat.id, file)
end
else
local tag = string.gsub(matches[1], " ", '_')
local tag = string.gsub(tag, ":", '%%3A')
local tag = string.gsub(tag, "+", '%%2B')
local url, id = rule34:get_r34_info(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
if string.ends(url, ".gif") then
utilities.send_document(self, msg.chat.id, file, id)
else
utilities.send_photo(self, msg.chat.id, file, id)
end
end
end
return rule34

View File

@ -0,0 +1,52 @@
local sankakucomplex = {}
function sankakucomplex:init(config)
sankakucomplex.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('sc', true):t('sankaku', true).table
sankakucomplex.doc = [[*
]]..config.cmd_pat..[[sc* _<Tags>_: Sucht auf Sankaku mit diesen Tags]]
end
sankakucomplex.command = 'sc <Tags>'
function sankakucomplex:get_post(tag)
local user = cred_data.sankaku_username
local password = cred_data.sankaku_pw --Your SHA1 hashed password. (echo "choujin-steiner--YOUR-PASSWORD--" | sha1sum)
local BASE_URL = 'https://chan.sankakucomplex.com'
local url = BASE_URL..'/post/index.json?login='..user..'&password_hash='..password..'&tags='..tag
local b,c = https.request(url)
if c ~= 200 then return nil end
local complex = json.decode(b)
if not complex[1] then return nil end
local i = math.random(#complex)
local link_image = 'https:'..complex[i].file_url
return link_image
end
function sankakucomplex:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, sankakucomplex.doc, true)
return
end
local tag = string.gsub(input, " ", '_' )
local tag = string.gsub(tag, ":", '%%3A' )
local url = sankakucomplex:get_post(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
if string.match(url, ".gif") or string.match(url, ".zip") or string.match(url, ".webm") or string.match(url, ".mp4") then
utilities.send_document(self, msg.chat.id, file)
else
utilities.send_photo(self, msg.chat.id, file)
end
utilities.send_reply(self, msg, url)
end
return sankakucomplex

44
miku/plugins/yandere.lua Normal file
View File

@ -0,0 +1,44 @@
local yandere = {}
function yandere:init(config)
yandere.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('yan', true):t('yandere', true).table
yandere.doc = [[*
]]..config.cmd_pat..[[yan* _<Tags>_: Sucht auf Yandere mit diesen Tags]]
end
yandere.command = 'yan <Tags>'
function yandere:get_post(tag)
local BASE_URL = 'https://yande.re'
local url = BASE_URL..'/post.json?tags='..tag
local b,c = https.request(url)
print(url)
if c ~= 200 then return nil end
local yan = json.decode(b)
if not yan[1] then return nil end
local i = math.random(#yan)
local link_image = yan[i].file_url
return link_image
end
function yandere:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(self, msg, yandere.doc, true)
return
end
local tag = string.gsub(input, " ", '_' )
local url = yandere:get_post(tag)
if not url then
utilities.send_reply(self, msg, config.errors.results)
return
end
utilities.send_typing(self, msg.chat.id, 'upload_photo')
local file = download_to_file(url)
utilities.send_photo(self, msg.chat.id, file)
utilities.send_reply(self, msg, url)
end
return yandere

26
miku/plugins/z0r.lua Normal file
View File

@ -0,0 +1,26 @@
local z0r = {}
function z0r:init(config)
z0r.triggers = {
"https?://z0r.de/(%d+)$",
"^/[Zz]0[Rr] (%d+)$"
}
z0r.doc = [[*
]]..config.cmd_pat..[[z0r* _<ID>_: Sendet Loop von z0r]]
end
z0r.command = 'z0r <ID>'
function z0r:action(msg, config, matches)
local id = matches[1]
utilities.send_typing(self, msg.chat.id, 'upload_video')
local url = 'http://z0r.de/L/z0r-de_'..matches[1]..'.swf'
local file = download_to_file(url)
if not file then
utilities.send_reply(self, msg, config.errors.connection)
return
end
utilities.send_document(self, msg.chat.id, file)
end
return z0r