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 receiver = get_receiver(msg)
if image_url then
local receiver = get_receiver(msg)
local file = download_to_file(image_url)
send_photo(receiver, file, ok_cb, false)
end

View File

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

View File

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

View File

@ -17,7 +17,7 @@ local function get_image(response)
end
if image.images.original then
return image.original.url
return image.original.mp4
end
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
return 'schi'
elseif string.match(msg.text, "[Ii][Yy][Kk][Ww][Ii][Mm]") then
return '(¬‿¬)'
end
end
@ -157,7 +160,8 @@ return {
"^[Ii][Nn][Ll][Oo][Vv][Ee]$",
"^[Pp][Ee]$",
"^[Vv][Aa]$",
"^[Mm][Uu]$"
"^[Mm][Uu]$",
"^/[Ii][Yy][Kk][Ww][Ii][Mm]$"
},
run = run
}

View File

@ -90,6 +90,7 @@ function run(msg, matches)
string.match(msg.text, "steamcommunity.com/app/") or
string.match(msg.text, "myanimelist.net/anime/") 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, "urbanup.com/") 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, "myfigurecollection.net") 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, ".jpeg") or
string.ends(url, ".gif") or

View File

@ -61,7 +61,7 @@ end
function send_youtube_data(data, receiver, link, sendpic)
local title = data.snippet.localized.title
-- local description = data.snippet.localized.description
--local description = data.snippet.localized.description
local uploader = data.snippet.channelTitle
local viewCount = comma_value(data.statistics.viewCount)
if data.statistics.likeCount then
@ -87,7 +87,8 @@ function send_youtube_data(data, receiver, link, sendpic)
local hours = math.floor(totalseconds / 3600)
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
text = link..'\n'..text
end

View File

@ -25,7 +25,6 @@ function send_yt_channel_data(data, receiver)
local description = data.snippet.localized.description
local views = comma_value(data.statistics.viewCount)
local subscriber = comma_value(data.statistics.subscriberCount)
if subscriber == "0" then subscriber = "0 (ausgblendet?)" end
local videos = comma_value(data.statistics.videoCount)
local text = name..' hat '..views..' Video-Aufrufe insgesamt, '..subscriber..' Abonnenten und '..videos..' Videos\n'..description
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/(.*)"')
if not video then
file = string.match(text, '%[download%] (.*) has already been downloaded')
--else
--file = string.match(text, '%[download%] Destination: (.*).flv')
else
file = 'tmp/'..video
end