<?php
ini_set('error_reporting',8191);
ini_set('display_errors',1);
try {
include "./../../classes/frontdesks/tamasbabot/tamasbabotleader.php";
$debug=false;
$BOT_USER= '@Tamasbabot';
$BOT_TOKEN= '379870251:AAGs1q27Ql7FsJr67if7JgAWs02jV76uS7E';
$uriParts = explode("?",$_SERVER['REQUEST_URI']);
$actual_link = "https://$_SERVER[HTTP_HOST]".$uriParts[0];
$WEBHOOK_URL= $actual_link;
$SIGN = PHP_EOL."@Tamasbabot";
$tamasbaBot = new Tamasbabot($BOT_USER,$BOT_TOKEN,$WEBHOOK_URL, $SIGN, 611059896);
if (isset($_GET ['do']) && $_GET ['do'] == 'setWebhook') {
echo "setting webhook...\n";
echo "</br>webhook : $WEBHOOK_URL</br>";
// if run from console, set or delete webhook
$tamasbaBot->setWebhook();
exit ();
}
if (isset($_GET ['do']) && $_GET ['do'] == 'debug') {
$debug = true;
ini_set('error_reporting',8191);
ini_set('display_errors',1);
}
$content = file_get_contents ( "php://input" );
$update = json_decode ( $content, true );
if ($_SERVER['SERVER_NAME'] == "localhost" || $debug) {
echo "debugging...".PHP_EOL;
$tamasbaBot->debug = true;
$debugUserID = 44903244;
$debugUserID = 467170469;
$debugUserID = 531889508;
$debugUserID = 264271258;
$debugUserID = 911228571;
$debugUserID = 590059263;
$debugUserID = 974058313;
// $update = $tamasbaBot->getDebugsManager()->getUpdateForCallBack($debugUserID);
$update = $tamasbaBot->getDebugsManager()->getUpdateForTestPerson($debugUserID);
}
if (! $update) {
exit ();
}
if (isset ( $update ["update_id"] )) {
$supportMsg = "امروز ربات لغتنامه کمی مشکل داشت، مشکل برطرف شد، کمی طول می کشه تا سرعت درست شه، ببخشید عزیزم";
$now = microtime(true);
$tamasbaBot->process ( $update );
$last = microtime(true);
$tookTime = $last-$now;
}
} catch ( Exception $e ) {
echo 'Exception abgefangen: ', $e->getMessage (), "\n";
}
?>