diff --git a/miku/plugins/facebook.lua b/miku/plugins/facebook.lua index 7029441..959a92c 100644 --- a/miku/plugins/facebook.lua +++ b/miku/plugins/facebook.lua @@ -68,13 +68,14 @@ function facebook:send_facebook_photo(photo_id, receiver) local data = json.decode(res) local from = ''..data.from.name..'' - if data.name then - text = from..' hat ein Bild gepostet:\n'..data.name - else - text = from..' hat ein Bild gepostet:' - end local image_url = data.images[1].source - return text, image_url + if data.name then + text = from..' hat ein Bild gepostet:\n'..data.name + else + text = from..' hat ein Bild gepostet:' + end + + return text end function facebook:send_facebook_video(video_id) @@ -144,11 +145,10 @@ function facebook:action(msg, config, matches) else photo_id = matches[4] end - local text, image_url = facebook:send_facebook_photo(photo_id, receiver) - if not image_url then return end + local text = facebook:send_facebook_photo(photo_id, receiver) + if not text then return end utilities.send_typing(msg.chat.id, 'upload_photo') - utilities.send_reply(msg, text, 'HTML') - utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id) + utilities.send_message(msg.chat.id, text, false, msg.message_id, 'HTML') return elseif matches[1] == 'video' or matches[2] == 'videos' then if not matches[3] then diff --git a/miku/plugins/instagram.lua b/miku/plugins/instagram.lua index 4b8186d..e15faf9 100644 --- a/miku/plugins/instagram.lua +++ b/miku/plugins/instagram.lua @@ -8,41 +8,58 @@ end function instagram:get_instagram(url) local api_key = cred_data.iframely_api_key - local res, code = https.request('https://iframe.ly/api/oembed?url=https://www.instagram.com/p/'..URL.escape(url)..'&api_key='..api_key) + local res, code = https.request('https://iframe.ly/api/iframely?url=https://www.instagram.com/p/'..URL.escape(url)..'&api_key='..api_key) if code ~= 200 then return end local data = json.decode(res) - if data.title then - title = data.title:gsub('"', '\\"') + if data.meta.title then + title = data.meta.title:gsub('"', '\\"') else title = 'Kein Titel' end - if data.description then - description = data.description:gsub('"', '\\"') - description_in_text = '\n'..description + if data.meta.description then + description = data.meta.description:gsub('"', '\\"') + description_in_text = description else description_in_text = '' description = 'Keine Beschreibung verfügbar' end - local pic = data.thumbnail_url - local text = title..'\n'..description_in_text + if data.links.player then + video = 'https:'..data.links.player[1].href + else + video = 'NOVID' + end + + if data.links.image then + pic = ' ' + else + pic = ' ' + end + + local text = ''..title..' '..pic..'\n'..description_in_text..'' - return pic, text + return video, text end function instagram:action(msg, config, matches) local url = matches[1] - local pic, text = instagram:get_instagram(url) + local video, text = instagram:get_instagram(url) if not url then utilities.send_reply(msg, 'Fehler') return end - utilities.send_typing(msg.chat.id, 'upload_photo') - utilities.send_photo(msg.chat.id, pic, text, msg.message_id) + if video == 'NOVID' then + return + else + utilities.send_typing(msg.chat.id, 'upload_video') + utilities.send_video(msg.chat.id, video, nil, msg.message_id) + end + + utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html') end return instagram \ No newline at end of file diff --git a/miku/plugins/mal_user.lua b/miku/plugins/mal_user.lua index a125dea..34f3b74 100644 --- a/miku/plugins/mal_user.lua +++ b/miku/plugins/mal_user.lua @@ -38,7 +38,7 @@ function mal_user:get_infos(user) end local mal_url = 'Profil aufrufen' - local text = user_pic..name..user_id..' schaut derzeit '..watching..', hat '..pause..', '..dropped..' und '..complete..'. '..planed..' auf der Watchlist.\n'..mal_url + local text = name..user_id..' schaut derzeit '..watching..', hat '..pause..', '..dropped..' und '..complete..'. '..planed..' auf der Watchlist.\n'..user_pic..mal_url return text end diff --git a/miku/plugins/minecraft_skin.lua b/miku/plugins/minecraft_skin.lua index 29cf67c..c2d41f0 100644 --- a/miku/plugins/minecraft_skin.lua +++ b/miku/plugins/minecraft_skin.lua @@ -21,9 +21,8 @@ function mc_skin:action(msg, config, matches) end end - local url = 'http://www.minecraft-skin-viewer.net/3d.php?layers=true&aa=true&a=0&w=330&wt=10&abg=330&abd=40&ajg=340&ajd=20&ratio=13&format=png&login='..input..'&headOnly=false&displayHairs=true&randomness=341.png' - local file = download_to_file(url, input..'.png') - utilities.send_photo(msg.chat.id, file, nil, msg.message_id) + local img = 'http://www.minecraft-skin-viewer.net/3d.php?layers=true&aa=true&a=0&w=330&wt=10&abg=330&abd=40&ajg=340&ajd=20&ratio=13&format=png&login='..input..'&headOnly=false&displayHairs=true&randomness=341.png' + utilities.send_photo(msg.chat.id, img, nil, msg.message_id) end return mc_skin diff --git a/miku/plugins/random.lua b/miku/plugins/random.lua index 068896d..531986c 100644 --- a/miku/plugins/random.lua +++ b/miku/plugins/random.lua @@ -55,7 +55,8 @@ function fun:choose_random(user_name, other_user) user_name..' schmiert Hundescheiße auf '..other_user..'’s Nike Air.', user_name..' erstellt eine falsche Route auf '..other_user..'’s Navi.', user_name..' zieht '..other_user..' die Hose aus.', - user_name..' schenkt '..other_user..' Bibis Beauty-Cream.' + user_name..' schenkt '..other_user..' Bibis Beauty-Cream.', + user_name..' schubst '..other_user..' von einer Klippe. Armer Timmy...' } math.randomseed(os.time()) math.randomseed(os.time())