Ignore custom input

parent 8a70d87e
...@@ -62,31 +62,26 @@ class Kernel ...@@ -62,31 +62,26 @@ class Kernel
$offset = 0; $offset = 0;
// Take custom input into account. if (DB::isDbConnected()) {
if ($custom_input = $this->app->getCustomInput()) { // Get last update id from the database
$response = new Response(json_decode($custom_input, true), $this->app->getBotUsername()); $last_update = DB::selectTelegramUpdate(1);
} else { $last_update = reset($last_update);
if (DB::isDbConnected()) {
// Get last update id from the database
$last_update = DB::selectTelegramUpdate(1);
$last_update = reset($last_update);
$this->app->last_update_id = isset($last_update['id']) ? $last_update['id'] : null; $this->app->last_update_id = isset($last_update['id']) ? $last_update['id'] : null;
} }
if ($this->app->last_update_id !== null) {
$offset = $this->app->last_update_id + 1; //As explained in the telegram bot API documentation
}
$response = Client::getUpdates( if ($this->app->last_update_id !== null) {
[ $offset = $this->app->last_update_id + 1; //As explained in the telegram bot API documentation
'offset' => $offset,
'limit' => $limit,
'timeout' => $timeout,
]
);
} }
$response = Client::getUpdates(
[
'offset' => $offset,
'limit' => $limit,
'timeout' => $timeout,
]
);
if ($response->isOk()) { if ($response->isOk()) {
$results = $response->getResult(); $results = $response->getResult();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment