diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 3c0b2da28..b9f213542 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -4096,6 +4096,21 @@ void add_formatted_text_dependencies(Dependencies &dependencies, const Formatted } } +bool has_media_timestamps(const FormattedText *text, int32 min_timestamp, int32 max_timestamp) { + if (text == nullptr) { + return false; + } + for (auto &entity : text->entities) { + if (entity.type == MessageEntity::Type::MediaTimestamp) { + int32 timestamp = to_integer(entity.argument); + if (min_timestamp <= timestamp && timestamp <= max_timestamp) { + return true; + } + } + } + return false; +} + bool has_bot_commands(const FormattedText *text) { if (text == nullptr) { return false; diff --git a/td/telegram/MessageEntity.h b/td/telegram/MessageEntity.h index 470f560f3..78023238f 100644 --- a/td/telegram/MessageEntity.h +++ b/td/telegram/MessageEntity.h @@ -196,6 +196,8 @@ Result process_input_caption(const ContactsManager *contacts_mana void add_formatted_text_dependencies(Dependencies &dependencies, const FormattedText *text); +bool has_media_timestamps(const FormattedText *text, int32 min_timestamp, int32 max_timestamp); + bool has_bot_commands(const FormattedText *text); bool need_always_skip_bot_commands(const ContactsManager *contacts_manager, DialogId dialog_id, bool is_bot);