From bcf23f38342595eab12f87a0daf589c80e5d8e72 Mon Sep 17 00:00:00 2001 From: netkas Date: Sat, 2 Nov 2024 00:22:25 -0400 Subject: [PATCH] Add support for message reaction event handling --- src/TgBotLib/Classes/Utilities.php | 5 ++++ src/TgBotLib/Enums/UpdateEventType.php | 2 ++ src/TgBotLib/Events/MessageReactionEvent.php | 31 ++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/TgBotLib/Events/MessageReactionEvent.php diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index d8baf8c..952a4bc 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -131,6 +131,11 @@ return UpdateEventType::MESSAGE_REACTION_COUNT; } + if($update->getMessageReaction() !== null) + { + return UpdateEventType::MESSAGE_REACTION; + } + 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 d31098f..e8983ac 100644 --- a/src/TgBotLib/Enums/UpdateEventType.php +++ b/src/TgBotLib/Enums/UpdateEventType.php @@ -10,6 +10,7 @@ use TgBotLib\Events\ChosenInlineResultEvent; use TgBotLib\Events\InlineQueryEvent; use TgBotLib\Events\MessageReactionCountEvent; + use TgBotLib\Events\MessageReactionEvent; use TgBotLib\Events\MyChatMemberUpdatedEvent; use TgBotLib\Events\PollAnswerEvent; use TgBotLib\Events\PollEvent; @@ -36,4 +37,5 @@ case CHOSEN_INLINE_RESULT = ChosenInlineResultEvent::class; case INLINE_QUERY = InlineQueryEvent::class; case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class; + case MESSAGE_REACTION = MessageReactionEvent::class; } diff --git a/src/TgBotLib/Events/MessageReactionEvent.php b/src/TgBotLib/Events/MessageReactionEvent.php new file mode 100644 index 0000000..e7b88ec --- /dev/null +++ b/src/TgBotLib/Events/MessageReactionEvent.php @@ -0,0 +1,31 @@ +update->getMessageReaction(); + } + } \ No newline at end of file