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

@ -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
*/