Add BotInfoManager::get_fake_input_media.
This commit is contained in:
parent
80b71e4410
commit
c3ded2ade5
@ -670,6 +670,23 @@ void BotInfoManager::on_upload_bot_media_preview_error(FileId file_id, Status st
|
||||
pending_preview->promise_.set_error(std::move(status));
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> BotInfoManager::get_fake_input_media(FileId file_id) const {
|
||||
FileView file_view = td_->file_manager_->get_file_view(file_id);
|
||||
if (file_view.empty() || !file_view.has_remote_location() || file_view.remote_location().is_web()) {
|
||||
return nullptr;
|
||||
}
|
||||
switch (file_view.get_type()) {
|
||||
case FileType::VideoStory:
|
||||
return telegram_api::make_object<telegram_api::inputMediaDocument>(
|
||||
0, false /*ignored*/, file_view.remote_location().as_input_document(), 0, string());
|
||||
case FileType::PhotoStory:
|
||||
return telegram_api::make_object<telegram_api::inputMediaPhoto>(0, false /*ignored*/,
|
||||
file_view.remote_location().as_input_photo(), 0);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void BotInfoManager::add_pending_set_query(UserId bot_user_id, const string &language_code, int type,
|
||||
const string &value, Promise<Unit> &&promise) {
|
||||
pending_set_bot_info_queries_.emplace_back(bot_user_id, language_code, type, value, std::move(promise));
|
||||
|
@ -127,6 +127,8 @@ class BotInfoManager final : public Actor {
|
||||
|
||||
void on_upload_bot_media_preview_error(FileId file_id, Status status);
|
||||
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> get_fake_input_media(FileId file_id) const;
|
||||
|
||||
void add_pending_set_query(UserId bot_user_id, const string &language_code, int type, const string &value,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user