<?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;