From 041c2dc84c006afd031425b6f70b48cd285a4683 Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 3 Nov 2024 17:15:47 -0500 Subject: [PATCH] Add support for edited channel post events --- src/TgBotLib/Classes/Utilities.php | 5 ++++ src/TgBotLib/Enums/UpdateEventType.php | 2 ++ .../Events/EditedChannelPostEvent.php | 28 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/TgBotLib/Events/EditedChannelPostEvent.php diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index 04304c6..9c97e15 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -156,6 +156,11 @@ return UpdateEventType::BUSINESS_CONNECTION; } + if($update->getEditedChannelPost() !== null) + { + return UpdateEventType::EDITED_CHANNEL_POST; + } + 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 4cd2790..71c6170 100644 --- a/src/TgBotLib/Enums/UpdateEventType.php +++ b/src/TgBotLib/Enums/UpdateEventType.php @@ -12,6 +12,7 @@ use TgBotLib\Events\ChosenInlineResultEvent; use TgBotLib\Events\DeletedBusinessMessagesEvent; use TgBotLib\Events\EditedBusinessMessageEvent; + use TgBotLib\Events\EditedChannelPostEvent; use TgBotLib\Events\InlineQueryEvent; use TgBotLib\Events\MessageReactionCountEvent; use TgBotLib\Events\MessageReactionEvent; @@ -45,4 +46,5 @@ case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class; case BUSINESS_MESSAGE = BusinessMessageEvent::class; case BUSINESS_CONNECTION = BusinessConnectionEvent::class; + case EDITED_CHANNEL_POST = EditedChannelPostEvent::class; } diff --git a/src/TgBotLib/Events/EditedChannelPostEvent.php b/src/TgBotLib/Events/EditedChannelPostEvent.php new file mode 100644 index 0000000..67ff4a8 --- /dev/null +++ b/src/TgBotLib/Events/EditedChannelPostEvent.php @@ -0,0 +1,28 @@ +update->getEditedChannelPost(); + } + } \ No newline at end of file