public async Task leaderboard([Summary("The amount of users to show")] int length = 10) { List <List <DateTimeOffset> > l = await MessageCollector.collectMessagesList(Context.Guild.Users.ToArray(), Context.Guild); List <SocketGuildUser> users = Context.Guild.Users.ToList(); //l = l.OrderBy(item => item.Count).Reverse().ToList(); List <List <DateTimeOffset> > orderedL = l.OrderBy(item => item.Count).Reverse().ToList(); string output = "```"; int offset = 0; for (int i = 0; i < length + offset && i < l.Count; i++) { List <DateTimeOffset> m = orderedL[i]; SocketGuildUser u = users[l.IndexOf(m)]; if (u.IsBot) { offset++; continue; } output += (i + 1 - offset) + ". " + u.Username + " | " + m.Count + " messages\n"; } output += "```"; await Context.Channel.SendMessageAsync(output); }