tg_cli: use '.' as currently opened chat.

This commit is contained in:
levlam 2021-11-28 11:49:46 +03:00
parent 746c70900b
commit 468fcc2564

View File

@ -440,6 +440,9 @@ class CliClient final : public Actor {
if (str == "me") { if (str == "me") {
return my_id_; return my_id_;
} }
if (str == ".") {
return opened_chat_id_;
}
if (str[0] == '@') { if (str[0] == '@') {
str.remove_prefix(1); str.remove_prefix(1);
} }
@ -2593,7 +2596,9 @@ class CliClient final : public Actor {
} else if (op == "gdialog" || op == "gd") { } else if (op == "gdialog" || op == "gd") {
send_request(td_api::make_object<td_api::getChat>(as_chat_id(args))); send_request(td_api::make_object<td_api::getChat>(as_chat_id(args)));
} else if (op == "open") { } else if (op == "open") {
send_request(td_api::make_object<td_api::openChat>(as_chat_id(args))); auto chat_id = as_chat_id(args);
opened_chat_id_ = chat_id;
send_request(td_api::make_object<td_api::openChat>(chat_id));
} else if (op == "close") { } else if (op == "close") {
send_request(td_api::make_object<td_api::closeChat>(as_chat_id(args))); send_request(td_api::make_object<td_api::closeChat>(as_chat_id(args)));
} else if (op == "gm") { } else if (op == "gm") {
@ -4551,6 +4556,7 @@ class CliClient final : public Actor {
int64 my_id_ = 0; int64 my_id_ = 0;
string schedule_date_; string schedule_date_;
string message_thread_id_; string message_thread_id_;
int64 opened_chat_id_ = 0;
ConcurrentScheduler *scheduler_{nullptr}; ConcurrentScheduler *scheduler_{nullptr};