mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2025-01-31 21:57:39 +01:00
Merge pull request #49 from luckydonald-forks/fixes
Various fixes/improvements for the user mode
This commit is contained in:
commit
637e86e5a3
@ -3670,7 +3670,11 @@ std::size_t Client::get_pending_update_count() const {
|
|||||||
|
|
||||||
ServerBotInfo Client::get_bot_info() const {
|
ServerBotInfo Client::get_bot_info() const {
|
||||||
ServerBotInfo res;
|
ServerBotInfo res;
|
||||||
|
if (is_user_) {
|
||||||
|
res.id_ = td::to_string(my_id_);
|
||||||
|
} else {
|
||||||
res.id_ = bot_token_id_;
|
res.id_ = bot_token_id_;
|
||||||
|
}
|
||||||
res.token_ = bot_token_;
|
res.token_ = bot_token_;
|
||||||
auto user_info = get_user_info(my_id_);
|
auto user_info = get_user_info(my_id_);
|
||||||
if (user_info != nullptr) {
|
if (user_info != nullptr) {
|
||||||
@ -6571,7 +6575,7 @@ void Client::on_cmd(PromisedQueryPtr query) {
|
|||||||
} else if (query->method() == "registeruser" && parameters_->allow_users_registration_) {
|
} else if (query->method() == "registeruser" && parameters_->allow_users_registration_) {
|
||||||
return process_register_user_query(query);
|
return process_register_user_query(query);
|
||||||
} else {
|
} else {
|
||||||
return fail_query(404, "Not Found: method not found", std::move(query));
|
return fail_query(404, "Not Found: method not found or login not yet completed", std::move(query));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ void HttpConnection::handle(td::unique_ptr<td::HttpQuery> http_query,
|
|||||||
bool is_login = false;
|
bool is_login = false;
|
||||||
bool is_user = false;
|
bool is_user = false;
|
||||||
if (url_path_parser.try_skip("/bot")) {
|
if (url_path_parser.try_skip("/bot")) {
|
||||||
} else if (url_path_parser.try_skip("/userlogin")) {
|
} else if (url_path_parser.try_skip("/userlogin") || url_path_parser.try_skip("/userLogin")) {
|
||||||
is_user = true;
|
is_user = true;
|
||||||
is_login = true;
|
is_login = true;
|
||||||
} else if (url_path_parser.try_skip("/user")) {
|
} else if (url_path_parser.try_skip("/user")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user