removed nonfunctional plugins

This commit is contained in:
Akamaru 2015-05-10 13:51:52 +02:00
parent 2603df596e
commit 17a14d34c0
4 changed files with 33 additions and 121 deletions

1
.gitignore vendored
View File

@ -38,3 +38,4 @@ plugins/vimeo.lua
plugins/vine.lua
plugins/youtube_playlist.lua
plugins/yandere.lua
plugins/e621.lua

View File

@ -1,58 +1,37 @@
local https = require 'ssl.https'
-- This is a proprietary plugin, property of Andreas Bielawski, (c) 2015 <andi (dot) b (at) outlook (dot) de>
-- DO NOT USE WITHOUT PERMISSION
-- Modified by Akamaru (http://akamaru.de)
function send_title(cb_extra, success, result)
send_msg(cb_extra[1], string.format('https://e621.net/post/show/%s\nScore: %s, rating: %s\n%s', cb_extra[2][1].id, cb_extra[2][1].score, cb_extra[2][1].rating, cb_extra[2][1].tags), ok_cb, false)
do
local function get_e621(tag)
local BASE_URL = 'https://e621.net'
local url = BASE_URL..'/post/index.json?tag='..tag
local b,c = https.request(url)
if c ~= 200 then return nil end
local e621 = json:decode(b)
-- truly randomize
math.randomseed(os.time())
-- random max json table size
local i = math.random(#e621)
local link_image = e621[i].file_url
return link_image
end
function filter_rating(msg)
local chan_rating = get_db_key('chan:' .. msg.to.id, 'e621')
if chan_rating == "explicit" then
return ''
elseif chan_rating == "mature" then
return '-rating:explicit'
else
return 'rating:safe'
end
end
function run(msg, matches)
local reciever = get_receiver(msg)
local request = ''
local extra = filter_rating(msg)
extra = extra .. ' -animation'
if matches[1] == 'latest' then
request = 'https://e621.net:443/post/index.json?limit=1&tags=' .. extra
elseif matches[1] == 'search' then
request = 'https://e621.net:443/post/index.json?tags=' .. matches[2] .. ' ' .. extra
else
return nil
end
body, code, headers, status = https.request(request)
local yiff = json:decode(body)
if yiff.success ~= nil and not yiff.success then
return yiff.reason
end
local link = yiff[1].sample_url
local file_path = download_to_file(link:gsub('https', 'http'))
print(file_path)
send_photo(reciever, file_path, send_title, { reciever, yiff })
return nil
local function run(msg, matches)
local tag = matches[1]
local receiver = get_receiver(msg)
local url = get_e621(tag)
send_photo_from_url(receiver, url, send_title, {receiver, title})
--return "Source: "..url
return "Bild wird gesendet!"
end
return {
description = 'e621 commands [latest, search]',
usage = '/e621 search [term], /e621 latest',
patterns = {'^/e621 (latest)', '^/e621 (search) (.+) ?$'},
description = "Sendet zufälliges Bild von e621.",
usage = {"/e621 [Tags]"},
patterns = {"^/e621 (.*)$"},
run = run
}
}
end

View File

@ -1,23 +0,0 @@
local https = require 'ssl.https'
function run(msg, matches)
local reciever = get_receiver(msg)
body, code, headers, status = https.request('https://e621.net:443/post/show.json?id=' .. matches[1])
local yiff = json:decode(body)
local link = yiff.sample_url
local file_path = download_to_file(link:gsub('https', 'http'))
send_photo(reciever, file_path, ok_cb, false)
return nil
end
return {
description = 'Mirrors e621 posts',
usage = 'e621.net/post/show/12345',
patterns = {'e621.net/post/show/([0-9]+)'},
run = run
}

View File

@ -1,45 +0,0 @@
local ltn12 = require("ltn12")
local rex = require("rex_pcre")
function run(msg, matches)
local cookies = 'a=' .. get_db_key('global', 'faa') .. '; b=' .. get_db_key('global', 'fab')
local t = {}
body, code, status, headers = http.request {
url = 'http://www.furaffinity.net/full/' .. matches[1],
headers = { Cookie = cookies },
sink = ltn12.sink.table(t)
}
local page = table.concat(t)
print('Loaded ' .. matches[1])
local img = rex.match(page, 'img.+submissionImg.+src="(.+?)"')
local rating = rex.match(page, 'rating".+src="/img/labels/(.+).gif"')
local chan_rating = get_db_key('chan:' .. msg.to.id, 'fa')
if chan_rating == "general" or not chan_rating then
if rating == "explicit" or rating == "mature" then
return nil
end
elseif chan_rating == "mature" then
if rating == "explicit" then
return nil
end
end
local file_path = download_to_file('http:' .. img)
send_photo(get_receiver(msg), file_path, ok_cb, false)
return nil
end
return {
description = "Mirrors FA images",
usage = "furaffinity.net/view/123456",
patterns = {"furaffinity.net/view/([0-9]+)", "furaffinity.net/full/([0-9]+)"},
run = run
}