add OwnedGames to Steam plugin

This commit is contained in:
dennydai 2016-02-07 20:34:08 +08:00
parent d8794a0336
commit 0297df5d37
2 changed files with 11 additions and 3 deletions

View File

@ -5,7 +5,7 @@ define('OWNER_NAME', 'YOUR_NAME');
define('BOT_NAME', 'D_bot'); //Now For Telegram-Bot Only
define('HELP_BEGIN', "The_Sentence_Before_Help_Command");
define('HELP_END', "The_Sentence_After_Help_Command");
$TAGs = array('#','/','!'); //array for commands
$TAGs = array('\'','#','/','!'); //array for commands
//For Telegram-Bot

View File

@ -6,18 +6,26 @@ $plugin_steam_steamid = json_decode(file_get_contents('http://api.steampowered.c
if ($plugin_steam_steamid['response']['success'] == 1){
$plugin_steam_steamid = $plugin_steam_steamid['response']['steamid'];
$plugin_steam_PlayerSummaries = json_decode(file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key='.PLUGIN_STEAM_KEY.'&steamids='.$plugin_steam_steamid),true);
$plugin_steam_PlayerLevel = json_decode(file_get_contents('https://api.steampowered.com/IPlayerService/GetSteamLevel/v1?key='.PLUGIN_STEAM_KEY.'&steamid='.$plugin_steam_steamid),true);
$plugin_steam_OwnedGames = json_decode(file_get_contents('https://api.steampowered.com/IPlayerService/GetOwnedGames/v1?include_played_free_games=1&include_appinfo=1&key='.PLUGIN_STEAM_KEY.'&steamid='.$plugin_steam_steamid),true);
$plugin_steam_RecentlyPlayedGames = json_decode(file_get_contents('http://api.steampowered.com/IPlayerService/GetRecentlyPlayedGames/v1?key='.PLUGIN_STEAM_KEY.'&steamid='.$plugin_steam_steamid."&count=1"),true);
$personastate = $plugin_steam_PlayerSummaries['response']['players'][0]['personastate'];
if ($personastate == 0){$personastate = 'Offline (or Private) ';}elseif($personastate == 1){$personastate = 'Online';}elseif($personastate == 2){$personastate = 'Busy';}elseif($personastate == 3){$personastate = 'Away';}elseif($personastate == 4){$personastate = 'Snooze';}elseif($personastate == 5){$personastate = 'Looking to trade';}elseif($personastate == 6){$personastate = 'Looking to play';}
if (array_key_exists('gameextrainfo', $plugin_steam_PlayerSummaries['response']['players'][0])){$plugin_steam_playing = "Is Playing: ".$plugin_steam_PlayerSummaries['response']['players'][0]['gameextrainfo']."\n";}
//personastate
$plugin_steam_OwnedGames_String = '[';
foreach ($plugin_steam_OwnedGames['response']['games'] as $plugin_steam_OwnedGames_Foreach) {
$plugin_steam_OwnedGames_String .= ' '.$plugin_steam_OwnedGames_Foreach['name'].' ] [';
}
$msg = "Personal Name: ".$plugin_steam_PlayerSummaries['response']['players'][0]['personaname']."\n".
"Steam Level: ".$plugin_steam_PlayerLevel['response']['player_level']."\n".
"State: ".$personastate."\n".
$plugin_steam_playing.
//"Recently Played: ".$plugin_steam_RecentlyPlayedGames['response']['games'][0]['name']."\n".
"Last Log Off (".date('T')."): ".date("Y-m-d H:i:s", $plugin_steam_PlayerSummaries['response']['players'][0]['lastlogoff'])."\n".
"Profile URL: ".$plugin_steam_PlayerSummaries['response']['players'][0]['profileurl']."\n".
"";
"Owned Games (".$plugin_steam_OwnedGames['response']['game_count']."): ".substr($plugin_steam_OwnedGames_String, 0, strlen($plugin_steam_OwnedGames_String)-1);
}else{
$msg = "User Not Found :(";
}