Esempio n. 1
0
        public async Task RemindPostponeLeaderboardAsync()
        {
            using var service = GetService <ReminderService>();

            var leaderboard = await service.Service.GetLeaderboard();

            var items = leaderboard.ToDictionary(o => $"*{o.Item1.GetDisplayName(true)}*", o => $"**{o.Item2.FormatWithSpaces()}x**");

            var board = new LeaderboardBuilder("Leaderboard nejvíc odkládajících osob", Context.User, null, null);

            board.SetData(items);

            await ReplyAsync(embed : board.Build());
        }
Esempio n. 2
0
        private async Task <Embed> CreateLeaderboardResultAsync(List <Tuple <ulong, long> > leaderboardData, int skip)
        {
            var leaderboard = new LeaderboardBuilder("Body leaderboard", Context.User, null, null)
            {
                Skip = skip
            };

            foreach (var item in leaderboardData)
            {
                var user = await Context.Guild.GetUserFromGuildAsync(item.Item1);

                var username = user == null ? "Neexistující uživatel" : user.GetDisplayName(true);

                leaderboard.AddItem(username, FormatPointsValue(item.Item2));
            }

            return(leaderboard.Build());
        }
Esempio n. 3
0
        public async Task ChannelboardAsync()
        {
            using var service = GetService <ChannelStats>();

            var user = await Context.User.ConvertToGuildUserAsync(Context.Guild);

            var data = await service.Service.GetChannelboardDataAsync(Context.Guild, user, ChannelStats.ChannelboardTakeTop);

            if (data.Count == 0)
            {
                await Context.Message.Author.SendPrivateMessageAsync("Ještě nejsou zaznamenány žádné kanály pro tento server.");
            }

            var items = data.ToDictionary(o => o.Channel.Name, o => o.Count.FormatWithSpaces());

            var leaderboard = new LeaderboardBuilder("Channel leaderboard", Context.User, null, null);

            leaderboard.SetData(items);

            await Context.Message.Author.SendPrivateMessageAsync(embed : leaderboard.Build());
        }