/// <summary> /// Will call RLS Api to get current season statistics /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async void GetRocketLeagueStats(object sender, RoutedEventArgs e) { string results = ""; try { var client = new RLSClient(rocketLeagueAPIKey); var player = await client.GetPlayerAsync(RlsPlatform.Steam, userKey.ToString()); var currentSeason = player.RankedSeasons.FirstOrDefault(x => x.Key == RlsSeason.Seven); if (currentSeason.Value != null) { Debug.Write("Rocket League player name: " + player.DisplayName); results += ("Welcome " + player.DisplayName + "!\n\n"); foreach (var playerRank in currentSeason.Value) { Debug.Write(playerRank.Key + ": " + playerRank.Value.RankPoints + " rating"); results += (playerRank.Key + ": " + playerRank.Value.RankPoints + " rating\n"); } } } catch (Exception error) { Debug.Print(error.Message); MessageBoxResult errBox = MessageBox.Show("No player found"); } RLStatsLabel.Content = results; }
public RlCommands(SteamApi steam, ChannelCheck cc, IConfigurationRoot config) { _steam = steam; _cc = cc; _config = config; _rlStatsKey = $"{_config["RlStatsApi"]}"; _prefix = _config["prefix"]; _rlsClient = new RLSClient(_rlStatsKey); }
//Get the player out of the Information entered above public static async Task <Player> getPlayerTask() { client = new RLSClient(config.key); bar.Value = 2; player = await client.GetPlayerAsync(plat, name); return(player); }
public async Task rlstats([Remainder] string steamid = null) { string token = File.ReadAllText("RLToken.txt"); if (steamid != null) { var _client = new RLSClient(token); //string msg = ""; //string stats = ""; var player = await _client.GetPlayerAsync(RlsPlatform.Steam, steamid); //var tier = await _client.GetTiersAsync(); //var playerSeasonFive = player.RankedSeasons.FirstOrDefault(x => x.Key == RlsSeason.Seven); //stats = $"**Wins**: {player.Stats.Wins}\n" + // $"**Mvps**: {player.Stats.Mvps}\n" + // $"**Goals**: {player.Stats.Goals}\n" + // $"**Assists**: {player.Stats.Assists}\n" + // $"**Saves**: {player.Stats.Saves}\n" + // $"**Shots**: {player.Stats.Shots}"; //if (playerSeasonFive.Value != null) //{ // foreach (var playerRank in playerSeasonFive.Value) // { // var displayTier = tier.FirstOrDefault(x => x.Id == playerRank.Value.Tier); // msg += $"**{playerRank.Key}**: {displayTier.Name} Div. {playerRank.Value.Division + 1}\n" + // $"\n"; // } //} //var embed1 = new EmbedBuilder() //.WithColor(new Color(color)) //.WithTitle(player.DisplayName) //.WithDescription($"For more info head over to [Rocket League tracker](https://rocketleague.tracker.network/profile/steam/{steamid})") //.WithThumbnailUrl(player.Avatar) //.AddInlineField("Stats", stats) //.AddInlineField("Ranking", msg); //await Context.Channel.SendMessageAsync("", embed: embed1); await Context.Channel.SendMessageAsync("http://signature.rocketleaguestats.com/normal/steam/" + player.UniqueId + ".png"); } }
private static async Task Run() { // Grabs RLS api key from environment variables. var apiKey = Environment.GetEnvironmentVariable("RLS_API_KEY"); // Initialize RLSClient. var client = new RLSClient(apiKey); // Retrieve a single player. var player = await client.GetPlayerAsync(RlsPlatform.Steam, "76561198033338223"); var playerSeasonSix = player.RankedSeasons.FirstOrDefault(x => x.Key == RlsSeason.Seven); if (playerSeasonSix.Value != null) { Console.WriteLine($"# Player: {player.DisplayName}"); foreach (var playerRank in playerSeasonSix.Value) { Console.WriteLine($"{playerRank.Key}: {playerRank.Value.RankPoints} rating"); } } // Retrieve multiple players. var players = await client.GetPlayersAsync(new[] { new PlayerBatchRequest(RlsPlatform.Steam, "76561198033338223"), new PlayerBatchRequest(RlsPlatform.Ps4, "Wizwonk"), new PlayerBatchRequest(RlsPlatform.Xbox, "Loubleezy") }); Console.WriteLine("Finished multiple players."); // Search for players. var players2 = await client.SearchPlayerAsync("AeonLucid"); Console.WriteLine("Finished search for players."); // Retrieve the top 100 players of a ranked playlist. var topPlayers = await client.GetLeaderboardRankedAsync(RlsPlaylistRanked.Standard); Console.WriteLine("Finished top 100 players of a ranked playlist."); // Retrieve the top 100 players of a stat type. var topPlayers2 = await client.GetLeaderboardStatAsync(RlsStatType.Wins); Console.WriteLine("Finished top 100 players of a stat type."); // Retrieve platform data. var platforms = await client.GetPlatformsAsync(); Console.WriteLine("Finished platform data."); // Retrieve seasons data. var seasons = await client.GetSeasonsAsync(); Console.WriteLine("Finished seasons data."); // Retrieve playlist (& population) data. var playlists = await client.GetPlaylistsAsync(); Console.WriteLine("Finished playlists data."); // Retrieve tiers data. var tiers = await client.GetTiersAsync(); Console.WriteLine("Finished tiers data."); // Retrieve tier data of a specific season. var tiers2 = await client.GetTiersAsync(RlsSeason.One); Console.WriteLine("Finished tier data of a specific season."); Console.WriteLine("Finished."); }
public SetUpModule() { _RLSClient = new RLSClient(ConfigurationManager.AppSettings["RLSAPI_TOKEN"]); }