getWebhookUpdates() public method

Alias for getWebhookUpdate
Deprecation: Call method getWebhookUpdate (note lack of letter s at end) To be removed in next major version.
public getWebhookUpdates ( boolean $shouldEmitEvent = true ) : Update
$shouldEmitEvent boolean
return Telegram\Bot\Objects\Update
示例#1
0
<?php

require_once 'EDITME/config.php';
require_once 'boot.php';
use Telegram\Bot\Api;
$telegram = new Api($BOTTOKEN);
$updates = $telegram->getWebhookUpdates();
$arup = json_decode($updates, true);
//syslog(LOG_INFO, $updates);
$acheck = $arup;
unset($acheck['message']['message_id']);
unset($acheck['message']['from']);
unset($acheck['message']['chat']);
unset($acheck['message']['date']);
foreach ($commands as $command) {
    $command = substr_replace($command, '', 0, 7);
    $command = substr_replace($command, '', -4);
    $telegram->addCommand('Commands\\' . $command);
}
foreach ($acheck['message'] as $vc => $avalue) {
    switch ($vc) {
        case "text":
            if ($arup['message']['text'][0] != "/") {
                $telegram->sendMessage($arup['message']['chat']['id'], $lang['error_command']);
            } else {
                $telegram->commandsHandler(true);
            }
            break;
        case "photo":
            $telegram->sendMessage($arup['message']['chat']['id'], $lang['recv_photo']);
            break;