diff --git a/miku/plugins/nintendo_search.lua b/miku/plugins/nintendo_search.lua index dcb9c52..d150d83 100644 --- a/miku/plugins/nintendo_search.lua +++ b/miku/plugins/nintendo_search.lua @@ -1,8 +1,8 @@ local nintendo_search = {} nintendo_search.triggers = { - '/nin (.+)', - '/nintendo (.+)' + '^/nin (.+)', + '^/nintendo (.+)' } function nintendo_search:get_info(gametitle) @@ -12,7 +12,7 @@ function nintendo_search:get_info(gametitle) local data = json.decode(res).response.docs[1] if not data then return 'Nichts gefunden!' end - local title = data.title + local title = ''..data.title..'' if data.publisher then publish = ' von '..data.publisher..'' @@ -32,17 +32,23 @@ function nintendo_search:get_info(gametitle) fsk = '\n'..data.pretty_agerating_s..'' end + if data.players_to == 1 then + player = '\n1 Spieler' + else + player = '\n1 bis '..data.players_to..' Spieler' + end + local link = '\nWebseite besuchen' - local description = string.sub(unescape(data.excerpt:gsub("%b<>", "")), 1, 300) - local release = data.pretty_date_s + local description = '\n\n'..string.sub(unescape(data.excerpt:gsub("%b<>", "")), 1, 300)..'' + local release = '\nRelease: '..data.pretty_date_s if data.image_url_h2x1_s then - image_url = 'http://anditest.perseus.uberspace.de/img.php?url=https:'..data.image_url_h2x1_s + image_url = ' ' else - image_url = 'http://anditest.perseus.uberspace.de/img.php?url=https:'..data.image_url + image_url = ' ' end - local text = ''..title..''..publish..system..' '..fsk..'\n'..'Release: '..release..link..'\n\n'..description..'' + local text = title..publish..system..image_url..fsk..player..release..link..description return text end diff --git a/miku/plugins/playstation_store.lua b/miku/plugins/playstation_store.lua index 555d427..8143291 100644 --- a/miku/plugins/playstation_store.lua +++ b/miku/plugins/playstation_store.lua @@ -2,6 +2,7 @@ local playstation_store = {} playstation_store.triggers = { 'store.playstation.com/#!/([A-Za-z]+)%-([A-Za-z]+)/.*/cid=(.+)', + 'store.playstation.com/([A-Za-z]+)%-([A-Za-z]+)/product/(.+)', 'store.sonyentertainmentnetwork.com/#!/([A-Za-z]+)%-([A-Za-z]+)/.*/cid=(.+)' } @@ -18,14 +19,14 @@ function playstation_store:get_info(country_code, game_id) local data = json.decode(res) if not data then return nil end - local title = data.name + local title = ''..data.name..'' if data.provider_name then - publish = ' von '..data.provider_name + publish = ' von '..data.provider_name..'' else publish = '' end if data.playable_platform then - system = ' für '..data.playable_platform[1] + system = ' für '..data.playable_platform[1]..'' else system = '' end @@ -45,40 +46,36 @@ function playstation_store:get_info(country_code, game_id) end ]] - price = data.skus[1].rewards[1].display_price..' statt '..data.default_sku.display_price..' (Spare '..data.skus[1].rewards[1].discount..'%)'--..psplus + price = '\nPreis: '..data.skus[1].rewards[1].display_price..' statt '..data.default_sku.display_price..' (Spare '..data.skus[1].rewards[1].discount..'%)'--..psplus else - price = data.default_sku.display_price--..psplus + price = '\nPreis: '..data.default_sku.display_price --..psplus end else - price = 'N/A' + price = '' end - local fsk = data.age_limit - local description = string.sub(unescape(data.long_desc:gsub("%b<>", "")), 1, 300)..'...' - local release = makeOurDate(data.release_date) + local fsk = '\nFreigegeben ab: '..data.age_limit + local description = '\n\n'..string.sub(unescape(data.long_desc:gsub("%b<>", "")), 1, 300)..'...' + local release = '\nRelease: '..makeOurDate(data.release_date) if data.images[4].type ~= 10 then - image_url = data.images[4].url + image_url = ' ' else - image_url = data.images[1].url + image_url = ' ' end - local text = ''..title..''..publish..system..types..'\nPreis: '..price..'\nFreigegeben ab: '..fsk..'\n'..'Release: '..release..'\n\nBeschreibung:\n'..description..'' + local text = title..publish..system..types..image_url..price..fsk..release..description - return text, image_url + return text end function playstation_store:action(msg, config, matches) local country_code = string.upper(matches[2])..'/'..matches[1] local game_id = matches[3] - local text, image_url = playstation_store:get_info(country_code, game_id) + local text = playstation_store:get_info(country_code, game_id) if not text then - utilities.send_reply(msg, chat, config.errors.result) + utilities.send_reply(msg, config.errors.results) return end - if image_url then - utilities.send_typing(msg.chat.id, 'upload_photo') - utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id) - end - utilities.send_reply(msg, text, 'HTML') + utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html') end return playstation_store \ No newline at end of file