Add support for message reaction event handling

This commit is contained in:
netkas 2024-11-02 00:22:25 -04:00
parent ada256566e
commit bcf23f3834
3 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Abstracts\UpdateEvent;
use TgBotLib\Bot;
use TgBotLib\Enums\UpdateEventType;
use TgBotLib\Objects\MessageReactionUpdated;
abstract class MessageReactionEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): UpdateEventType
{
return UpdateEventType::MESSAGE_REACTION;
}
/**
* A reaction to a message was changed by a user. The bot must be an administrator in the chat and must
* explicitly specify "message_reaction" in the list of allowed_updates to receive these updates.
* The update isn't received for reactions set by bots.
*
* @return MessageReactionUpdated
*/
protected function getMessageReactionUpdated(): MessageReactionUpdated
{
return $this->update->getMessageReaction();
}
}