getUpdates() public method

$params = [ 'offset' => '', 'limit' => '', 'timeout' => '', ];
public getUpdates ( array $params = [], boolean $shouldEmitEvents = true ) : Update[]
$params array
$shouldEmitEvents boolean
return Telegram\Bot\Objects\Update[]
 /**
  * @param Request $request
  *
  * @return View|JsonResponse
  */
 public function index(Request $request)
 {
     if ($request->isJson()) {
         return new JsonResponse(array_reverse($this->telegram->getUpdates()));
     }
     return $this->webUi->view('staff.telegram.index');
 }
Beispiel #2
0
<?php

require 'vendor/autoload.php';
use Telegram\Bot\Api;
$telegram = new Api('153172554:AAGrcXguYssXQAwsM2M-YIvBL2RJS1fdgrk');
$updates = $telegram->getUpdates();
return $updates;
<?php

require 'vendor/autoload.php';
use Telegram\Bot\Api;
$api = new Api('146785038:AAHwk3zAWaYh_LJbowIepSkv5EMngXMriN4');
$chat = $api->getUpdates()[0]->getMessage()->getChat();
// while(1) {
// 	$api->sendMessage(array('text' => 'oi', 'chat_id' => 149378523));
// 	sleep(5);
// }