Archived
0
0
Fork 0

feat: sorted users by role

This commit is contained in:
Daryl Ronningen 2021-12-16 18:44:44 -07:00
parent 5be86f13f4
commit dc416c085c
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
2 changed files with 22 additions and 6 deletions

View file

@ -129,7 +129,7 @@ namespace chord
Y = 0 Y = 0
}; };
var userListList = new ListView var userListTree = new TreeView
{ {
X = 0, X = 0,
Y = 0, Y = 0,
@ -216,9 +216,24 @@ namespace chord
chatBoxList.ScrollDown(currentChannelMessages.Count - chatBoxList.Bounds.Height); chatBoxList.ScrollDown(currentChannelMessages.Count - chatBoxList.Bounds.Height);
chatBoxList.SelectedItem = currentChannelMessages.Count - 1; chatBoxList.SelectedItem = currentChannelMessages.Count - 1;
await userListList.SetSourceAsync(client.GetGuild(currentSelectedGuild).GetTextChannel(currentSelectedChannel) var rolesDict = new SortedDictionary<int, TreeNode>();
.Users
.ToList()); foreach (var roles in client.GetGuild(currentSelectedGuild).Roles)
{
var node = new TreeNode(roles.Name);
foreach (var users in roles.Members)
{
node.Children.Add(new TreeNode($"{users.Username}#{users.Discriminator} ({users.Nickname})"));
}
rolesDict.Add(roles.Position, node);
}
foreach (var role in rolesDict)
{
userListTree.AddObject(role.Value);
}
}; };
messageBoxSend.Clicked += async () => messageBoxSend.Clicked += async () =>
@ -267,7 +282,7 @@ namespace chord
chatBoxList.SetFocus(); chatBoxList.SetFocus();
break; break;
case Key.CtrlMask | Key.U: case Key.CtrlMask | Key.U:
userListList.SetFocus(); userListTree.SetFocus();
break; break;
case Key.CtrlMask | Key.Enter: case Key.CtrlMask | Key.Enter:
var restSharpClient = new RestClient("https://discord.com/api/v9"); var restSharpClient = new RestClient("https://discord.com/api/v9");
@ -288,7 +303,7 @@ namespace chord
channelList.Add(channelListTree); channelList.Add(channelListTree);
chatBox.Add(chatBoxList); chatBox.Add(chatBoxList);
messageBox.Add(messageBoxText, messageBoxSend); messageBox.Add(messageBoxText, messageBoxSend);
userList.Add(userListList); userList.Add(userListTree);
return Task.CompletedTask; return Task.CompletedTask;
}; };

1
TODO
View file

@ -5,3 +5,4 @@
- DMs - DMs
- Loading Screen - Loading Screen
- Hotkeys (Partially Done. Still some weird stuff that happens that idfk why happens) - Hotkeys (Partially Done. Still some weird stuff that happens that idfk why happens)
- User roles sorting (DONE)