diff --git a/telegram/Command.cs b/telegram/Command.cs index 62ece28..7834d3c 100644 --- a/telegram/Command.cs +++ b/telegram/Command.cs @@ -174,6 +174,8 @@ namespace telegram } var message = command.Substring(split[0].Length); + if (string.IsNullOrWhiteSpace(message)) + return; EditMessage(message, lastMessage); } diff --git a/telegram/Util.cs b/telegram/Util.cs index 4fab663..af26c7e 100644 --- a/telegram/Util.cs +++ b/telegram/Util.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading; -using System.Threading.Tasks; using NeoSmart.Unicode; using static TdLib.TdApi; using static telegram.tgcli; diff --git a/telegram/tgcli.cs b/telegram/tgcli.cs index df29d79..ce1bf48 100644 --- a/telegram/tgcli.cs +++ b/telegram/tgcli.cs @@ -20,14 +20,14 @@ namespace telegram * make Util.getActualStringWidth better * make the command system not shit (classes & manager & /help etc) * refactor everything - * publish AUR package * add option to disable terminal bell * command /s /search -> list matching chats, option 1-n, archived indicator - * secret chats! * split with newline if received message enters next line * fix issues when current_input message is longer than term width (only show as much as fits?) * photo/document/etc captions * photo download & show externally + * secret chats! + * publish AUR package * maybe cursor input nav (cmd+del, left/right, up for last inputs, etc) */ @@ -144,12 +144,12 @@ namespace telegram ScreenUpdate(); break; case Td.TdApi.ConnectionState.ConnectionStateReady _: - connectionState = "Ready"; if (!authorized) return; messageQueue.Add($"{Ansi.Yellow}[tgcli] Connected."); Task.Run(() => { Command.ParseCommand("u"); + connectionState = "Ready"; ScreenUpdate(); }); ScreenUpdate(); @@ -182,7 +182,7 @@ namespace telegram messageQueue.Clear(); var status = GetFormattedStatus(currentUserRead); Console.Write(prefix - + (connectionState == "Ready" ? "" : $" ({connectionState})") + + (connectionState == "Ready" ? "" : $" | {connectionState}") + (currentChatUserId != 0 ? status : "]") + " > " + currentInputLine); } }