<?php
include "../classes/MessageProcessor.php";
include "../classes/PostBaker.php";
// define(BOT_USER, '@witzig_bot');
// define(BOT_TOKEN, '298464685:AAFcLFLihdT5luxv7qcXTARfU9M6Jo9V3Wc');
// define(WEBHOOK_URL, 'https://www.musicerian.tk/autopost/bots/witzig.php');
$BOT_USER= '@witzig_bot';
$BOT_TOKEN= '298464685:AAFcLFLihdT5luxv7qcXTARfU9M6Jo9V3Wc';
$WEBHOOK_URL= 'https://www.musicerian.tk/autopost/bots/witzigi.php';
$SIGN ="weitere Videos https://telegram.me/joinchat/Aq0rTD_nngajTRzCkW9ptA";
$witzigBot = new MessageProcessor($BOT_USER,$BOT_TOKEN,$WEBHOOK_URL, $SIGN);
if (php_sapi_name () == 'cli' || isset($_GET ['task']) == 'setWebhook') {
// if run from console, set or delete webhook
$witzigBot->setWebhook();
exit ();
}
if (isset($_GET ['do']) == 'postVideo') {
// if run from console, set or delete webhook
$postBaker= new PostBaker($BOT_USER,$BOT_TOKEN, $SIGN);
$postBaker->postVideo();
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, ), ), );
}
if (! $update) {
// receive wrong update, must not happen
exit ();
}
if (isset ( $update ["message"] )) {
$witzigBot->process( $update );
}
?>