diff --git a/telegram/Util.cs b/telegram/Util.cs index 49886d3..79e0398 100644 --- a/telegram/Util.cs +++ b/telegram/Util.cs @@ -303,6 +303,9 @@ namespace telegram Limit = 5 }).Result; + if (query.StartsWith("@")) + return results.ChatIds.First(p => + GetChat(p).Type is ChatType.ChatTypePrivate type && GetUser(type.UserId).Username == query.Substring(1)); return results.ChatIds.First(); } catch @@ -323,6 +326,8 @@ namespace telegram Limit = 5 }).Result; + if (query.StartsWith("@")) + return results.UserIds.First(p => GetUser(p).Username == query.Substring(1)); return results.UserIds.First(); } catch diff --git a/telegram/tgcli.cs b/telegram/tgcli.cs index 15f9466..27ed15c 100644 --- a/telegram/tgcli.cs +++ b/telegram/tgcli.cs @@ -16,8 +16,6 @@ namespace telegram * TODO: * waaay more error messages instead of just doing nothing or crashing (search for "do something") * add option to disable terminal bell - * make commands & keybinds more consistent (maybe configurable?) - * for commands with query, if query starting with @ only match where username matches *exactly* * command /sg -> search globally, some way to add contacts? * command /sc -> search in chat list & list matching chats, archived, muted indicator * mute,unmute chats