Add method to retrieve any available message

This commit is contained in:
netkas 2024-11-04 01:17:15 -05:00
parent 513344b4a6
commit ba6e991b23

View file

@ -295,6 +295,24 @@
return $this->removed_chat_boost;
}
/**
* Retrieves any type of message that is currently available. This method checks for the presence of a standard message,
* an edited message, a channel post, an edited channel post, a business message, or an edited business message,
* and returns the first one found.
*
* @return Message|null
*/
public function getAnyMessage(): ?Message
{
return
$this->message ??
$this->edited_message ??
$this->channel_post ??
$this->edited_channel_post ??
$this->business_message ??
$this->edited_business_message;
}
/**
* @inheritDoc
*/