|
27 | 27 | * Provides convenient methods for integrating Max Bot with Laravel applications. |
28 | 28 | * Handles webhook processing, long polling, and event dispatching within Laravel context. |
29 | 29 | */ |
30 | | -class MaxBotManager |
| 30 | +readonly class MaxBotManager |
31 | 31 | { |
32 | 32 | /** |
33 | 33 | * @param Container $container |
34 | 34 | * @param Api $api |
35 | 35 | * @param UpdateDispatcher $dispatcher |
36 | 36 | */ |
37 | 37 | public function __construct( |
38 | | - private readonly Container $container, |
39 | | - private readonly Api $api, |
40 | | - private readonly UpdateDispatcher $dispatcher, |
| 38 | + private Container $container, |
| 39 | + private Api $api, |
| 40 | + private UpdateDispatcher $dispatcher, |
41 | 41 | ) { |
42 | 42 | } |
43 | 43 |
|
@@ -242,6 +242,45 @@ public function onDialogMuted(callable|string $handler): void |
242 | 242 | $this->dispatcher->onDialogMuted($this->resolveHandler($handler)); |
243 | 243 | } |
244 | 244 |
|
| 245 | + /** |
| 246 | + * Register a dialog unmute handler. |
| 247 | + * |
| 248 | + * @param callable|string $handler Can be a closure, callable, or Laravel container binding. |
| 249 | + * |
| 250 | + * @throws BindingResolutionException |
| 251 | + * @codeCoverageIgnore |
| 252 | + */ |
| 253 | + public function onDialogUnmuted(callable|string $handler): void |
| 254 | + { |
| 255 | + $this->dispatcher->onDialogUnmuted($this->resolveHandler($handler)); |
| 256 | + } |
| 257 | + |
| 258 | + /** |
| 259 | + * Register a dialog cleared handler. |
| 260 | + * |
| 261 | + * @param callable|string $handler Can be a closure, callable, or Laravel container binding. |
| 262 | + * |
| 263 | + * @throws BindingResolutionException |
| 264 | + * @codeCoverageIgnore |
| 265 | + */ |
| 266 | + public function onDialogCleared(callable|string $handler): void |
| 267 | + { |
| 268 | + $this->dispatcher->onDialogCleared($this->resolveHandler($handler)); |
| 269 | + } |
| 270 | + |
| 271 | + /** |
| 272 | + * Register a dialog removed handler. |
| 273 | + * |
| 274 | + * @param callable|string $handler Can be a closure, callable, or Laravel container binding. |
| 275 | + * |
| 276 | + * @throws BindingResolutionException |
| 277 | + * @codeCoverageIgnore |
| 278 | + */ |
| 279 | + public function onDialogRemoved(callable|string $handler): void |
| 280 | + { |
| 281 | + $this->dispatcher->onDialogRemoved($this->resolveHandler($handler)); |
| 282 | + } |
| 283 | + |
245 | 284 | /** |
246 | 285 | * Register a user added handler. |
247 | 286 | * |
|
0 commit comments