Add support for edited channel post events
This commit is contained in:
parent
325e29a930
commit
041c2dc84c
3 changed files with 35 additions and 0 deletions
|
@ -156,6 +156,11 @@
|
|||
return UpdateEventType::BUSINESS_CONNECTION;
|
||||
}
|
||||
|
||||
if($update->getEditedChannelPost() !== null)
|
||||
{
|
||||
return UpdateEventType::EDITED_CHANNEL_POST;
|
||||
}
|
||||
|
||||
return UpdateEventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
use TgBotLib\Events\ChosenInlineResultEvent;
|
||||
use TgBotLib\Events\DeletedBusinessMessagesEvent;
|
||||
use TgBotLib\Events\EditedBusinessMessageEvent;
|
||||
use TgBotLib\Events\EditedChannelPostEvent;
|
||||
use TgBotLib\Events\InlineQueryEvent;
|
||||
use TgBotLib\Events\MessageReactionCountEvent;
|
||||
use TgBotLib\Events\MessageReactionEvent;
|
||||
|
@ -45,4 +46,5 @@
|
|||
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
|
||||
case BUSINESS_MESSAGE = BusinessMessageEvent::class;
|
||||
case BUSINESS_CONNECTION = BusinessConnectionEvent::class;
|
||||
case EDITED_CHANNEL_POST = EditedChannelPostEvent::class;
|
||||
}
|
||||
|
|
28
src/TgBotLib/Events/EditedChannelPostEvent.php
Normal file
28
src/TgBotLib/Events/EditedChannelPostEvent.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Enums\UpdateEventType;
|
||||
use TgBotLib\Objects\Message;
|
||||
|
||||
abstract class EditedChannelPostEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): UpdateEventType
|
||||
{
|
||||
return UpdateEventType::EDITED_CHANNEL_POST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the edited channel post from the update.
|
||||
*
|
||||
* @return Message The edited channel post.
|
||||
*/
|
||||
protected function getEditedChannelPost(): Message
|
||||
{
|
||||
return $this->update->getEditedChannelPost();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue