Add support for message reaction count events
This commit is contained in:
parent
ac431136de
commit
ada256566e
3 changed files with 38 additions and 0 deletions
|
@ -126,6 +126,11 @@
|
|||
return UpdateEventType::INLINE_QUERY;
|
||||
}
|
||||
|
||||
if($update->getMessageReactionCount() !== null)
|
||||
{
|
||||
return UpdateEventType::MESSAGE_REACTION_COUNT;
|
||||
}
|
||||
|
||||
return UpdateEventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||
use TgBotLib\Events\ChosenInlineResultEvent;
|
||||
use TgBotLib\Events\InlineQueryEvent;
|
||||
use TgBotLib\Events\MessageReactionCountEvent;
|
||||
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
||||
use TgBotLib\Events\PollAnswerEvent;
|
||||
use TgBotLib\Events\PollEvent;
|
||||
|
@ -34,4 +35,5 @@
|
|||
case CALLBACK_QUERY = CallbackQueryEvent::class;
|
||||
case CHOSEN_INLINE_RESULT = ChosenInlineResultEvent::class;
|
||||
case INLINE_QUERY = InlineQueryEvent::class;
|
||||
case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class;
|
||||
}
|
||||
|
|
31
src/TgBotLib/Events/MessageReactionCountEvent.php
Normal file
31
src/TgBotLib/Events/MessageReactionCountEvent.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\UpdateEventType;
|
||||
use TgBotLib\Objects\MessageReactionCountUpdated;
|
||||
|
||||
abstract class MessageReactionCountEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): UpdateEventType
|
||||
{
|
||||
return UpdateEventType::MESSAGE_REACTION_COUNT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat
|
||||
* and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates.
|
||||
* The updates are grouped and can be sent with delay up to a few minutes.
|
||||
*
|
||||
* @return MessageReactionCountUpdated
|
||||
*/
|
||||
protected function getMessageReactionCount(): MessageReactionCountUpdated
|
||||
{
|
||||
return $this->update->getMessageReactionCount();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue