Skip to content

Commit 8593568

Browse files
committed
Add getChannelPost member function
1 parent 9e42e86 commit 8593568

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/Entities/Update.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(array $data, $bot_name)
4141

4242
$this->channel_post = isset($data['channel_post']) ? $data['channel_post'] : null;
4343
if (!empty($this->channel_post)) {
44+
$this->channel_post = new Message($this->channel_post, $bot_name);
4445
$this->update_type = 'channel_post';
4546
}
4647

@@ -89,6 +90,12 @@ public function getMessage()
8990
{
9091
return $this->message;
9192
}
93+
94+
public function getChannelPost()
95+
{
96+
return $this->channel_post;
97+
}
98+
9299
public function getEditedMessage()
93100
{
94101
return $this->edited_message;

src/Telegram.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ public function handleGetUpdatesCore($offset, $limit = null, $timeout = null)
319319
if ($response->isOk()) {
320320
//Process all updates
321321
foreach ((array) $response->getResult() as $result) {
322+
print($result);
322323
$this->processUpdate($result);
323324
}
324325
}
@@ -374,11 +375,8 @@ public function processUpdate(Update $update)
374375
$update_type = $this->update->getUpdateType();
375376

376377
if ($update_type === 'channel_post') {
377-
return Request::emptyResponse();
378-
}
379-
380-
381-
if (in_array($update_type, ['inline_query', 'chosen_inline_result', 'callback_query', 'edited_message'])) {
378+
$command = $this->getCommandFromType($update_type);
379+
} elseif (in_array($update_type, ['inline_query', 'chosen_inline_result', 'callback_query', 'edited_message'])) {
382380
$command = $this->getCommandFromType($update_type);
383381
} elseif ($update_type === 'message') {
384382
$message = $this->update->getMessage();
@@ -413,7 +411,9 @@ public function processUpdate(Update $update)
413411
//This is necessary to "require" all the necessary command files!
414412
$this->getCommandsList();
415413

416-
DB::insertRequest($this->update);
414+
if ($update_type !== 'channel_post') {
415+
DB::insertRequest($this->update);
416+
}
417417

418418
return $this->executeCommand($command);
419419
}

0 commit comments

Comments
 (0)