Add BusinessConnection event support
This commit is contained in:
parent
2b8f9afa49
commit
325e29a930
3 changed files with 35 additions and 0 deletions
|
@ -151,6 +151,11 @@
|
||||||
return UpdateEventType::BUSINESS_MESSAGE;
|
return UpdateEventType::BUSINESS_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getBusinessConnection() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::BUSINESS_CONNECTION;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
namespace TgBotLib\Enums;
|
namespace TgBotLib\Enums;
|
||||||
|
|
||||||
use TgBotLib\Abstracts\UpdateEvent;
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Events\BusinessConnectionEvent;
|
||||||
use TgBotLib\Events\BusinessMessageEvent;
|
use TgBotLib\Events\BusinessMessageEvent;
|
||||||
use TgBotLib\Events\CallbackQueryEvent;
|
use TgBotLib\Events\CallbackQueryEvent;
|
||||||
use TgBotLib\Events\ChatBoostEvent;
|
use TgBotLib\Events\ChatBoostEvent;
|
||||||
|
@ -43,4 +44,5 @@
|
||||||
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
|
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
|
||||||
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
|
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
|
||||||
case BUSINESS_MESSAGE = BusinessMessageEvent::class;
|
case BUSINESS_MESSAGE = BusinessMessageEvent::class;
|
||||||
|
case BUSINESS_CONNECTION = BusinessConnectionEvent::class;
|
||||||
}
|
}
|
||||||
|
|
28
src/TgBotLib/Events/BusinessConnectionEvent.php
Normal file
28
src/TgBotLib/Events/BusinessConnectionEvent.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Events;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Enums\UpdateEventType;
|
||||||
|
use TgBotLib\Objects\BusinessConnection;
|
||||||
|
|
||||||
|
abstract class BusinessConnectionEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateEventType::BUSINESS_CONNECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the BusinessConnection instance associated with this update.
|
||||||
|
*
|
||||||
|
* @return BusinessConnection The business connection associated with this update.
|
||||||
|
*/
|
||||||
|
protected function getBusinessConnection(): BusinessConnection
|
||||||
|
{
|
||||||
|
return $this->update->getBusinessConnection();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue