Refactor event type determination logic
This commit is contained in:
parent
4829853d0e
commit
56c7fb04d2
4 changed files with 159 additions and 123 deletions
28
src/TgBotLib/Events/MessageEvent.php
Normal file
28
src/TgBotLib/Events/MessageEvent.php
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue