Remove redundant checks for is_bot.
This commit is contained in:
parent
d6f3d9f08a
commit
95d60959b1
@ -684,9 +684,6 @@ int64 AnimationsManager::get_saved_animations_hash(const char *source) const {
|
|||||||
|
|
||||||
void AnimationsManager::add_saved_animation(const tl_object_ptr<td_api::InputFile> &input_file,
|
void AnimationsManager::add_saved_animation(const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_saved_animations_loaded_) {
|
if (!are_saved_animations_loaded_) {
|
||||||
load_saved_animations(std::move(promise));
|
load_saved_animations(std::move(promise));
|
||||||
return;
|
return;
|
||||||
@ -803,9 +800,6 @@ void AnimationsManager::add_saved_animation_impl(FileId animation_id, bool add_o
|
|||||||
|
|
||||||
void AnimationsManager::remove_saved_animation(const tl_object_ptr<td_api::InputFile> &input_file,
|
void AnimationsManager::remove_saved_animation(const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_saved_animations_loaded_) {
|
if (!are_saved_animations_loaded_) {
|
||||||
load_saved_animations(std::move(promise));
|
load_saved_animations(std::move(promise));
|
||||||
return;
|
return;
|
||||||
|
@ -14678,10 +14678,6 @@ void ContactsManager::add_dialog_participant(DialogId dialog_id, UserId user_id,
|
|||||||
|
|
||||||
void ContactsManager::add_dialog_participants(DialogId dialog_id, const vector<UserId> &user_ids,
|
void ContactsManager::add_dialog_participants(DialogId dialog_id, const vector<UserId> &user_ids,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!td_->messages_manager_->have_dialog_force(dialog_id, "add_dialog_participants")) {
|
if (!td_->messages_manager_->have_dialog_force(dialog_id, "add_dialog_participants")) {
|
||||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
}
|
}
|
||||||
|
@ -10757,9 +10757,7 @@ void MessagesManager::find_unloadable_messages(const Dialog *d, int32 unload_bef
|
|||||||
|
|
||||||
void MessagesManager::delete_dialog_messages_from_user(DialogId dialog_id, UserId user_id, Promise<Unit> &&promise) {
|
void MessagesManager::delete_dialog_messages_from_user(DialogId dialog_id, UserId user_id, Promise<Unit> &&promise) {
|
||||||
bool is_bot = td_->auth_manager_->is_bot();
|
bool is_bot = td_->auth_manager_->is_bot();
|
||||||
if (is_bot) {
|
CHECK(!is_bot);
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG(INFO) << "Receive deleteChatMessagesFromUser request to delete all messages in " << dialog_id << " from the user "
|
LOG(INFO) << "Receive deleteChatMessagesFromUser request to delete all messages in " << dialog_id << " from the user "
|
||||||
<< user_id;
|
<< user_id;
|
||||||
@ -11046,11 +11044,6 @@ void MessagesManager::on_update_dialog_group_call_rights(DialogId dialog_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::read_all_dialog_mentions(DialogId dialog_id, Promise<Unit> &&promise) {
|
void MessagesManager::read_all_dialog_mentions(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||||
bool is_bot = td_->auth_manager_->is_bot();
|
|
||||||
if (is_bot) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Dialog *d = get_dialog_force(dialog_id, "read_all_dialog_mentions");
|
Dialog *d = get_dialog_force(dialog_id, "read_all_dialog_mentions");
|
||||||
if (d == nullptr) {
|
if (d == nullptr) {
|
||||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
@ -31660,11 +31653,6 @@ tl_object_ptr<telegram_api::channelAdminLogEventsFilter> MessagesManager::get_ch
|
|||||||
int64 MessagesManager::get_dialog_event_log(DialogId dialog_id, const string &query, int64 from_event_id, int32 limit,
|
int64 MessagesManager::get_dialog_event_log(DialogId dialog_id, const string &query, int64 from_event_id, int32 limit,
|
||||||
const tl_object_ptr<td_api::chatEventLogFilters> &filters,
|
const tl_object_ptr<td_api::chatEventLogFilters> &filters,
|
||||||
const vector<UserId> &user_ids, Promise<Unit> &&promise) {
|
const vector<UserId> &user_ids, Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!have_dialog_force(dialog_id, "get_dialog_event_log")) {
|
if (!have_dialog_force(dialog_id, "get_dialog_event_log")) {
|
||||||
promise.set_error(Status::Error(400, "Chat not found"));
|
promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -6002,9 +6002,6 @@ FileSourceId StickersManager::get_recent_stickers_file_source_id(int is_attached
|
|||||||
|
|
||||||
void StickersManager::add_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
void StickersManager::add_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_recent_stickers_loaded_[is_attached]) {
|
if (!are_recent_stickers_loaded_[is_attached]) {
|
||||||
load_recent_stickers(is_attached, std::move(promise));
|
load_recent_stickers(is_attached, std::move(promise));
|
||||||
return;
|
return;
|
||||||
@ -6113,9 +6110,6 @@ void StickersManager::add_recent_sticker_impl(bool is_attached, FileId sticker_i
|
|||||||
|
|
||||||
void StickersManager::remove_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
void StickersManager::remove_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_recent_stickers_loaded_[is_attached]) {
|
if (!are_recent_stickers_loaded_[is_attached]) {
|
||||||
load_recent_stickers(is_attached, std::move(promise));
|
load_recent_stickers(is_attached, std::move(promise));
|
||||||
return;
|
return;
|
||||||
@ -6144,9 +6138,6 @@ void StickersManager::remove_recent_sticker(bool is_attached, const tl_object_pt
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StickersManager::clear_recent_stickers(bool is_attached, Promise<Unit> &&promise) {
|
void StickersManager::clear_recent_stickers(bool is_attached, Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_recent_stickers_loaded_[is_attached]) {
|
if (!are_recent_stickers_loaded_[is_attached]) {
|
||||||
load_recent_stickers(is_attached, std::move(promise));
|
load_recent_stickers(is_attached, std::move(promise));
|
||||||
return;
|
return;
|
||||||
@ -6407,9 +6398,6 @@ FileSourceId StickersManager::get_favorite_stickers_file_source_id() {
|
|||||||
|
|
||||||
void StickersManager::add_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file,
|
void StickersManager::add_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_favorite_stickers_loaded_) {
|
if (!are_favorite_stickers_loaded_) {
|
||||||
load_favorite_stickers(std::move(promise));
|
load_favorite_stickers(std::move(promise));
|
||||||
return;
|
return;
|
||||||
@ -6512,9 +6500,6 @@ void StickersManager::add_favorite_sticker_impl(FileId sticker_id, bool add_on_s
|
|||||||
|
|
||||||
void StickersManager::remove_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file,
|
void StickersManager::remove_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (td_->auth_manager_->is_bot()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Method is not available for bots"));
|
|
||||||
}
|
|
||||||
if (!are_favorite_stickers_loaded_) {
|
if (!are_favorite_stickers_loaded_) {
|
||||||
load_favorite_stickers(std::move(promise));
|
load_favorite_stickers(std::move(promise));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user