Files
max-bot-test/src/Handler/Update/BotStopedFromChatHandler.php
pkirillw 9385fbdd6e
Some checks failed
Deploy Max Bot Test / deploy (push) Failing after 3s
feat: max-bot-test initial — full surface coverage
- Slim 4 PSR-15 webhook, PHP-DI 7, Symfony Console 8
- 13 update handlers, 30+ command scenarios, all 7 button types
- Composer pulls pkirillw/max-bot-api-php from GitHub vcs
- Multi-stage Dockerfile (php-fpm 8.4-alpine) + nginx
- docker-compose.yml targets server (npm_default external)
- docker-compose.override.yml for local dev (gitignored)
- .gitea/workflows/deploy.yml mirrors ghost-blog-bot pattern

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 00:01:06 +03:00

31 lines
959 B
PHP

<?php
declare(strict_types=1);
namespace App\Handler\Update;
use App\Handler\AbstractUpdateHandler;
use Pkirillw\MaxBotApi\Api;
use Pkirillw\MaxBotApi\Scheme\Update\BotStopedFromChatUpdate;
use Pkirillw\MaxBotApi\Scheme\Update\UpdateInterface;
use Psr\Log\LoggerInterface;
final class BotStopedFromChatHandler extends AbstractUpdateHandler
{
public function updateClass(): string { return \Pkirillw\MaxBotApi\Scheme\Update\BotStopedFromChatUpdate::class; }
public function handle(UpdateInterface $update): void
{
if (!$update instanceof BotStopedFromChatUpdate) {
return;
}
$this->logger->info('bot stopped (blocked) by user', [
'chat_id' => $update->chatId,
'user_id' => $update->user->userId,
]);
if ($this->api->debugs->getChatId() !== null) {
$this->api->debugs->sendText(sprintf('user %d stopped the bot', $update->user->userId));
}
}
}