Add support for deleted business messages event

This commit is contained in:
netkas 2024-11-02 00:24:18 -04:00
parent b4a7d69c3c
commit 775a5ab71f
3 changed files with 36 additions and 0 deletions

View file

@ -136,6 +136,11 @@
return UpdateEventType::MESSAGE_REACTION; return UpdateEventType::MESSAGE_REACTION;
} }
if($update->getDeletedBusinessMessages() !== null)
{
return UpdateEventType::DELETED_BUSINESS_MESSAGES;
}
return UpdateEventType::UPDATE_EVENT; return UpdateEventType::UPDATE_EVENT;
} }
} }

View file

@ -8,6 +8,7 @@
use TgBotLib\Events\ChatJoinRequestEvent; use TgBotLib\Events\ChatJoinRequestEvent;
use TgBotLib\Events\ChatMemberUpdatedEvent; use TgBotLib\Events\ChatMemberUpdatedEvent;
use TgBotLib\Events\ChosenInlineResultEvent; use TgBotLib\Events\ChosenInlineResultEvent;
use TgBotLib\Events\DeletedBusinessMessagesEvent;
use TgBotLib\Events\InlineQueryEvent; use TgBotLib\Events\InlineQueryEvent;
use TgBotLib\Events\MessageReactionCountEvent; use TgBotLib\Events\MessageReactionCountEvent;
use TgBotLib\Events\MessageReactionEvent; use TgBotLib\Events\MessageReactionEvent;
@ -38,4 +39,5 @@
case INLINE_QUERY = InlineQueryEvent::class; case INLINE_QUERY = InlineQueryEvent::class;
case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class; case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class;
case MESSAGE_REACTION = MessageReactionEvent::class; case MESSAGE_REACTION = MessageReactionEvent::class;
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
} }

View file

@ -0,0 +1,29 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Abstracts\UpdateEvent;
use TgBotLib\Bot;
use TgBotLib\Enums\UpdateEventType;
use TgBotLib\Objects\BusinessMessagesDeleted;
abstract class DeletedBusinessMessagesEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): UpdateEventType
{
return UpdateEventType::DELETED_BUSINESS_MESSAGES;
}
/**
* Messages were deleted from a connected business account
*
* @return BusinessMessagesDeleted
*/
protected function getBusinessMessagesDeleted(): BusinessMessagesDeleted
{
return $this->update->getDeletedBusinessMessages();
}
}