refactor @username queries

This commit is contained in:
Laura Hausmann 2019-12-14 00:24:28 +01:00
parent 0e10aa4635
commit fe3e2551f5
Signed by: zotan
GPG key ID: 5EC1D38FFC321311
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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