Beispiel #1
0
        public async Task Top10Total()
        {
            //Get all accounts Pootis-Bot has and sort them
            List <UserAccount> totalUsers = UserAccountsManager.GetAllUserAccounts().ToList();

            totalUsers.Sort(new SortUserAccount());
            totalUsers.Reverse();

            StringBuilder format = new StringBuilder();

            format.Append($"```csharp\n 📋 Top 10 {Global.BotName} Accounts\n ========================\n");

            int count = 1;

            foreach (UserAccount user in totalUsers.Where(user => count <= 10))
            {
                format.Append(
                    $"\n [{count}] -- # {Context.Client.GetUser(user.Id)}\n         └ Level: {user.LevelNumber}\n         └ Xp: {user.Xp}");
                count++;
            }

            UserAccount userAccount = UserAccountsManager.GetAccount((SocketGuildUser)Context.User);

            format.Append(
                $"\n------------------------\n 😊 {Context.User.Username}'s Position: {totalUsers.IndexOf(userAccount) + 1}      {Context.User.Username}'s Level: {userAccount.LevelNumber}      {Context.User.Username}'s Xp: {userAccount.Xp}```");

            await Context.Channel.SendMessageAsync(format.ToString());
        }