mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-10-07 20:39:34 +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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user