Add new getCaptionEntities method to Message entity.

parent 1d37b214
......@@ -66,6 +66,7 @@ class Message extends Entity
'forward_from_chat' => Chat::class,
'reply_to_message' => ReplyToMessage::class,
'entities' => MessageEntity::class,
'caption_entities' => MessageEntity::class,
'audio' => Audio::class,
'document' => Document::class,
'photo' => PhotoSize::class,
......@@ -158,6 +159,21 @@ class Message extends Entity
return empty($pretty_array) ? null : $pretty_array;
}
/**
* Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
*
* This method overrides the default getCaptionEntities method
* and returns a nice array of MessageEntity objects.
*
* @return null|MessageEntity[]
*/
public function getCaptionEntities()
{
$pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'caption_entities');
return empty($pretty_array) ? null : $pretty_array;
}
/**
* return the entire command like /echo or /echo@bot1 if specified
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment