Kleine Änderungen

This commit is contained in:
Akamaru 2016-01-11 19:39:19 +01:00
parent 1031849145
commit 9cca45fb3c
10 changed files with 15 additions and 51 deletions

View File

@ -77,7 +77,6 @@ local function run(msg, matches)
local text, image_url = get_post(post) local text, image_url = get_post(post)
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
if image_url then if image_url then
local receiver = get_receiver(msg)
local file = download_to_file(image_url) local file = download_to_file(image_url)
send_photo(receiver, file, ok_cb, false) send_photo(receiver, file, ok_cb, false)
end end

View File

@ -8,7 +8,7 @@ end
return { return {
description = "", description = "",
usage = {""}, usage = {"/pic BILDURL"},
patterns = {"^/pic (.*)$"}, patterns = {"^/pic (.*)$"},
run = run, run = run,
notyping = true notyping = true

View File

@ -8,6 +8,6 @@ end
return { return {
description = "", description = "",
usage = "", usage = "",
patterns = {"^(.*).txt$"}, patterns = {"^https?://(.*).txt$"},
run = run run = run
} }

View File

@ -17,7 +17,7 @@ local function get_image(response)
end end
if image.images.original then if image.images.original then
return image.original.url return image.original.mp4
end end
return nil return nil

View File

@ -1,43 +0,0 @@
function is_pr0_url(msg)
local url = split_by_space(msg.text)[1]
print(url)
if string.starts(url, "http://pr0gramm.com/") or string.starts(url, "http://www.pr0gramm.com/") then
return true
else
return false
end
end
if string.starts(msg.text, 'http://') or string.starts(msg.text, 'https://') then
if is_pr0_url(msg) then
local url = split_by_space(msg.text)[1]
local splited = split(url, "[\\/]+")
for a,x in pairs(splited) do
pr0_id = x
end
r, c, h = http.request("http://pr0gramm.com/api/items/get.json?id="..pr0_id)
local jsondata = json.decode(r)
local items = jsondata["items"]
for a, x in pairs(items) do
if tonumber(x["id"]) == tonumber(pr0_id) then
item = x
end
end
thumburl = item["thumb"]
local thumburlsplit = split(thumburl, "[\\/]+")
for a, x in pairs(thumburlsplit) do
thumbname = x
end
local file = "/tmp/"..thumbname
sh = "curl --insecure -o '"..file.."' ".."http://img.pr0gramm.com/"..thumburl
run_bash(sh)
send_photo(get_receiver(msg), file, ok_cb, false)
end
end
return {
description = "",
usage = {""},
patterns = {"https?://pr0gramm.com/"},
run = run
}

View File

@ -119,6 +119,9 @@ function run(msg, matches)
elseif string.match(msg.text, "[Mm][Uu]") then elseif string.match(msg.text, "[Mm][Uu]") then
return 'schi' return 'schi'
elseif string.match(msg.text, "[Ii][Yy][Kk][Ww][Ii][Mm]") then
return '(¬‿¬)'
end end
end end
@ -157,7 +160,8 @@ return {
"^[Ii][Nn][Ll][Oo][Vv][Ee]$", "^[Ii][Nn][Ll][Oo][Vv][Ee]$",
"^[Pp][Ee]$", "^[Pp][Ee]$",
"^[Vv][Aa]$", "^[Vv][Aa]$",
"^[Mm][Uu]$" "^[Mm][Uu]$",
"^/[Ii][Yy][Kk][Ww][Ii][Mm]$"
}, },
run = run run = run
} }

View File

@ -90,6 +90,7 @@ function run(msg, matches)
string.match(msg.text, "steamcommunity.com/app/") or string.match(msg.text, "steamcommunity.com/app/") or
string.match(msg.text, "myanimelist.net/anime/") or string.match(msg.text, "myanimelist.net/anime/") or
string.match(msg.text, "myanimelist.net/manga/") or string.match(msg.text, "myanimelist.net/manga/") or
string.match(msg.text, "myanimelist.net/profile/") or
string.match(msg.text, "deviantart.com") or string.match(msg.text, "deviantart.com") or
string.match(msg.text, "urbanup.com/") or string.match(msg.text, "urbanup.com/") or
string.match(msg.text, "urbandictionary.com/define.php")or string.match(msg.text, "urbandictionary.com/define.php")or
@ -98,6 +99,7 @@ function run(msg, matches)
string.match(msg.text, "openings.moe/%?video") or string.match(msg.text, "openings.moe/%?video") or
string.match(msg.text, "myfigurecollection.net") or string.match(msg.text, "myfigurecollection.net") or
string.match(msg.text, "dropbox.com/s/") or string.match(msg.text, "dropbox.com/s/") or
string.match(msg.text, "nicovideo.jp/watch/sm") or
string.ends(url, ".jpg") or string.ends(url, ".jpg") or
string.ends(url, ".jpeg") or string.ends(url, ".jpeg") or
string.ends(url, ".gif") or string.ends(url, ".gif") or

View File

@ -87,7 +87,8 @@ function send_youtube_data(data, receiver, link, sendpic)
local hours = math.floor(totalseconds / 3600) local hours = math.floor(totalseconds / 3600)
local duration = string.format("%02d:%02d:%02d", hours, minutes, seconds) local duration = string.format("%02d:%02d:%02d", hours, minutes, seconds)
text = 'Titel: '..title..'\nUploader: '..uploader..'\nAufrufe: '..viewCount..'\nLänge: '..duration..' Stunden\nLikes: '..likeCount..'\nDislikes: '..dislikeCount..'\nKommentare: '..commentCount..'\n' --text = 'Titel: '..title..'\nUploader: '..uploader..'\nAufrufe: '..viewCount..'\nLänge: '..duration..' Stunden\nLikes: '..likeCount..'\nDislikes: '..dislikeCount..'\nKommentare: '..commentCount..'\n'
text = '"'..title..'" hochgeladen von "'..uploader..'"\n'..viewCount..' Aufrufe, Länge: '..duration..' Stunden, '..likeCount..' Likes und '..dislikeCount..' Dislikes, '..commentCount..' Kommentare\n\n'
if link then if link then
text = link..'\n'..text text = link..'\n'..text
end end

View File

@ -25,7 +25,6 @@ function send_yt_channel_data(data, receiver)
local description = data.snippet.localized.description local description = data.snippet.localized.description
local views = comma_value(data.statistics.viewCount) local views = comma_value(data.statistics.viewCount)
local subscriber = comma_value(data.statistics.subscriberCount) local subscriber = comma_value(data.statistics.subscriberCount)
if subscriber == "0" then subscriber = "0 (ausgblendet?)" end
local videos = comma_value(data.statistics.videoCount) local videos = comma_value(data.statistics.videoCount)
local text = name..' hat '..views..' Video-Aufrufe insgesamt, '..subscriber..' Abonnenten und '..videos..' Videos\n'..description local text = name..' hat '..views..' Video-Aufrufe insgesamt, '..subscriber..' Abonnenten und '..videos..' Videos\n'..description
send_msg(receiver, text, ok_cb, false) send_msg(receiver, text, ok_cb, false)

View File

@ -13,6 +13,8 @@ function run(msg, matches)
video = string.match(text, 'Merging formats into "tmp/(.*)"') video = string.match(text, 'Merging formats into "tmp/(.*)"')
if not video then if not video then
file = string.match(text, '%[download%] (.*) has already been downloaded') file = string.match(text, '%[download%] (.*) has already been downloaded')
--else
--file = string.match(text, '%[download%] Destination: (.*).flv')
else else
file = 'tmp/'..video file = 'tmp/'..video
end end