From 6254e51e8c093fde2fbfdb98f6071c553ba3d09a Mon Sep 17 00:00:00 2001 From: Akamaru Date: Thu, 7 May 2015 19:49:26 +0200 Subject: [PATCH] updated plugins --- plugins/steam.lua | 22 +++++++++++++--------- plugins/url_title.lua | 4 +++- plugins/wallpaper.lua | 2 +- plugins/wallpaper_nsfw.lua | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/plugins/steam.lua b/plugins/steam.lua index 45ab5c5..6bc63dc 100644 --- a/plugins/steam.lua +++ b/plugins/steam.lua @@ -3,7 +3,7 @@ do local BASE_URL = 'http://store.steampowered.com/api/appdetails/' -local DESC_LENTH = 200 +local DESC_LENTH = 400 local function unescape(str) str = string.gsub( str, '<', '<' ) @@ -19,16 +19,17 @@ end local function get_steam_data (appid) local url = BASE_URL url = url..'?appids='..appid - url = url..'&cc=DE' + url = url..'&l=german&cc=DE' local res,code = http.request(url) if code ~= 200 then return nil end local data = json:decode(res)[appid].data return data end + local function price_info (data) local price = '' -- If no data is empty - + if data then local initial = data.initial local final = data.final or data.initial @@ -37,7 +38,7 @@ local function price_info (data) if data.discount_percent and initial ~= final then price = price..data.currency..' ('..data.discount_percent..'% OFF)' end - price = price..' (US)' + price = price..' €' end return price @@ -49,7 +50,7 @@ local function send_steam_data(data, receiver) local title = data.name local price = price_info(data.price_overview) - local text = title..' '..price..'\n'..description + local text = title..'\nPreis: '..price..'\n'..description local image_url = data.header_image local cb_extra = { receiver = receiver, @@ -67,10 +68,13 @@ local function run(msg, matches) end return { - description = "Grabs Steam info for Steam links.", - usage = {"store.steampowered.com Link"}, - patterns = {"http://store.steampowered.com/app/([0-9]+)",}, + description = "Steam-Info", + usage = "", + patterns = { + "store.steampowered.com/app/([0-9]+)", + "steamcommunity.com/app/([0-9]+)" + }, run = run } -end +end \ No newline at end of file diff --git a/plugins/url_title.lua b/plugins/url_title.lua index dee4a76..2cf73a8 100644 --- a/plugins/url_title.lua +++ b/plugins/url_title.lua @@ -36,11 +36,13 @@ function run(msg, matches) title == "Moved Permanently" or title == "Redirection" or title == "Object moved" or + string.match(title, "on Steam") or string.match(title, "521: Web server is down") or string.match(title, "deviantArt") or string.match(title, "twitch") or string.match(title, "eBay") or - string.match(title, "Twitch") then + string.match(title, "Twitch") or + string.match(msg.text, "steamcommunity.com/app/") then print('Invalide, da "'..title..'"') else return title diff --git a/plugins/wallpaper.lua b/plugins/wallpaper.lua index f170e48..e569dc2 100644 --- a/plugins/wallpaper.lua +++ b/plugins/wallpaper.lua @@ -39,7 +39,7 @@ function run(msg, matches) print("Bilder-URL: ", url) send_photo_from_url(receiver, url) --return "Source: "..url - return "Bild wird gesendet!" + return "Wallpaper wird gesendet!" end return { diff --git a/plugins/wallpaper_nsfw.lua b/plugins/wallpaper_nsfw.lua index b8d31e1..42b2254 100644 --- a/plugins/wallpaper_nsfw.lua +++ b/plugins/wallpaper_nsfw.lua @@ -38,7 +38,7 @@ function run(msg, matches) print("Bilder-URL: ", url) send_photo_from_url(receiver, url) --return "Source: "..url - return "Bild wird gesendet!" + return "Wallpaper wird gesendet!" end return {