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:
Timofey
2026-09-28 00:13:13 +05:00
parent 749c0aab5b
commit d1637add72
12 changed files with 454 additions and 0 deletions
+52
View File
@@ -293,4 +293,56 @@ final class UpdateDispatcher
{
return $this->addHandler(UpdateType::MessageChatCreated, $handler);
}
/**
* A convenient alias for addHandler(UpdateType::CommentCreated, $handler).
*
* @param callable(Models\Updates\CommentCreatedUpdate, Api): void $handler
*
* @return $this
* @codeCoverageIgnore
*/
public function onCommentCreated(callable $handler): self
{
return $this->addHandler(UpdateType::CommentCreated, $handler);
}
/**
* A convenient alias for addHandler(UpdateType::CommentEdited, $handler).
*
* @param callable(Models\Updates\CommentEditedUpdate, Api): void $handler
*
* @return $this
* @codeCoverageIgnore
*/
public function onCommentEdited(callable $handler): self
{
return $this->addHandler(UpdateType::CommentEdited, $handler);
}
/**
* A convenient alias for addHandler(UpdateType::CommentRemoved, $handler).
*
* @param callable(Models\Updates\CommentRemovedUpdate, Api): void $handler
*
* @return $this
* @codeCoverageIgnore
*/
public function onCommentRemoved(callable $handler): self
{
return $this->addHandler(UpdateType::CommentRemoved, $handler);
}
/**
* A convenient alias for addHandler(UpdateType::BotAdminPermissionChanged, $handler).
*
* @param callable(Models\Updates\BotAdminPermissionsChangedUpdate, Api): void $handler
*
* @return $this
* @codeCoverageIgnore
*/
public function onBotAdminPermissionsChanged(callable $handler): self
{
return $this->addHandler(UpdateType::BotAdminPermissionChanged, $handler);
}
}