Add support for business message events
This commit is contained in:
parent
b40ee01d6e
commit
2f87996bd3
3 changed files with 36 additions and 0 deletions
|
@ -146,6 +146,11 @@
|
|||
return UpdateEventType::EDITED_BUSINESS_MESSAGE;
|
||||
}
|
||||
|
||||
if($update->getBusinessMessage() !== null)
|
||||
{
|
||||
return UpdateEventType::BUSINESS_MESSAGE;
|
||||
}
|
||||
|
||||
return UpdateEventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
namespace TgBotLib\Enums;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Events\BusinessMessageEvent;
|
||||
use TgBotLib\Events\CallbackQueryEvent;
|
||||
use TgBotLib\Events\ChatBoostEvent;
|
||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||
|
@ -42,4 +43,5 @@
|
|||
case MESSAGE_REACTION = MessageReactionEvent::class;
|
||||
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
|
||||
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
|
||||
case BUSINESS_MESSAGE = BusinessMessageEvent::class;
|
||||
}
|
||||
|
|
29
src/TgBotLib/Events/BusinessMessageEvent.php
Normal file
29
src/TgBotLib/Events/BusinessMessageEvent.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\UpdateEventType;
|
||||
use TgBotLib\Objects\Message;
|
||||
|
||||
abstract class BusinessMessageEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): UpdateEventType
|
||||
{
|
||||
return UpdateEventType::BUSINESS_MESSAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* New incoming business message
|
||||
*
|
||||
* @return Message
|
||||
*/
|
||||
protected function getBusinessMessage(): Message
|
||||
{
|
||||
return $this->update->getBusinessMessage();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue