Add support for edited business messages

This commit is contained in:
netkas 2024-11-02 00:27:17 -04:00
parent 775a5ab71f
commit b40ee01d6e
3 changed files with 35 additions and 0 deletions

View file

@ -141,6 +141,11 @@
return UpdateEventType::DELETED_BUSINESS_MESSAGES;
}
if($update->getEditedBusinessMessage() !== null)
{
return UpdateEventType::EDITED_BUSINESS_MESSAGE;
}
return UpdateEventType::UPDATE_EVENT;
}
}

View file

@ -9,6 +9,7 @@
use TgBotLib\Events\ChatMemberUpdatedEvent;
use TgBotLib\Events\ChosenInlineResultEvent;
use TgBotLib\Events\DeletedBusinessMessagesEvent;
use TgBotLib\Events\EditedBusinessMessageEvent;
use TgBotLib\Events\InlineQueryEvent;
use TgBotLib\Events\MessageReactionCountEvent;
use TgBotLib\Events\MessageReactionEvent;
@ -40,4 +41,5 @@
case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class;
case MESSAGE_REACTION = MessageReactionEvent::class;
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
}

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Abstracts\UpdateEvent;
use TgBotLib\Enums\UpdateEventType;
use TgBotLib\Objects\Message;
abstract class EditedBusinessMessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): UpdateEventType
{
return UpdateEventType::EDITED_BUSINESS_MESSAGE;
}
/**
* New incoming edited business message
*
* @return Message
*/
protected function getEditedBusinessMessage(): Message
{
return $this->update->getEditedBusinessMessage();
}
}