Add Edited Message Event support
This commit is contained in:
parent
2a08cc51de
commit
4829853d0e
3 changed files with 35 additions and 0 deletions
|
@ -166,6 +166,11 @@
|
||||||
return UpdateEventType::CHANNEL_POST;
|
return UpdateEventType::CHANNEL_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getEditedMessage() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::EDITED_MESSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@
|
||||||
use TgBotLib\Events\DeletedBusinessMessagesEvent;
|
use TgBotLib\Events\DeletedBusinessMessagesEvent;
|
||||||
use TgBotLib\Events\EditedBusinessMessageEvent;
|
use TgBotLib\Events\EditedBusinessMessageEvent;
|
||||||
use TgBotLib\Events\EditedChannelPostEvent;
|
use TgBotLib\Events\EditedChannelPostEvent;
|
||||||
|
use TgBotLib\Events\EditedMessageEvent;
|
||||||
use TgBotLib\Events\InlineQueryEvent;
|
use TgBotLib\Events\InlineQueryEvent;
|
||||||
use TgBotLib\Events\MessageReactionCountEvent;
|
use TgBotLib\Events\MessageReactionCountEvent;
|
||||||
use TgBotLib\Events\MessageReactionEvent;
|
use TgBotLib\Events\MessageReactionEvent;
|
||||||
|
@ -49,4 +50,5 @@
|
||||||
case BUSINESS_CONNECTION = BusinessConnectionEvent::class;
|
case BUSINESS_CONNECTION = BusinessConnectionEvent::class;
|
||||||
case EDITED_CHANNEL_POST = EditedChannelPostEvent::class;
|
case EDITED_CHANNEL_POST = EditedChannelPostEvent::class;
|
||||||
case CHANNEL_POST = ChannelPostEvent::class;
|
case CHANNEL_POST = ChannelPostEvent::class;
|
||||||
|
case EDITED_MESSAGE = EditedMessageEvent::class;
|
||||||
}
|
}
|
||||||
|
|
28
src/TgBotLib/Events/EditedMessageEvent.php
Normal file
28
src/TgBotLib/Events/EditedMessageEvent.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 EditedMessageEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateEventType::EDITED_MESSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the current edited message.
|
||||||
|
*
|
||||||
|
* @return Message The edited message.
|
||||||
|
*/
|
||||||
|
protected function getEditedMessage(): Message
|
||||||
|
{
|
||||||
|
return $this->update->getEditedMessage();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue