Ejemplo n.º 1
0
<?php

set_time_limit(0);
require_once 'PollBot.php';
define('BOT_TOKEN', '');
$bot = new PollBot(BOT_TOKEN, 'testbotforvladimir');
$bot->runLongpoll();
<?php

require_once 'PollBot.php';
define('BOT_TOKEN', 'XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
define('BOT_WEBHOOK', 'https://bot.server/poll-bot-webhook.php');
$bot = new PollBot(BOT_TOKEN, 'PollBotChat');
if (php_sapi_name() == 'cli') {
    if ($argv[1] == 'set') {
        $bot->setWebhook(BOT_WEBHOOK);
    } else {
        if ($argv[1] == 'remove') {
            $bot->removeWebhook();
        }
    }
    exit;
}
$response = file_get_contents('php://input');
$update = json_decode($response, true);
$bot->init();
$bot->onUpdateReceived($update);