Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes/improvements for the user mode #49

Merged
merged 4 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions telegram-bot-api/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,11 @@ std::size_t Client::get_pending_update_count() const {

ServerBotInfo Client::get_bot_info() const {
ServerBotInfo res;
res.id_ = bot_token_id_;
if (is_user_) {
res.id_ = td::to_string(my_id_);
} else {
res.id_ = bot_token_id_;
}
res.token_ = bot_token_;
auto user_info = get_user_info(my_id_);
if (user_info != nullptr) {
Expand Down Expand Up @@ -6571,7 +6575,7 @@ void Client::on_cmd(PromisedQueryPtr query) {
} else if (query->method() == "registeruser" && parameters_->allow_users_registration_) {
return process_register_user_query(query);
} else {
return fail_query(404, "Not Found: method not found", std::move(query));
return fail_query(404, "Not Found: login not yet completed", std::move(query));
luckydonald marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
2 changes: 1 addition & 1 deletion telegram-bot-api/HttpConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void HttpConnection::handle(td::unique_ptr<td::HttpQuery> http_query,
bool is_login = false;
bool is_user = false;
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")) {
MarcoBuster marked this conversation as resolved.
Show resolved Hide resolved
is_user = true;
is_login = true;
} else if (url_path_parser.try_skip("/user")) {
Expand Down