Added containsMedia method to Message object to check if the message contains media.

This commit is contained in:
netkas 2024-12-09 12:19:42 -05:00
parent 07ff3c4d2b
commit f9741c250d
2 changed files with 13 additions and 1 deletions

View file

@ -4,10 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [8.0.2] - Ongoing
## [8.0.2] - 2024-12-09
This update introduces some quality of life improvements.
* Added `containsMedia` method to `Message` object to check if the message contains media.
## [8.0.1] - 2024-12-04

View file

@ -1061,6 +1061,16 @@
return null;
}
/**
* Checks if any media content is present in the message.
*
* @return bool True if media content is present, false otherwise.
*/
public function containsMedia(): bool
{
return $this->getPhoto() !== null || $this->getAnimation() !== null || $this->getAudio() !== null || $this->getDocument() !== null || $this->getSticker() !== null || $this->getVideo() !== null || $this->getVideoNote() !== null || $this->getVoice() !== null;
}
/**
* @inheritDoc
*/