diff --git a/src/TgBotLib/Objects/Update.php b/src/TgBotLib/Objects/Update.php index 6522424..8524fb0 100644 --- a/src/TgBotLib/Objects/Update.php +++ b/src/TgBotLib/Objects/Update.php @@ -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 */