From e843c8ca4fd627915d450aea9fc6d8b5d0dbaabb Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 1 Nov 2024 21:50:21 -0400 Subject: [PATCH] Add support for ShippingQuery events --- src/TgBotLib/Classes/Utilities.php | 5 ++++ src/TgBotLib/Enums/UpdateEventType.php | 2 ++ src/TgBotLib/Events/ShippingQueryEvent.php | 30 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/TgBotLib/Events/ShippingQueryEvent.php diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index e4651f0..98edc3b 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -106,6 +106,11 @@ return UpdateEventType::PRE_CHECKOUT_QUERY; } + if($update->getPreCheckoutQuery() !== null) + { + return UpdateEventType::PRE_CHECKOUT_QUERY; + } + 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 047f9b6..bd3b279 100644 --- a/src/TgBotLib/Enums/UpdateEventType.php +++ b/src/TgBotLib/Enums/UpdateEventType.php @@ -12,6 +12,7 @@ use TgBotLib\Events\PaidMediaPurchasedEvent; use TgBotLib\Events\PreCheckoutQueryEvent; use TgBotLib\Events\RemovedChatBoostEvent; + use TgBotLib\Events\ShippingQueryEvent; enum UpdateEventType : string { @@ -25,4 +26,5 @@ case POLL = PollEvent::class; case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class; case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class; + case SHIPPING_QUERY = ShippingQueryEvent::class; } diff --git a/src/TgBotLib/Events/ShippingQueryEvent.php b/src/TgBotLib/Events/ShippingQueryEvent.php new file mode 100644 index 0000000..a9e767c --- /dev/null +++ b/src/TgBotLib/Events/ShippingQueryEvent.php @@ -0,0 +1,30 @@ +update->getShippingQuery(); + } + } \ No newline at end of file