diff --git a/Program.cs b/Program.cs index fe8ba70..ea1a7e6 100644 --- a/Program.cs +++ b/Program.cs @@ -226,6 +226,39 @@ namespace chord } }; + userListList.OpenSelectedItem += args => + { + + }; + + Application.Top.KeyPress += async args => + { + switch (ShortcutHelper.GetModifiersKey(args.KeyEvent)) { + case Key.CtrlMask | Key.S: + serverListList.SetFocus(); + break; + case Key.CtrlMask | Key.C: + channelListList.SetFocus(); + break; + case Key.CtrlMask | Key.AltMask | Key.C: + chatBoxList.SetFocus(); + break; + case Key.CtrlMask | Key.U: + userListList.SetFocus(); + break; + case Key.CtrlMask | Key.Enter: + var restSharpClient = new RestClient("https://discord.com/api/v9"); + var restSharpReq = new RestRequest($"channels/{currentSelectedChannel}/messages"); + restSharpClient.AddDefaultHeader("Authorization", settings.Token); + restSharpReq.AddJsonBody(new { content = Encoding.UTF8.GetString(messageBoxText.Text.ToByteArray()) }); + + await restSharpClient.PostAsync>(restSharpReq); + + messageBoxText.Text = ""; + break; + } + }; + Application.Top.Add(window, menuBar); window.Add(serverList, channelList, messageBox, chatBox, userList); serverList.Add(serverListList); diff --git a/README.md b/README.md index 9322b95..cb0a1ef 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A C# Discord TUI Client ## Getting Started -Add a `settings.json` to `~/.config/chord`; +Add a `config.json` to `~/.config/chord`; ```json { diff --git a/TODO b/TODO index 417221b..bc1d363 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,4 @@ - Sort Channels by catagories - DMs - Loading Screen + - Hotkeys (Partially Done. Still some weird stuff that happens that idfk why happens)