|
12 | 12 |
|
13 | 13 | use Exception; |
14 | 14 | use Longman\IPTools\Ip; |
| 15 | +use Longman\TelegramBot\Entities\CallbackQuery; |
15 | 16 | use Longman\TelegramBot\Entities\ChosenInlineResult; |
16 | 17 | use Longman\TelegramBot\Entities\InlineQuery; |
17 | 18 | use Longman\TelegramBot\Entities\Message; |
@@ -510,22 +511,27 @@ protected function defaultGetUpdatesCallback($get_updates_response): string |
510 | 511 | ); |
511 | 512 |
|
512 | 513 | foreach ($results as $result) { |
513 | | - $chat_id = 0; |
514 | | - $text = '<n/a>'; |
515 | | - |
516 | 514 | $update_content = $result->getUpdateContent(); |
| 515 | + |
| 516 | + $chat_id = 'n/a'; |
| 517 | + $text = $result->getUpdateType(); |
| 518 | + |
517 | 519 | if ($update_content instanceof Message) { |
| 520 | + /** @var Message $update_content */ |
518 | 521 | $chat_id = $update_content->getChat()->getId(); |
519 | | - $text = sprintf('<%s>', $update_content->getType()); |
520 | | - } elseif ($update_content instanceof InlineQuery |
521 | | - || $update_content instanceof ChosenInlineResult |
522 | | - ) { |
| 522 | + $text .= ";{$update_content->getType()}"; |
| 523 | + } elseif ($update_content instanceof InlineQuery || $update_content instanceof ChosenInlineResult) { |
| 524 | + /** @var InlineQuery|ChosenInlineResult $update_content */ |
523 | 525 | $chat_id = $update_content->getFrom()->getId(); |
524 | | - $text = sprintf('<query> %s', $update_content->getQuery()); |
| 526 | + $text .= ";{$update_content->getQuery()}"; |
| 527 | + } elseif ($update_content instanceof CallbackQuery) { |
| 528 | + /** @var CallbackQuery $update_content */ |
| 529 | + $chat_id = $update_content->getMessage()->getChat()->getId(); |
| 530 | + $text .= ";{$update_content->getData()}"; |
525 | 531 | } |
526 | 532 |
|
527 | 533 | $output .= sprintf( |
528 | | - '%d: %s' . PHP_EOL, |
| 534 | + '%d: <%s>' . PHP_EOL, |
529 | 535 | $chat_id, |
530 | 536 | preg_replace('/\s+/', ' ', trim($text)) |
531 | 537 | ); |
|
0 commit comments