Add has_media_timestamps.

This commit is contained in:
levlam 2021-08-05 05:41:24 +03:00
parent 9653cc9e3e
commit 2605cd374b
2 changed files with 17 additions and 0 deletions

View File

@ -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<int32>(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;

View File

@ -196,6 +196,8 @@ Result<FormattedText> 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);