inrole now shows the number of users in a given role

This commit is contained in:
Kwoth 2017-03-06 04:20:06 +01:00
parent 504da01917
commit f1157f424b

View File

@ -225,8 +225,9 @@ namespace NadekoBot.Modules.Utility
var usrs = (await Context.Guild.GetUsersAsync()).ToArray(); var usrs = (await Context.Guild.GetUsersAsync()).ToArray();
foreach (var role in roles.Where(r => r.Id != Context.Guild.Id)) foreach (var role in roles.Where(r => r.Id != Context.Guild.Id))
{ {
send += $"```css\n[{role.Name}]\n"; var roleUsers = usrs.Where(u => u.RoleIds.Contains(role.Id)).Select(u => u.ToString()).ToArray();
send += string.Join(", ", usrs.Where(u => u.RoleIds.Contains(role.Id)).Select(u => u.ToString())); send += $"```css\n[{role.Name}] ({roleUsers.Length})\n";
send += string.Join(", ", roleUsers);
send += "\n```"; send += "\n```";
} }
var usr = (IGuildUser)Context.User; var usr = (IGuildUser)Context.User;