From 325e29a930e035eab214c6926a7818defcb232be Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 3 Nov 2024 17:14:07 -0500 Subject: [PATCH] Add BusinessConnection event support --- src/TgBotLib/Classes/Utilities.php | 5 ++++ src/TgBotLib/Enums/UpdateEventType.php | 2 ++ .../Events/BusinessConnectionEvent.php | 28 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/TgBotLib/Events/BusinessConnectionEvent.php diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index 1ccb981..04304c6 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -151,6 +151,11 @@ return UpdateEventType::BUSINESS_MESSAGE; } + if($update->getBusinessConnection() !== null) + { + return UpdateEventType::BUSINESS_CONNECTION; + } + return UpdateEventType::UPDATE_EVENT; } } \ No newline at end of file diff --git a/src/TgBotLib/Enums/UpdateEventType.php b/src/TgBotLib/Enums/UpdateEventType.php index 6ad0294..4cd2790 100644 --- a/src/TgBotLib/Enums/UpdateEventType.php +++ b/src/TgBotLib/Enums/UpdateEventType.php @@ -3,6 +3,7 @@ namespace TgBotLib\Enums; use TgBotLib\Abstracts\UpdateEvent; + use TgBotLib\Events\BusinessConnectionEvent; use TgBotLib\Events\BusinessMessageEvent; use TgBotLib\Events\CallbackQueryEvent; use TgBotLib\Events\ChatBoostEvent; @@ -43,4 +44,5 @@ case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class; case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class; case BUSINESS_MESSAGE = BusinessMessageEvent::class; + case BUSINESS_CONNECTION = BusinessConnectionEvent::class; } diff --git a/src/TgBotLib/Events/BusinessConnectionEvent.php b/src/TgBotLib/Events/BusinessConnectionEvent.php new file mode 100644 index 0000000..f5fcfc8 --- /dev/null +++ b/src/TgBotLib/Events/BusinessConnectionEvent.php @@ -0,0 +1,28 @@ +update->getBusinessConnection(); + } + } \ No newline at end of file