feat: don't render role if it has no members in it
This commit is contained in:
parent
6b75d8e446
commit
23028d29ed
1 changed files with 13 additions and 11 deletions
24
Program.cs
24
Program.cs
|
@ -253,21 +253,23 @@ namespace chord
|
||||||
|
|
||||||
foreach (var roles in client.GetGuild(currentSelectedGuild).Roles)
|
foreach (var roles in client.GetGuild(currentSelectedGuild).Roles)
|
||||||
{
|
{
|
||||||
var roleName = Regex.Replace(roles.Name, @"[^\u0000-\u007F]+", string.Empty);
|
if (roles.Members.Count() != 0) {
|
||||||
var node = new TreeNode(roleName);
|
var roleName = Regex.Replace(roles.Name, @"[^\u0000-\u007F]+", string.Empty);
|
||||||
|
var node = new TreeNode(roleName);
|
||||||
|
|
||||||
foreach (var users in roles.Members)
|
foreach (var users in roles.Members)
|
||||||
{
|
{
|
||||||
var userName = Regex.Replace(users.Username, @"[^\u0000-\u007F]+", string.Empty);
|
var userName = Regex.Replace(users.Username, @"[^\u0000-\u007F]+", string.Empty);
|
||||||
|
|
||||||
string userNick = string.Empty;
|
string userNick = string.Empty;
|
||||||
if (users.Nickname != null)
|
if (users.Nickname != null)
|
||||||
userNick = Regex.Replace(users.Nickname, @"[^\u0000-\u007F]+", string.Empty);
|
userNick = Regex.Replace(users.Nickname, @"[^\u0000-\u007F]+", string.Empty);
|
||||||
|
|
||||||
node.Children.Add(new TreeNode($"{userName}#{users.Discriminator} ({userNick})"));
|
node.Children.Add(new TreeNode($"{userName}#{users.Discriminator} ({userNick})"));
|
||||||
|
}
|
||||||
|
|
||||||
|
rolesDict.TryAdd(roles.Position, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
rolesDict.TryAdd(roles.Position, node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var role in rolesDict)
|
foreach (var role in rolesDict)
|
||||||
|
|
Reference in a new issue