From 4f11455bc5c0259587c1cd6d7b40e1f54414c267 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Sun, 11 Jun 2017 23:54:22 +0200 Subject: [PATCH] Plex: Fix wenn kein Ergebnis --- miku/plugins/plex.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/miku/plugins/plex.lua b/miku/plugins/plex.lua index ac2a241..e331a28 100644 --- a/miku/plugins/plex.lua +++ b/miku/plugins/plex.lua @@ -39,7 +39,9 @@ function plex:get_plex(query) } local ok, response_code, response_headers, response_status_line = http.request(request_constructor) if not ok then return 'NOTOK' end - local data = json.decode(table.concat(response_body)).MediaContainer.Metadata[1] + local raw = json.decode(table.concat(response_body)).MediaContainer + if raw.size == 4 then return 'NOTOK' end + local data = raw.Metadata[1] local title = ''..data.title..'' @@ -198,7 +200,7 @@ function plex:action(msg, config) utilities.send_reply(msg, config.errors.results) return elseif text == 'NOTOK' then - utilities.send_reply(msg, config.errors.connection) + utilities.send_reply(msg, 'Keine Ergebnisse gefunden.') return end