Exemplo n.º 1
0
        internal async Task <DailyLeaderboard> GetNewCurrentDailyLeaderboardAsync(
            DateTime date,
            Product product,
            CancellationToken cancellationToken)
        {
            var name        = GetDailyLeaderboardName(product.Name, date);
            var leaderboard = await steamClientApiClient.FindLeaderboardAsync(appId, name, cancellationToken).ConfigureAwait(false);

            var displayName = $"Daily ({date.ToString("yyyy-MM-dd")})";

            if (product.Name != "classic")
            {
                displayName += $" ({product.DisplayName})";
            }

            return(new DailyLeaderboard
            {
                LeaderboardId = leaderboard.ID,
                Name = name,
                DisplayName = displayName,
                IsProduction = true,
                ProductId = product.ProductId,
                Date = date,
            });
        }
        private static async Task UpdateLeaderboardAsync(ISteamClientApiClient steamClient, Leaderboard leaderboard)
        {
            try
            {
                var response = await steamClient.FindLeaderboardAsync(247080, leaderboard.Name).ConfigureAwait(false);

                leaderboard.LeaderboardId = response.ID;
            }
            catch (SteamClientApiException)
            {
                Log.Warn($"Leaderboard named '{leaderboard.Name}' could not be found.");
            }
        }