<?php

declare(strict_types=1);

if (PHP_SAPI !== 'cli') {
    http_response_code(403);
    echo "This script can be run only from CLI.\n";
    exit(1);
}

require_once __DIR__ . '/../src/cleanup.php';

$options = getopt('', ['bot-id:', 'help']);
if (isset($options['help']) || empty($options['bot-id'])) {
    echo "Usage: php tools/delete_bot.php --bot-id=222701\n";
    exit(isset($options['help']) ? 0 : 1);
}

cliPrintJson([
    'bot_id' => (int) $options['bot-id'],
    'result' => unregisterBitrixBot((int) $options['bot-id']),
]);
