tg_cli: allow username as supergroup_id.

GitOrigin-RevId: ffd0fcdd4e17be3151aeb3cd5e3c51e466e68c59
This commit is contained in:
levlam 2020-03-04 03:10:50 +03:00
parent 5bea5f83b2
commit 692fddfe91

View File

@ -524,8 +524,11 @@ class CliClient final : public Actor {
return result;
}
static int32 as_supergroup_id(Slice str) {
int32 as_supergroup_id(Slice str) {
str = trim(str);
if (str[0] == '@') {
return username_to_supergroup_id_[to_lower(str.substr(1))];
}
auto result = to_integer<int64>(str);
int64 shift = static_cast<int64>(-1000000000000ll);
if (result <= shift) {