Beispiel #1
0
        public async Task GameLeaderboardCommand([Remainder] string game)
        {
            var _leaderboard = LeaderboardService.GetGameLeaderboard(game).ToList();

            var _embed = new EmbedBuilder()
                         .WithColor(Color.Blue)
                         .WithThumbnailUrl(Context.Guild.IconUrl)
                         .WithTitle($"Game leaderboards for: {Context.Guild.Name} on {game} ({_leaderboard.Count})");

            // Build leaderboard
            StringBuilder _builder = new StringBuilder();
            int           _i       = 0;

            foreach (var entry in _leaderboard)
            {
                if (_i == 10)
                {
                    break;
                }

                var _user = Context.Guild.GetUser(entry.EntryStats.UserId);

                _builder.Append(
                    $"\n**{_leaderboard.IndexOf(entry) + 1}.)** " +
                    $"**{_user.Mention ?? (_user.Username + "#" + _user.Discriminator)}**" +
                    $" - `{Math.Round(entry.Time.TotalHours, 1)}` hours.");

                _i++;
            }
            _embed.Description = _builder.ToString();

            await ReplyAsync("", false, _embed.Build());
        }
Beispiel #2
0
        public async Task GameHoursCommand()
        {
            var _pLeaderboard = LeaderboardService.GetPersonalGameLeaderboard(Context.User.Id).ToList();

            var _embed = new EmbedBuilder()
                         .WithColor(Color.Blue)
                         .WithThumbnailUrl(Context.User.GetAvatarUrl())
                         .WithTitle($"Personal game leaderboard for: {Context.User.Username}#{Context.User.Discriminator} ({_pLeaderboard.Count})");

            // Build personal leaderboard
            StringBuilder _builder = new StringBuilder();
            int           _i       = 0;

            foreach (var entry in _pLeaderboard)
            {
                if (_i == 10)
                {
                    break;
                }

                _builder.Append(
                    $"\n**{_pLeaderboard.IndexOf(entry) + 1}.)** " +
                    $"**{entry.EntryStats.Game}** " +
                    $"`{Math.Round(entry.Time.TotalHours, 1)}` hours.");

                _i++;
            }
            _embed.Description = _builder.ToString();

            await ReplyAsync("", false, _embed.Build());
        }
Beispiel #3
0
        public async Task GameHoursCommand([Remainder] string game)
        {
            var _hours = LeaderboardService.GetGameHours(Context.Guild.Id, Context.User.Id, game);

            if (_hours == null)
            {
                await Respond.SendResponse(Context, $"You have no recorded hours for: `{game}`.");

                return;
            }

            await Respond.SendResponse(Context, $"You have `{Math.Round(_hours.Time.TotalHours, 2)}` hours on *{game}*.");
        }
Beispiel #4
0
        public async Task VoiceLevelCommand(IGuildUser user = null)
        {
            var _user    = user ?? Context.User as IGuildUser;
            var _userRec = LeaderboardService.GetVoiceHours(Context.Guild.Id, _user.Id);

            var _embed = new EmbedBuilder()
                         .WithColor(Color.Blue)
                         .WithTitle($"Hours in voice: {_user.Username} for {Context.Guild.Name}")
                         .WithDescription($"Total: `{Math.Round(_userRec.TotalTime.TotalHours), 2}` hours" +
                                          $"\nTime Awake: `{Math.Round(_userRec.TimeAwake.TotalHours), 2}` hours" +
                                          $"\nTime Muted: `{Math.Round(_userRec.TimeMuted.TotalHours), 2}` hours" +
                                          $"\nTime Server Muted: `{Math.Round(_userRec.TimeServerMuted.TotalHours), 2}` hours" +
                                          $"\nTime Deafened: `{Math.Round(_userRec.TimeDeafened.TotalHours), 2}` hours");

            await ReplyAsync(embed : _embed.Build());
        }
Beispiel #5
0
        public async Task GameLeaderboardCommand()
        {
            var _leaderboard = LeaderboardService.GetGameLeaderboard(Context.Guild).OrderByDescending(s => s.Time).ToList();
            var _userHighest = _leaderboard
                               .Where(s => s.EntryStats.UserId == Context.User.Id)
                               .OrderByDescending(s => s.Time)
                               .FirstOrDefault();

            var _embed = new EmbedBuilder()
                         .WithColor(Color.Blue)
                         .WithThumbnailUrl(Context.Guild.IconUrl)
                         .WithTitle($"Game leaderboards for: {Context.Guild.Name} ({_leaderboard.Count})");

            // Build leaderboard
            StringBuilder _builder = new StringBuilder();
            int           _i       = 0;

            foreach (var entry in _leaderboard)
            {
                if (_i == 10)
                {
                    break;
                }

                var _user = Context.Guild.GetUser(entry.EntryStats.UserId);

                _builder.Append(
                    $"\n**{_leaderboard.IndexOf(entry) + 1}.)** " +
                    $"**{_user.Mention ?? (_user.Username + "#" + _user.Discriminator)}**" +
                    $" - *{entry.EntryStats.Game}*" +
                    $" - `{Math.Round(entry.Time.TotalHours, 1)}` hours.");

                _i++;
            }

            _builder.Append($"\n\n**Your highest position**:" +
                            $"\n**{_leaderboard.IndexOf(_userHighest) + 1}.)** " +
                            $"*{_userHighest.EntryStats.Game}* " +
                            $"- `{Math.Round(_userHighest.Time.TotalHours, 1)}` hours.");

            _embed.Description = _builder.ToString();

            await ReplyAsync("", false, _embed.Build());
        }
Beispiel #6
0
        public async Task VoiceLeaderboardCommand()
        {
            var _leaderboard = LeaderboardService.GetVoiceLeaderboard(Context.Guild).OrderByDescending(s => s.TotalTime).ToList();

            var _embed = new EmbedBuilder()
                         .WithColor(Color.Blue)
                         .WithTitle($"Voice leaderboard for: {Context.Guild.Name} ({Context.Guild.Users.Count})");

            StringBuilder _builder = new StringBuilder();

            foreach (var user in _leaderboard)
            {
                var _user = Context.Guild.GetUser(user.EntryStats.UserId);

                _builder.Append($"\n" +
                                $"`{_leaderboard.IndexOf(user) + 1}.)` " +
                                $"**{_user.Mention ?? (_user.Username + "#" + _user.Discriminator)}** " +
                                $"- Total Time: `{Math.Round(user.TotalTime.TotalHours, 2)}` hours");
            }
            _embed.Description = _builder.ToString();

            await ReplyAsync(embed : _embed.Build());
        }