Commit fa88ab2b authored by MBoretto's avatar MBoretto

new table schema works!

parent 820130b0
This diff is collapsed.
......@@ -37,12 +37,12 @@ class ChosenInlineResult extends Entity
$this->offset = isset($data['offset']) ? $data['offset'] : null;
}
public function getId()
public function getResultId()
{
return $this->id;
return $this->result_id;
}
public function geFrom()
public function getFrom()
{
return $this->from;
}
......
......@@ -21,7 +21,7 @@ class Update extends Entity
protected $chosen_inline_result;
private $update_type;
public function __construct(array $data, $bot_name, $let_update_id_empty = 0)
public function __construct(array $data, $bot_name)
{
$this->bot_name = $bot_name;
......@@ -35,11 +35,10 @@ class Update extends Entity
$this->update_type = 'message';
}
if (empty($update_id) && !$let_update_id_empty) {
if (empty($update_id)) {
throw new TelegramException('update_id is empty!');
}
$this->inline_query = isset($data['inline_query']) ? $data['inline_query'] : null;
if (!empty($this->inline_query)) {
$this->inline_query = new InlineQuery($this->inline_query);
......
......@@ -29,7 +29,7 @@ class Telegram
*
* @var string
*/
protected $version = '0.25.0';
protected $version = '0.26.0';
/**
* Telegram API key
......@@ -343,11 +343,11 @@ class Telegram
public function handleGetUpdates($limit = null, $timeout = null)
{
//DB Query
$last_message = DB::selectMessages(1);
$last_update = DB::selectTelegramUpdate(1);
if (isset($last_message[0]['update_id'])) {
if (isset($last_update[0]['id'])) {
//As explained in the telegram bot api documentation
$offset = $last_message[0]['update_id']+1;
$offset = $last_update[0]['id']+1;
} else {
$offset = null;
}
......@@ -418,8 +418,6 @@ class Telegram
}
}
DB::insertRequest($update);
// check type
$message = $update->getMessage();
$type = $message->getType();
......@@ -475,6 +473,7 @@ class Telegram
$command = 'Choseninlineresult';
}
DB::insertRequest($update);
$result = $this->executeCommand($command, $update);
return $result;
}
......
This diff is collapsed.
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