diff --git a/src/EventHandler/Message.php b/src/EventHandler/Message.php index b8f9867d2..dcd190452 100644 --- a/src/EventHandler/Message.php +++ b/src/EventHandler/Message.php @@ -98,8 +98,8 @@ abstract class Message extends AbstractMessage /** Author of the post, if signatures are enabled for messages from channels or forwarded from channels */ public readonly ?string $signature; - /** @var array Message [entities](https://core.telegram.org/api/entities) for styled text */ - public readonly ?array $entities; + /** @var list Message [entities](https://core.telegram.org/api/entities) for styled text */ + public readonly array $entities; /** @internal */ public function __construct( @@ -113,9 +113,7 @@ abstract class Message extends AbstractMessage $this->forwards = $rawMessage['forwards'] ?? null; $this->signature = $rawMessage['post_author'] ?? null; - $this->entities = isset($rawMessage['entities']) && !empty($entities = $rawMessage['entities']) - ? MessageEntity::fromRawEntities($entities) - : null; + $this->entities = MessageEntity::fromRawEntities($rawMessage['entities'] ?? []); $this->message = $rawMessage['message']; $this->fromScheduled = $rawMessage['from_scheduled']; $this->viaBotId = $rawMessage['via_bot_id'] ?? null;