Refactor event type determination logic

This commit is contained in:
netkas 2024-11-03 17:22:45 -05:00
parent 4829853d0e
commit 56c7fb04d2
4 changed files with 159 additions and 123 deletions

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Abstracts\UpdateEvent;
use TgBotLib\Enums\UpdateEventType;
use TgBotLib\Objects\Message;
abstract class MessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): UpdateEventType
{
return UpdateEventType::MESSAGE;
}
/**
* Retrieves the current message.
*
* @return Message The message.
*/
protected function getMessage(): Message
{
return $this->update->getMessage();
}
}