<?php
include "../classes/Enum.php";
include_once "../classes/menu/KeyboardMenu.php";
include "../classes/Loghatnameh.php";
include "../classes/MessageProcessor.php";
include "../classes/DictionaryDatabaseHandler.php";
include "../classes/TranslateService.php";
include "../classes/PostBaker.php";
include '../classes/MiniCurl.php';
include "../classes/quiz/QuizDatabaseHandler.php";
include "../classes/quiz/QuizMaker.php";
include_once "../classes/speech/Speech.php";
include_once "../classes/conjugator/Conjugator.php";
include_once "../classes/learn/LearnSystem.php";
include_once "../classes/advertise/AdsManager.class.php";
$debug=false;
$BOT_USER= '@bilderbuch_bot';
$BOT_TOKEN= '311317276:AAHkExbulkZGqFXX459PQ_GSZJePvSZgP9s';
//$WEBHOOK_URL= 'https://www.musicerian.tk/autopost/bots/translategerman2.php';
$uriParts = explode("?",$_SERVER['REQUEST_URI']);
$actual_link = "https://$_SERVER[HTTP_HOST]".$uriParts[0];
//$WEBHOOK_URL= 'https://vpsapi.tk/loghatnameh/autoPost/bots/translategerman2.php';
$WEBHOOK_URL= $actual_link;
$SIGN ="پوشش خبری شهر های آلمان ".PHP_EOL."@TranslateService";
$SIGN ="weitere Bilder https://telegram.me/joinchat/Aq0rTEDnFZ66AKTSU05F8w";
$SIGN ="mehr Bilder @bilderbuch";
$bilderbuch_bot = new MessageProcessor($BOT_USER,$BOT_TOKEN,$WEBHOOK_URL, $SIGN, 44903244);
if (isset($_GET ['do']) && $_GET ['do'] == 'setWebhook') {
echo "setting webhook...\n";
// if run from console, set or delete webhook
$bilderbuch_bot->setWebhook();
exit ();
}
if (isset($_GET ['do']) && $_GET ['do'] == 'postVideo') {
$postBaker= new PostBaker($BOT_USER,$BOT_TOKEN, $SIGN);
$postBaker->postVideo();
exit ();
}
if (isset($_GET ['do']) && $_GET ['do'] == 'postPhoto') {
$postBaker= new PostBaker($BOT_USER,$BOT_TOKEN, $SIGN);
$postBaker->postPhoto();
exit ();
}
$content = file_get_contents ( "php://input" );
$update = json_decode ( $content, true );
if ($_SERVER ['SERVER_NAME'] == "localhost") {
// $update = array ( 'update_id' => 802512343, 'message' => array ( 'message_id' => 865, 'from' => array ( 'id' => 44903244445, 'first_name' => 'Saeed', 'username' => 'sinzed', ), 'chat' => array ( 'id' => 44903244, 'first_name' => 'Saeed', 'username' => 'sinzed', 'type' => 'private', ), 'date' => 1480911910, 'forward_from' => array ( 'id' => 44903244, 'first_name' => 'Saeed', 'username' => 'sinzed', ), 'forward_date' => 1480910459, 'video' => array ( 'duration' => 5, 'width' => 400, 'height' => 400, 'thumb' => array ( 'file_id' => 'AAQCABN4EIINAARY0M8fcMg54QLBAAIC', 'file_size' => 2464, 'width' => 90, 'height' => 90, ), 'file_id' => 'BAADAgAD6wUAAkwrrQJiWLK_HahlFQI', 'file_size' => 271180, ), ), );
$update = array (
'update_id' => 310853147,
'message' => array (
'message_id' => 10,
'from' => array (
'id' => 44903244,
'first_name' => 'Saeed',
'username' => 'sinzed'
),
'chat' => array (
'id' => 44903244,
'first_name' => 'Saeed',
'username' => 'sinzed',
'type' => 'private'
),
'date' => 1481901731,
'text' => 'neue'
)
);
}
if (! $update) {
exit ();
}
if (isset ( $update ["message"] )) {
$bilderbuch_bot->process( $update );
$testMessage = var_export($update, true);
file_put_contents("testaxnegarplease.html", $testMessage, FILE_APPEND | LOCK_EX);
}
?>