Add ChatMemberUpdatedEvent handling
This commit is contained in:
parent
c7edc420f3
commit
b8b1a87639
3 changed files with 36 additions and 0 deletions
|
@ -76,6 +76,11 @@
|
|||
return EventType::CHAT_JOIN_REQUEST_EVENT;
|
||||
}
|
||||
|
||||
if($update->getChatMember() !== null)
|
||||
{
|
||||
return EventType::CHAT_MEMBER_UPDATED;
|
||||
}
|
||||
|
||||
return EventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Events\ChatBoostEvent;
|
||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||
use TgBotLib\Events\RemovedChatBoostEvent;
|
||||
|
||||
enum EventType : string
|
||||
|
@ -13,4 +14,5 @@
|
|||
case REMOVED_CHAT_BOOST_EVENT = RemovedChatBoostEvent::class;
|
||||
case CHAT_BOOST_EVENT = ChatBoostEvent::class;
|
||||
case CHAT_JOIN_REQUEST_EVENT = ChatJoinRequestEvent::class;
|
||||
case CHAT_MEMBER_UPDATED = ChatMemberUpdatedEvent::class;
|
||||
}
|
||||
|
|
29
src/TgBotLib/Events/ChatMemberUpdatedEvent.php
Normal file
29
src/TgBotLib/Events/ChatMemberUpdatedEvent.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\EventType;
|
||||
use TgBotLib\Objects\ChatMemberUpdated;
|
||||
|
||||
abstract class ChatMemberUpdatedEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): EventType
|
||||
{
|
||||
return EventType::CHAT_MEMBER_UPDATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the updated chat member information from the update object.
|
||||
*
|
||||
* @return ChatMemberUpdated The updated chat member instance.
|
||||
*/
|
||||
protected function getChatMemberUpdated(): ChatMemberUpdated
|
||||
{
|
||||
return $this->update->getChatMember();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue