Add shorthands for getChatMember with self for bots.
This commit is contained in:
parent
373a17e39e
commit
f43428d4d8
@ -8115,6 +8115,12 @@ void ChatManager::get_chat_participant(ChatId chat_id, UserId user_id, Promise<D
|
||||
return promise.set_error(Status::Error(400, "Group not found"));
|
||||
}
|
||||
|
||||
if (td_->auth_manager_->is_bot() && user_id == td_->user_manager_->get_my_id()) {
|
||||
// bots don't need inviter information
|
||||
reload_chat(chat_id, Auto(), "get_chat_participant");
|
||||
return promise.set_value(DialogParticipant{DialogId(user_id), user_id, c->date, c->status});
|
||||
}
|
||||
|
||||
auto chat_full = get_chat_full_force(chat_id, "get_chat_participant");
|
||||
if (chat_full == nullptr || (td_->auth_manager_->is_bot() && is_chat_full_outdated(chat_full, c, chat_id, true))) {
|
||||
auto query_promise = PromiseCreator::lambda(
|
||||
|
@ -1611,6 +1611,15 @@ void DialogParticipantManager::get_channel_participant(ChannelId channel_id, Dia
|
||||
}
|
||||
}
|
||||
|
||||
if (td_->auth_manager_->is_bot() && participant_dialog_id == td_->dialog_manager_->get_my_dialog_id() &&
|
||||
td_->chat_manager_->have_channel(channel_id)) {
|
||||
// bots don't need inviter information
|
||||
td_->chat_manager_->reload_channel(channel_id, Auto(), "get_channel_participant");
|
||||
return promise.set_value(DialogParticipant{participant_dialog_id, participant_dialog_id.get_user_id(),
|
||||
td_->chat_manager_->get_channel_date(channel_id),
|
||||
td_->chat_manager_->get_channel_status(channel_id)});
|
||||
}
|
||||
|
||||
auto on_result_promise =
|
||||
PromiseCreator::lambda([actor_id = actor_id(this), channel_id, participant_dialog_id,
|
||||
promise = std::move(promise)](Result<DialogParticipant> r_dialog_participant) mutable {
|
||||
|
Loading…
Reference in New Issue
Block a user