Add support for MyChatMemberUpdatedEvent
This commit is contained in:
parent
73d14179b1
commit
3ce87cabcb
3 changed files with 37 additions and 0 deletions
|
@ -81,6 +81,11 @@
|
|||
return UpdateEventType::CHAT_MEMBER_UPDATED;
|
||||
}
|
||||
|
||||
if($update->getMyChatMember() !== null)
|
||||
{
|
||||
return UpdateEventType::MY_CHAT_MEMBER_UPDATED;
|
||||
}
|
||||
|
||||
return UpdateEventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
use TgBotLib\Events\ChatBoostEvent;
|
||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
||||
use TgBotLib\Events\RemovedChatBoostEvent;
|
||||
|
||||
enum UpdateEventType : string
|
||||
|
@ -15,4 +16,5 @@
|
|||
case CHAT_BOOST_EVENT = ChatBoostEvent::class;
|
||||
case CHAT_JOIN_REQUEST_EVENT = ChatJoinRequestEvent::class;
|
||||
case CHAT_MEMBER_UPDATED = ChatMemberUpdatedEvent::class;
|
||||
case MY_CHAT_MEMBER_UPDATED = MyChatMemberUpdatedEvent::class;
|
||||
}
|
||||
|
|
30
src/TgBotLib/Events/MyChatMemberUpdatedEvent.php
Normal file
30
src/TgBotLib/Events/MyChatMemberUpdatedEvent.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Enums\UpdateEventType;
|
||||
use TgBotLib\Objects\ChatMemberUpdated;
|
||||
|
||||
abstract class MyChatMemberUpdatedEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): UpdateEventType
|
||||
{
|
||||
return UpdateEventType::MY_CHAT_MEMBER_UPDATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* The bot's chat member status was updated in a chat. For private chats,
|
||||
* this update is received only when the bot is blocked or unblocked by the user.
|
||||
*
|
||||
* @return ChatMemberUpdated The updated chat member information.
|
||||
*/
|
||||
protected function getMyChatMemberUpdated(): ChatMemberUpdated
|
||||
{
|
||||
return $this->update->getMyChatMember();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue