From 2f87996bd3d0e7122bf7f586e40db3ea39b1420a Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 3 Nov 2024 17:11:16 -0500 Subject: [PATCH] Add support for business message events --- src/TgBotLib/Classes/Utilities.php | 5 ++++ src/TgBotLib/Enums/UpdateEventType.php | 2 ++ src/TgBotLib/Events/BusinessMessageEvent.php | 29 ++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/TgBotLib/Events/BusinessMessageEvent.php diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index bd69677..1ccb981 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -146,6 +146,11 @@ return UpdateEventType::EDITED_BUSINESS_MESSAGE; } + if($update->getBusinessMessage() !== null) + { + return UpdateEventType::BUSINESS_MESSAGE; + } + 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 2a2afb3..f66fe35 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\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; } diff --git a/src/TgBotLib/Events/BusinessMessageEvent.php b/src/TgBotLib/Events/BusinessMessageEvent.php new file mode 100644 index 0000000..5e8b6a1 --- /dev/null +++ b/src/TgBotLib/Events/BusinessMessageEvent.php @@ -0,0 +1,29 @@ +update->getBusinessMessage(); + } + } \ No newline at end of file