From f5b7f0abb7c125fdd121c6c638477e3aa8244c08 Mon Sep 17 00:00:00 2001 From: AmirHossein Date: Wed, 14 Aug 2024 01:32:43 +0330 Subject: [PATCH] update: sync to Bot API 7.8 and fix getData method for openswoole --- src/Methode.php | 4 ++-- src/Updates.php | 3 +++ src/Updates/Message.php | 4 ++-- src/Updates/RefundedPayment.php | 13 +++++++++++++ src/Updates/User.php | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/Updates/RefundedPayment.php diff --git a/src/Methode.php b/src/Methode.php index 4c76f4a..eb0c969 100644 --- a/src/Methode.php +++ b/src/Methode.php @@ -285,12 +285,12 @@ public function setChatDescription($chat_id, $description): bool|string|array|nu return $this->endpoint('setChatDescription', get_defined_vars()); } - public function pinChatMessage($chat_id, $message_id, $disable_notification = null): bool|string|array|null + public function pinChatMessage($chat_id, $message_id, $disable_notification = null, $business_connection_id = null): bool|string|array|null { return $this->endpoint('pinChatMessage', get_defined_vars()); } - public function unpinChatMessage($chat_id, $message_id): bool|string|array|null + public function unpinChatMessage($chat_id, $message_id, $business_connection_id = null): bool|string|array|null { return $this->endpoint('unpinChatMessage', get_defined_vars()); } diff --git a/src/Updates.php b/src/Updates.php index 855c64f..ce317bd 100644 --- a/src/Updates.php +++ b/src/Updates.php @@ -68,6 +68,9 @@ public function getData() return json_decode($data['argv'][1]); } elseif ((isset($_ENV['UPDATE_TYPE']) && $_ENV['UPDATE_TYPE'] == 'sync') || !isset($_ENV['UPDATE_TYPE'])) { return json_decode(file_get_contents('php://input')); + } elseif (isset($_ENV['UPDATE_TYPE']) && $_ENV['UPDATE_TYPE'] == 'openswoole') { + global $swoole; + return $swoole; } } diff --git a/src/Updates/Message.php b/src/Updates/Message.php index ba457a9..08ee2b5 100644 --- a/src/Updates/Message.php +++ b/src/Updates/Message.php @@ -63,6 +63,7 @@ * @property MaybeInaccessibleMessage $pinned_message * @property Invoice $invoice * @property SuccessfulPayment $successful_payment + * @property RefundedPayment $refunded_payment * @property UsersShared $users_shared * @property ChatShared $chat_shared * @property string $connected_website @@ -87,6 +88,5 @@ * @property VideoChatParticipantsInvited $video_chat_participants_invited * @property WebAppData $web_app_data * @property InlineKeyboardMarkup $reply_markup - -**/ + **/ class Message { } \ No newline at end of file diff --git a/src/Updates/RefundedPayment.php b/src/Updates/RefundedPayment.php new file mode 100644 index 0000000..b6062ad --- /dev/null +++ b/src/Updates/RefundedPayment.php @@ -0,0 +1,13 @@ +