// New proccess, start main cycle while(true) { //logic here o.o botMonitoring(); if (date('His') == 080000) { newYearCountDown(getDialogRandom()[0],getDialogRandom()[1]); sendSticker(); }; if((date('D') == 'Sat' || date('D') == 'Sun') && (date('H') > 08 & date('H') < 22) && $time==date('H')) { $time+=1; sendMessage(toDoRandom()); } sleep(1); };
function botMonitoring(){ $content = file_get_contents(API_URL.'getUpdates?offset=-1'); $update = json_decode($content,true); $message = $update['result'][0]['message']; // count($update['result'])-1 $text = $message['text']; $date = $message['date']; if($date > getdate()[0] - 1){ sendMessage(findAnswer($text)); }; };
$date = isset($message['date']);