updated plugins

This commit is contained in:
Akamaru 2015-05-07 19:49:26 +02:00
parent 202013fb9a
commit 6254e51e8c
4 changed files with 18 additions and 12 deletions

View File

@ -3,7 +3,7 @@
do do
local BASE_URL = 'http://store.steampowered.com/api/appdetails/' local BASE_URL = 'http://store.steampowered.com/api/appdetails/'
local DESC_LENTH = 200 local DESC_LENTH = 400
local function unescape(str) local function unescape(str)
str = string.gsub( str, '&lt;', '<' ) str = string.gsub( str, '&lt;', '<' )
@ -19,13 +19,14 @@ end
local function get_steam_data (appid) local function get_steam_data (appid)
local url = BASE_URL local url = BASE_URL
url = url..'?appids='..appid url = url..'?appids='..appid
url = url..'&cc=DE' url = url..'&l=german&cc=DE'
local res,code = http.request(url) local res,code = http.request(url)
if code ~= 200 then return nil end if code ~= 200 then return nil end
local data = json:decode(res)[appid].data local data = json:decode(res)[appid].data
return data return data
end end
local function price_info (data) local function price_info (data)
local price = '' -- If no data is empty local price = '' -- If no data is empty
@ -37,7 +38,7 @@ local function price_info (data)
if data.discount_percent and initial ~= final then if data.discount_percent and initial ~= final then
price = price..data.currency..' ('..data.discount_percent..'% OFF)' price = price..data.currency..' ('..data.discount_percent..'% OFF)'
end end
price = price..' (US)' price = price..' '
end end
return price return price
@ -49,7 +50,7 @@ local function send_steam_data(data, receiver)
local title = data.name local title = data.name
local price = price_info(data.price_overview) 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 image_url = data.header_image
local cb_extra = { local cb_extra = {
receiver = receiver, receiver = receiver,
@ -67,9 +68,12 @@ local function run(msg, matches)
end end
return { return {
description = "Grabs Steam info for Steam links.", description = "Steam-Info",
usage = {"store.steampowered.com Link"}, usage = "",
patterns = {"http://store.steampowered.com/app/([0-9]+)",}, patterns = {
"store.steampowered.com/app/([0-9]+)",
"steamcommunity.com/app/([0-9]+)"
},
run = run run = run
} }

View File

@ -36,11 +36,13 @@ function run(msg, matches)
title == "Moved Permanently" or title == "Moved Permanently" or
title == "Redirection" or title == "Redirection" or
title == "Object moved" or title == "Object moved" or
string.match(title, "on Steam") or
string.match(title, "521: Web server is down") or string.match(title, "521: Web server is down") or
string.match(title, "deviantArt") or string.match(title, "deviantArt") or
string.match(title, "twitch") or string.match(title, "twitch") or
string.match(title, "eBay</title>") or string.match(title, "eBay</title>") or
string.match(title, "Twitch") then string.match(title, "Twitch") or
string.match(msg.text, "steamcommunity.com/app/") then
print('Invalide, da "'..title..'"') print('Invalide, da "'..title..'"')
else else
return title return title

View File

@ -39,7 +39,7 @@ function run(msg, matches)
print("Bilder-URL: ", url) print("Bilder-URL: ", url)
send_photo_from_url(receiver, url) send_photo_from_url(receiver, url)
--return "Source: "..url --return "Source: "..url
return "Bild wird gesendet!" return "Wallpaper wird gesendet!"
end end
return { return {

View File

@ -38,7 +38,7 @@ function run(msg, matches)
print("Bilder-URL: ", url) print("Bilder-URL: ", url)
send_photo_from_url(receiver, url) send_photo_from_url(receiver, url)
--return "Source: "..url --return "Source: "..url
return "Bild wird gesendet!" return "Wallpaper wird gesendet!"
end end
return { return {