diff --git a/otouto/plugins/9gag.lua b/otouto/plugins/9gag.lua index e372403..5327f5c 100644 --- a/otouto/plugins/9gag.lua +++ b/otouto/plugins/9gag.lua @@ -32,9 +32,11 @@ function ninegag:inline_callback(inline_query, config) local gag = json.decode(res) local results = '[' + local id = 50 for n in pairs(gag) do local title = gag[n].title:gsub('"', '\\"') - results = results..'{"type":"photo","id":"'..math.random(100000000000000000)..'","photo_url":"'..gag[n].src..'","thumb_url":"'..gag[n].src..'","caption":"'..title..'","reply_markup":{"inline_keyboard":[[{"text":"9GAG aufrufen","url":"'..gag[n].url..'"}]]}}' + results = results..'{"type":"photo","id":"'..id..'","photo_url":"'..gag[n].src..'","thumb_url":"'..gag[n].src..'","caption":"'..title..'","reply_markup":{"inline_keyboard":[[{"text":"9GAG aufrufen","url":"'..gag[n].url..'"}]]}}' + id = id+1 if n < #gag then results = results..',' end diff --git a/otouto/plugins/adfly.lua b/otouto/plugins/adfly.lua index 349e72a..714464c 100644 --- a/otouto/plugins/adfly.lua +++ b/otouto/plugins/adfly.lua @@ -30,7 +30,7 @@ function adfly:inline_callback(inline_query, config, matches) if not url then utilities.answer_inline_query(self, inline_query) return end if url == 'NOTFOUND' then utilities.answer_inline_query(self, inline_query) return end - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"Verlängerte URL","description":"'..url..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' + local results = '[{"type":"article","id":"1","title":"Verlängerte URL","description":"'..url..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' utilities.answer_inline_query(self, inline_query, results, 3600, true) end diff --git a/otouto/plugins/bImages.lua b/otouto/plugins/bImages.lua index 6819e74..7553b35 100644 --- a/otouto/plugins/bImages.lua +++ b/otouto/plugins/bImages.lua @@ -36,11 +36,13 @@ function bImages:getImages(query) local results = '[' + local id = 300 for n in pairs(images) do if images[n].encodingFormat == 'jpeg' then -- Inline-Querys MUST use JPEG photos! local photo_url = images[n].contentUrl local thumb_url = images[n].thumbnailUrl - results = results..'{"type":"photo","id":"'..math.random(100000000000000000)..'","photo_url":"'..photo_url..'","thumb_url":"'..thumb_url..'","photo_width":'..images[n].width..',"photo_height":'..images[n].height..',"reply_markup":{"inline_keyboard":[[{"text":"Bing aufrufen","url":"'..images[n].webSearchUrl..'"},{"text":"Bild öffnen","url":"'..photo_url..'"}]]}},' + results = results..'{"type":"photo","id":"'..id..'","photo_url":"'..photo_url..'","thumb_url":"'..thumb_url..'","photo_width":'..images[n].width..',"photo_height":'..images[n].height..',"reply_markup":{"inline_keyboard":[[{"text":"Bing aufrufen","url":"'..images[n].webSearchUrl..'"},{"text":"Bild öffnen","url":"'..photo_url..'"}]]}},' + id = id+1 end end diff --git a/otouto/plugins/bitly.lua b/otouto/plugins/bitly.lua index 5f9bf23..45b2222 100644 --- a/otouto/plugins/bitly.lua +++ b/otouto/plugins/bitly.lua @@ -40,7 +40,7 @@ function bitly:inline_callback(inline_query, config, matches) if not url then utilities.answer_inline_query(self, inline_query) return end - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"Verlängerte URL","description":"'..url..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' + local results = '[{"type":"article","id":"2","title":"Verlängerte URL","description":"'..url..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' utilities.answer_inline_query(self, inline_query, results, 3600) end diff --git a/otouto/plugins/cats.lua b/otouto/plugins/cats.lua index 56db05e..ca81454 100644 --- a/otouto/plugins/cats.lua +++ b/otouto/plugins/cats.lua @@ -29,8 +29,10 @@ local apikey = cred_data.cat_apikey or "" -- apply for one here: http://thecatap function cats:inline_callback(inline_query, config, matches) if matches[1] == 'gif' then img_type = 'gif' + id = 100 else img_type = 'jpg' + id = 200 end local url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%27http%3A%2F%2Fthecatapi.com%2Fapi%2Fimages%2Fget%3Fformat%3Dxml%26results_per_page%3D50%26type%3D'..img_type..'%26apikey%3D'..apikey..'%27&format=json' -- no way I'm using XML, plz die local res, code = https.request(url) @@ -43,9 +45,11 @@ function cats:inline_callback(inline_query, config, matches) for n in pairs(data) do if img_type == 'gif' then - results = results..'{"type":"gif","id":"'..math.random(100000000000000000)..'","gif_url":"'..data[n].url..'","thumb_url":"'..data[n].url..'"}' + results = results..'{"type":"gif","id":"'..id..'","gif_url":"'..data[n].url..'","thumb_url":"'..data[n].url..'"}' + id = id+1 else - results = results..'{"type":"photo","id":"'..math.random(100000000000000000)..'","photo_url":"'..data[n].url..'","thumb_url":"'..data[n].url..'"}' + results = results..'{"type":"photo","id":"'..id..'","photo_url":"'..data[n].url..'","thumb_url":"'..data[n].url..'"}' + id = id+1 end if n < #data then results = results..',' diff --git a/otouto/plugins/echo.lua b/otouto/plugins/echo.lua index 6aa3639..3d2135a 100644 --- a/otouto/plugins/echo.lua +++ b/otouto/plugins/echo.lua @@ -18,10 +18,10 @@ function echo:inline_callback(inline_query, config, matches) -- enable custom markdown button if text:match('%[.*%]%(.*%)') or text:match('%*.*%*') or text:match('_.*_') or text:match('`.*`') then - results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/custom.jpg","title":"Eigenes Markdown","description":"'..text..'","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}},' + results = results..'{"type":"article","id":"3","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/custom.jpg","title":"Eigenes Markdown","description":"'..text..'","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}},' end - local results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fett.jpg","title":"Fett","description":"*'..text..'*","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/kursiv.jpg","title":"Kursiv","description":"_'..text..'_","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fixedsys.jpg","title":"Feste Breite","description":"`'..text..'`","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}}]' + local results = results..'{"type":"article","id":"4","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fett.jpg","title":"Fett","description":"*'..text..'*","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},{"type":"article","id":"5","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/kursiv.jpg","title":"Kursiv","description":"_'..text..'_","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},{"type":"article","id":"6","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fixedsys.jpg","title":"Feste Breite","description":"`'..text..'`","input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}}]' utilities.answer_inline_query(self, inline_query, results, 0) end diff --git a/otouto/plugins/expand.lua b/otouto/plugins/expand.lua index c6cecd5..9184582 100644 --- a/otouto/plugins/expand.lua +++ b/otouto/plugins/expand.lua @@ -26,7 +26,7 @@ function expand:inline_callback(inline_query, config, matches) description = url end - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..title..'","description":"'..description..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' + local results = '[{"type":"article","id":"7","title":"'..title..'","description":"'..description..'","url":"'..url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..url..'"}}]' utilities.answer_inline_query(self, inline_query, results, 3600) end diff --git a/otouto/plugins/gMaps.lua b/otouto/plugins/gMaps.lua index dcdd03e..1abf59b 100644 --- a/otouto/plugins/gMaps.lua +++ b/otouto/plugins/gMaps.lua @@ -24,7 +24,7 @@ function gMaps:inline_callback(inline_query, config, matches) local coords = utilities.get_coords(place, config) if type(coords) == 'string' then utilities.answer_inline_query(self, inline_query) return end - local results = '[{"type":"venue","id":"'..math.random(100000000000000000)..'","latitude":'..coords.lat..',"longitude":'..coords.lon..',"title":"Ort","address":"'..coords.addr..'"}]' + local results = '[{"type":"venue","id":"10","latitude":'..coords.lat..',"longitude":'..coords.lon..',"title":"Ort","address":"'..coords.addr..'"}]' utilities.answer_inline_query(self, inline_query, results, 10000) end diff --git a/otouto/plugins/giphy.lua b/otouto/plugins/giphy.lua index dda1ed4..29bf42d 100644 --- a/otouto/plugins/giphy.lua +++ b/otouto/plugins/giphy.lua @@ -33,9 +33,11 @@ function giphy:inline_callback(inline_query, config, matches) if not data then utilities.answer_inline_query(self, inline_query) return end if not data[1] then utilities.answer_inline_query(self, inline_query) return end local results = '[' - + local id = 450 + for n in pairs(data) do - results = results..'{"type":"mpeg4_gif","id":"'..math.random(100000000000000000)..'","mpeg4_url":"'..data[n].images.original.mp4..'","thumb_url":"'..data[n].images.fixed_height.url..'","mpeg4_width":'..data[n].images.original.width..',"mp4_height":'..data[n].images.original.height..'}' + results = results..'{"type":"mpeg4_gif","id":"'..id..'","mpeg4_url":"'..data[n].images.original.mp4..'","thumb_url":"'..data[n].images.fixed_height.url..'","mpeg4_width":'..data[n].images.original.width..',"mp4_height":'..data[n].images.original.height..'}' + id = id+1 if n < #data then results = results..',' end diff --git a/otouto/plugins/googl.lua b/otouto/plugins/googl.lua index f0872aa..a3ab60b 100644 --- a/otouto/plugins/googl.lua +++ b/otouto/plugins/googl.lua @@ -27,7 +27,7 @@ function googl:inline_callback(inline_query, config, matches) local text, longUrl = googl:send_googl_info(shorturl) if not longUrl then utilities.answer_inline_query(self, inline_query) return end - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"Verlängerte URL","description":"'..longUrl..'","url":"'..longUrl..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..text..'"}}]' + local results = '[{"type":"article","id":"9","title":"Verlängerte URL","description":"'..longUrl..'","url":"'..longUrl..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/generic/internet.jpg","thumb_width":165,"thumb_height":150,"hide_url":true,"input_message_content":{"message_text":"'..text..'"}}]' utilities.answer_inline_query(self, inline_query, results, 1) end diff --git a/otouto/plugins/gps.lua b/otouto/plugins/gps.lua index 66a3add..037c4f6 100644 --- a/otouto/plugins/gps.lua +++ b/otouto/plugins/gps.lua @@ -25,7 +25,7 @@ function gps:inline_callback(inline_query, config, matches) local lat = matches[1] local lon = matches[2] - local results = '[{"type":"location","id":"'..math.random(100000000000000000)..'","latitude":'..lat..',"longitude":'..lon..',"title":"Standort"}]' + local results = '[{"type":"location","id":"8","latitude":'..lat..',"longitude":'..lon..',"title":"Standort"}]' utilities.answer_inline_query(self, inline_query, results, 10000) end diff --git a/otouto/plugins/help.lua b/otouto/plugins/help.lua index 034a13e..9e0b3a3 100644 --- a/otouto/plugins/help.lua +++ b/otouto/plugins/help.lua @@ -27,7 +27,7 @@ function help:inline_callback(inline_query, config, matches) local doc = doc:gsub('"', '\\"') local doc = doc:gsub('\\n', '\\\n') local chosen_plugin = utilities.get_word(plugin.command, 1) - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"Hilfe für '..chosen_plugin..'","description":"Hilfe für das Plugin \\"'..chosen_plugin..'\\" wird gepostet.","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/help/hilfe.jpg","input_message_content":{"message_text":"'..doc..'","parse_mode":"Markdown"}}]' + local results = '[{"type":"article","id":"9","title":"Hilfe für '..chosen_plugin..'","description":"Hilfe für das Plugin \\"'..chosen_plugin..'\\" wird gepostet.","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/help/hilfe.jpg","input_message_content":{"message_text":"'..doc..'","parse_mode":"Markdown"}}]' utilities.answer_inline_query(self, inline_query, results, 600, nil, nil, 'Hilfe anzeigen', 'hilfe_'..chosen_plugin) end end diff --git a/otouto/plugins/imdb.lua b/otouto/plugins/imdb.lua index 56e66bc..d133881 100644 --- a/otouto/plugins/imdb.lua +++ b/otouto/plugins/imdb.lua @@ -31,6 +31,7 @@ function imdb:inline_callback(inline_query, config, matches) if data.Response ~= "True" then utilities.answer_inline_query(self, inline_query) return end local results = '[' + local id = 500 for num in pairs(data.Search) do if num > 5 then break; @@ -56,7 +57,8 @@ function imdb:inline_callback(inline_query, config, matches) else img_url = movie_info.Poster end - results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..title..' ('..year..')","description":"'..description..'","url":"http://imdb.com/title/'..imdb_id..'","hide_url":true,"thumb_url":"'..img_url..'","reply_markup":{"inline_keyboard":[[{"text":"IMDb-Seite aufrufen","url":"http://imdb.com/title/'..imdb_id..'"}]]},"input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},' + results = results..'{"type":"article","id":"'..id..'","title":"'..title..' ('..year..')","description":"'..description..'","url":"http://imdb.com/title/'..imdb_id..'","hide_url":true,"thumb_url":"'..img_url..'","reply_markup":{"inline_keyboard":[[{"text":"IMDb-Seite aufrufen","url":"http://imdb.com/title/'..imdb_id..'"}]]},"input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}},' + id = id+1 end local results = results:sub(0, -2) diff --git a/otouto/plugins/qr.lua b/otouto/plugins/qr.lua index 1a5c437..ea368ea 100644 --- a/otouto/plugins/qr.lua +++ b/otouto/plugins/qr.lua @@ -74,8 +74,10 @@ function qr:inline_callback(inline_query, config, matches) if string.len(text) > 200 then utilities.answer_inline_query(self, inline_query) return end local image_url = qr:qr(text, nil, nil, 'jpg') if not image_url then utilities.answer_inline_query(self, inline_query) return end + + local id = 600 - local results = '[{"type":"photo","id":"'..math.random(100000000000000000)..'","photo_url":"'..image_url..'","thumb_url":"'..image_url..'","photo_width":600,"photo_height":600,"caption":"'..text..'"},' + local results = '[{"type":"photo","id":"'..id..'","photo_url":"'..image_url..'","thumb_url":"'..image_url..'","photo_width":600,"photo_height":600,"caption":"'..text..'"},' local i = 0 while i < 29 do @@ -83,7 +85,8 @@ function qr:inline_callback(inline_query, config, matches) local color = math.random(255) local bgcolor = math.random(255) local image_url = qr:qr(text, color, bgcolor, 'jpg') - results = results..'{"type":"photo","id":"'..math.random(100000000000000000)..'","photo_url":"'..image_url..'","thumb_url":"'..image_url..'","photo_width":600,"photo_height":600,"caption":"'..text..'"}' + id = id+1 + results = results..'{"type":"photo","id":"'..id..'","photo_url":"'..image_url..'","thumb_url":"'..image_url..'","photo_width":600,"photo_height":600,"caption":"'..text..'"}' if i < 29 then results = results..',' end diff --git a/otouto/plugins/respond.lua b/otouto/plugins/respond.lua index 8368d7d..d111a4e 100644 --- a/otouto/plugins/respond.lua +++ b/otouto/plugins/respond.lua @@ -40,7 +40,7 @@ function respond:inline_callback(inline_query, config, matches) elseif string.match(text, "[Nn][Bb][Cc]") or string.match(text, "[Ii][Dd][Cc]") or string.match(text, "[Kk][Aa]") or string.match(text, "[Ii][Dd][Kk]") then face = '¯\\\\\\_(ツ)_/¯' end - results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..face..'","input_message_content":{"message_text":"'..face..'"}}]' + results = '[{"type":"article","id":"8","title":"'..face..'","input_message_content":{"message_text":"'..face..'"}}]' utilities.answer_inline_query(self, inline_query, results, 9999) end diff --git a/otouto/plugins/tagesschau.lua b/otouto/plugins/tagesschau.lua index 3d7ee23..915dac6 100644 --- a/otouto/plugins/tagesschau.lua +++ b/otouto/plugins/tagesschau.lua @@ -55,7 +55,7 @@ function tagesschau:inline_callback(inline_query, config, matches) end local text = text:gsub('\n', '\\n') - local results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..headline..'","description":"'..shorttext..'","url":"'..full_url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/tagesschau/tagesschau.jpg","thumb_width":150,"thumb_height":150,"hide_url":true,"reply_markup":{"inline_keyboard":[[{"text":"Artikel aufrufen","url":"'..full_url..'"}]]},"input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}}]' + local results = '[{"type":"article","id":"11","title":"'..headline..'","description":"'..shorttext..'","url":"'..full_url..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/tagesschau/tagesschau.jpg","thumb_width":150,"thumb_height":150,"hide_url":true,"reply_markup":{"inline_keyboard":[[{"text":"Artikel aufrufen","url":"'..full_url..'"}]]},"input_message_content":{"message_text":"'..text..'","parse_mode":"HTML"}}]' utilities.answer_inline_query(self, inline_query, results, 7200) end diff --git a/otouto/plugins/time.lua b/otouto/plugins/time.lua index 8129e10..25359db 100644 --- a/otouto/plugins/time.lua +++ b/otouto/plugins/time.lua @@ -79,13 +79,13 @@ function time:inline_callback(inline_query, config, matches) if matches[1] == 'time' then local desc_time = os.date("%A, %d. %B %Y, %H:%M:%S Uhr") local cur_time = time:localize(os.date("%A, %d. %B %Y, *%H:%M:%S Uhr*")) - results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"Europa/Berlin","description":"'..desc_time..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/time/clock.jpg","input_message_content":{"message_text":"'..cur_time..'","parse_mode":"Markdown"}}]' + results = '[{"type":"article","id":"12","title":"Europa/Berlin","description":"'..desc_time..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/time/clock.jpg","input_message_content":{"message_text":"'..cur_time..'","parse_mode":"Markdown"}}]' else local coords = utilities.get_coords(matches[1], config) if type(coords) == 'string' then utilities.answer_inline_query(self, inline_query) return end local output, place, desc_time = time:get_time(coords) if not output then utilities.answer_inline_query(self, inline_query) return end - results = '[{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..place..'","description":"'..desc_time..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/time/clock.jpg","input_message_content":{"message_text":"'..output..'","parse_mode":"Markdown"}}]' + results = '[{"type":"article","id":"13","title":"'..place..'","description":"'..desc_time..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/time/clock.jpg","input_message_content":{"message_text":"'..output..'","parse_mode":"Markdown"}}]' end utilities.answer_inline_query(self, inline_query, results, 1) end diff --git a/otouto/plugins/wikipedia.lua b/otouto/plugins/wikipedia.lua index cd85d95..1eb0a95 100644 --- a/otouto/plugins/wikipedia.lua +++ b/otouto/plugins/wikipedia.lua @@ -188,10 +188,12 @@ function wikipedia:inline_callback(inline_query, config, matches) local results = '[' + local id = 700 for num in pairs(data.search) do local title, result, keyboard = wikipedia:wikintro(data.search[num].title, lang, true) if not title or not result or not keyboard then utilities.answer_inline_query(self, inline_query) return end - results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","title":"'..title..'","description":"'..wikipedia:snip_snippet(data.search[num].snippet)..'","url":"https://'..lang..'.wikipedia.org/wiki/'..URL.escape(title)..'","hide_url":true,"thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/wiki/logo.jpg","thumb_width":95,"thumb_height":86,"reply_markup":'..keyboard..',"input_message_content":{"message_text":"'..result..'","parse_mode":"HTML"}}' + results = results..'{"type":"article","id":"'..id..'","title":"'..title..'","description":"'..wikipedia:snip_snippet(data.search[num].snippet)..'","url":"https://'..lang..'.wikipedia.org/wiki/'..URL.escape(title)..'","hide_url":true,"thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/wiki/logo.jpg","thumb_width":95,"thumb_height":86,"reply_markup":'..keyboard..',"input_message_content":{"message_text":"'..result..'","parse_mode":"HTML"}}' + id = id+1 if num < #data.search then results = results..',' end diff --git a/otouto/plugins/youtube.lua b/otouto/plugins/youtube.lua index cfdc676..d40524a 100644 --- a/otouto/plugins/youtube.lua +++ b/otouto/plugins/youtube.lua @@ -170,6 +170,7 @@ function youtube:inline_callback(inline_query, config, matches) if not video_results.items[1] then return end local results = '[' + local id = 800 for num in pairs(video_results.items) do local video_url = 'https://www.youtube.com/watch?v='..video_results.items[num].id local thumb_url = get_yt_thumbnail(video_results.items[num]) @@ -195,7 +196,8 @@ function youtube:inline_callback(inline_query, config, matches) local uploader = video_results.items[num].snippet.channelTitle local description = uploader..', '..viewCount..' Views, '..readable_dur..likeCount..dislikeCount..commentCount - results = results..'{"type":"video","id":"'..math.random(100000000000000000)..'","video_url":"'..video_url..'","mime_type":"text/html","thumb_url":"'..thumb_url..'","title":"'..video_title..'","description":"'..description..'","video_duration":'..video_duration..',"input_message_content":{"message_text":"'..video_url..'"}}' + results = results..'{"type":"video","id":"'..id..'","video_url":"'..video_url..'","mime_type":"text/html","thumb_url":"'..thumb_url..'","title":"'..video_title..'","description":"'..description..'","video_duration":'..video_duration..',"input_message_content":{"message_text":"'..video_url..'"}}' + id = id+1 if num < #video_results.items then results = results..',' end