mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-10-09 13:28:21 +00:00
Parse comment and bot admin permission updates
UpdateType already had comment_created, comment_edited, comment_removed and bot_admin_permissions_changed, but ModelFactory had no models for them and threw "Unknown or unsupported update type". Adds the models from schema 0.0.33, maps them in createUpdate() and adds on*() shortcuts to UpdateDispatcher and MaxBotManager.
This commit is contained in:
@@ -57,8 +57,12 @@ use BushlanovDev\MaxMessengerBot\Models\Updates\AbstractUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\BotAddedToChatUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\BotRemovedFromChatUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\BotStartedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\BotAdminPermissionsChangedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\BotStoppedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\ChatTitleChangedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\CommentCreatedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\CommentEditedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\CommentRemovedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\DialogClearedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\DialogMutedUpdate;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Updates\DialogRemovedUpdate;
|
||||
@@ -409,6 +413,10 @@ readonly class ModelFactory
|
||||
UpdateType::BotStopped => BotStoppedUpdate::fromArray($data),
|
||||
UpdateType::ChatTitleChanged => ChatTitleChangedUpdate::fromArray($data),
|
||||
UpdateType::MessageChatCreated => MessageChatCreatedUpdate::fromArray($data),
|
||||
UpdateType::CommentCreated => CommentCreatedUpdate::fromArray($data),
|
||||
UpdateType::CommentEdited => CommentEditedUpdate::fromArray($data),
|
||||
UpdateType::CommentRemoved => CommentRemovedUpdate::fromArray($data),
|
||||
UpdateType::BotAdminPermissionChanged => BotAdminPermissionsChangedUpdate::fromArray($data),
|
||||
default => throw new LogicException(
|
||||
'Unknown or unsupported update type received: ' . ($data['update_type'] ?? 'none')
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user