@@ -12,7 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | use Longman\TelegramBot\Commands\UserCommand; |
| 14 | 14 | use Longman\TelegramBot\Request; |
| 15 | -use Longman\TelegramBot\Entities\ReplyKeyboardMarkup; |
|
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * User "/markdown" command |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Longman\TelegramBot\Conversation; |
| 15 | 15 | use Longman\TelegramBot\Commands\AdminCommand; |
| 16 | 16 | use Longman\TelegramBot\Entities\Message; |
| 17 | -use Longman\TelegramBot\Entities\ReplyKeyboardHide; |
|
| 18 | 17 | use Longman\TelegramBot\Entities\ReplyKeyboardMarkup; |
| 19 | 18 | use Longman\TelegramBot\Exception\TelegramException; |
| 20 | 19 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
| 98 | 98 | [ |
| 99 | - 'keyboard' => $keyboard , |
|
| 99 | + 'keyboard' => $keyboard, |
|
| 100 | 100 | 'resize_keyboard' => true, |
| 101 | 101 | 'one_time_keyboard' => true, |
| 102 | 102 | 'selective' => true |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $keyboard = [['Yes', 'No']]; |
| 140 | 140 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
| 141 | 141 | [ |
| 142 | - 'keyboard' => $keyboard , |
|
| 142 | + 'keyboard' => $keyboard, |
|
| 143 | 143 | 'resize_keyboard' => true, |
| 144 | 144 | 'one_time_keyboard' => true, |
| 145 | 145 | 'selective' => true |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $this->conversation->notes['last_message_id'] = $message->getMessageId(); |
| 163 | 163 | // no break |
| 164 | 164 | case 3: |
| 165 | - if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message' ) && $this->conversation->notes['set_caption']) { |
|
| 165 | + if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message') && $this->conversation->notes['set_caption']) { |
|
| 166 | 166 | $this->conversation->notes['state'] = 3; |
| 167 | 167 | $this->conversation->update(); |
| 168 | 168 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $keyboard = [['Yes', 'No']]; |
| 196 | 196 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
| 197 | 197 | [ |
| 198 | - 'keyboard' => $keyboard , |
|
| 198 | + 'keyboard' => $keyboard, |
|
| 199 | 199 | 'resize_keyboard' => true, |
| 200 | 200 | 'one_time_keyboard' => true, |
| 201 | 201 | 'selective' => true |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | if ($this->sendBack($message, $data)->isOk()) { |
| 274 | 274 | $response = 'Message sent successfully to: ' . $channel; |
| 275 | 275 | } else { |
| 276 | - $response = 'Message not sent to: ' . $channel . "\n" . |
|
| 276 | + $response = 'Message not sent to: ' . $channel . "\n" . |
|
| 277 | 277 | '- Does the channel exist?' . "\n" . |
| 278 | 278 | '- Is the bot an admin of the channel?'; |
| 279 | 279 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | $callback_path = 'Longman\TelegramBot\Request'; |
| 325 | 325 | $callback_function = 'send' . $type; |
| 326 | - if (! method_exists($callback_path, $callback_function)) { |
|
| 326 | + if (!method_exists($callback_path, $callback_function)) { |
|
| 327 | 327 | throw new TelegramException('Methods: ' . $callback_function . ' not found in class Request.'); |
| 328 | 328 | } |
| 329 | 329 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Execution if MySQL is required but not available |
| 33 | 33 | * |
| 34 | - * @return boolean |
|
| 34 | + * @return \Longman\TelegramBot\Entities\ServerResponse |
|
| 35 | 35 | */ |
| 36 | 36 | public function executeNoDb() |
| 37 | 37 | { |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Longman\TelegramBot\Conversation; |
| 15 | 15 | use Longman\TelegramBot\Commands\UserCommand; |
| 16 | 16 | use Longman\TelegramBot\Entities\ForceReply; |
| 17 | -use Longman\TelegramBot\Entities\ReplyKeyboardHide; |
|
| 18 | 17 | use Longman\TelegramBot\Entities\ReplyKeyboardMarkup; |
| 19 | 18 | |
| 20 | 19 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if ($chat->isGroupChat() || $chat->isSuperGroup()) { |
| 59 | 59 | //reply to message id is applied by default |
| 60 | 60 | //Force reply is applied by default to so can work with privacy on |
| 61 | - $data['reply_markup'] = new ForceReply([ 'selective' => true]); |
|
| 61 | + $data['reply_markup'] = new ForceReply(['selective' => true]); |
|
| 62 | 62 | } |
| 63 | 63 | $data['chat_id'] = $chat_id; |
| 64 | 64 | |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | $this->conversation->notes['state'] = 3; |
| 125 | 125 | $this->conversation->update(); |
| 126 | 126 | |
| 127 | - $keyboard = [['M','F']]; |
|
| 127 | + $keyboard = [['M', 'F']]; |
|
| 128 | 128 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
| 129 | 129 | [ |
| 130 | - 'keyboard' => $keyboard , |
|
| 130 | + 'keyboard' => $keyboard, |
|
| 131 | 131 | 'resize_keyboard' => true, |
| 132 | 132 | 'one_time_keyboard' => true, |
| 133 | 133 | 'selective' => true |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $this->conversation->update(); |
| 152 | 152 | $data['reply_markup'] = new ReplyKeyboardMarkup([ |
| 153 | 153 | 'keyboard' => [[ |
| 154 | - [ 'text' => 'Share Location', 'request_location' => true ], |
|
| 154 | + ['text' => 'Share Location', 'request_location' => true], |
|
| 155 | 155 | ]], |
| 156 | 156 | 'resize_keyboard' => true, |
| 157 | 157 | 'one_time_keyboard' => true, |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $data['text'] = 'Share your contact information:'; |
| 188 | 188 | $data['reply_markup'] = new ReplyKeyboardMarkup([ |
| 189 | 189 | 'keyboard' => [[ |
| 190 | - [ 'text' => 'Share Contact', 'request_contact' => true ], |
|
| 190 | + ['text' => 'Share Contact', 'request_contact' => true], |
|
| 191 | 191 | ]], |
| 192 | 192 | 'resize_keyboard' => true, |
| 193 | 193 | 'one_time_keyboard' => true, |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $out_text = '/Survey result:' . "\n"; |
| 205 | 205 | unset($this->conversation->notes['state']); |
| 206 | 206 | foreach ($this->conversation->notes as $k => $v) { |
| 207 | - $out_text .= "\n" . ucfirst($k).': ' . $v; |
|
| 207 | + $out_text .= "\n" . ucfirst($k) . ': ' . $v; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $data['photo'] = $this->conversation->notes['photo_id']; |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | * |
| 69 | 69 | * @param array $data |
| 70 | 70 | * |
| 71 | - * @return bool|string |
|
| 71 | + * @return false|string |
|
| 72 | 72 | */ |
| 73 | 73 | private function getWeatherString(array $data) |
| 74 | 74 | { |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | throw new TelegramException($e->getMessage()); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return (string)$response->getBody(); |
|
| 63 | + return (string) $response->getBody(); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | namespace Longman\TelegramBot\Commands\UserCommands; |
| 14 | 14 | |
| 15 | 15 | use Longman\TelegramBot\Commands\UserCommand; |
| 16 | -use Longman\TelegramBot\Entities\File; |
|
| 17 | 16 | use Longman\TelegramBot\Request; |
| 18 | 17 | |
| 19 | 18 | /** |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $limit = 10; |
| 56 | 56 | $offset = null; |
| 57 | 57 | $ServerResponse = Request::getUserProfilePhotos([ |
| 58 | - 'user_id' => $user_id , |
|
| 58 | + 'user_id' => $user_id, |
|
| 59 | 59 | 'limit' => $limit, |
| 60 | 60 | 'offset' => $offset, |
| 61 | 61 | ]); |
@@ -350,6 +350,9 @@ discard block |
||
| 350 | 350 | return $this->from; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | + /** |
|
| 354 | + * @return integer|null |
|
| 355 | + */ |
|
| 353 | 356 | public function getDate() |
| 354 | 357 | { |
| 355 | 358 | return $this->date; |
@@ -385,11 +388,17 @@ discard block |
||
| 385 | 388 | return $this->forward_from_chat; |
| 386 | 389 | } |
| 387 | 390 | |
| 391 | + /** |
|
| 392 | + * @return integer|null |
|
| 393 | + */ |
|
| 388 | 394 | public function getForwardDate() |
| 389 | 395 | { |
| 390 | 396 | return $this->forward_date; |
| 391 | 397 | } |
| 392 | 398 | |
| 399 | + /** |
|
| 400 | + * @return integer|null |
|
| 401 | + */ |
|
| 393 | 402 | public function getEditDate() |
| 394 | 403 | { |
| 395 | 404 | return $this->edit_date; |
@@ -432,7 +441,7 @@ discard block |
||
| 432 | 441 | } |
| 433 | 442 | |
| 434 | 443 | /** |
| 435 | - * @return array |
|
| 444 | + * @return PhotoSize[] |
|
| 436 | 445 | */ |
| 437 | 446 | public function getPhoto() |
| 438 | 447 | { |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | $this->type = 'Voice'; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $this->caption = isset($data['caption']) ? $data['caption'] : null;//string |
|
| 191 | + $this->caption = isset($data['caption']) ? $data['caption'] : null; //string |
|
| 192 | 192 | |
| 193 | 193 | $this->contact = isset($data['contact']) ? $data['contact'] : null; |
| 194 | 194 | if (!empty($this->contact)) { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $action Action to execute |
| 166 | 166 | * @param array|null $data Data to attach to the execution |
| 167 | 167 | * |
| 168 | - * @return mixed Result of the HTTP Request |
|
| 168 | + * @return \Psr\Http\Message\StreamInterface Result of the HTTP Request |
|
| 169 | 169 | */ |
| 170 | 170 | public static function execute($action, array $data = null) |
| 171 | 171 | { |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | /** |
| 306 | 306 | * Get me |
| 307 | 307 | * |
| 308 | - * @return mixed |
|
| 308 | + * @return ServerResponse |
|
| 309 | 309 | */ |
| 310 | 310 | public static function getMe() |
| 311 | 311 | { |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @param array $data |
| 346 | 346 | * |
| 347 | - * @return mixed |
|
| 347 | + * @return ServerResponse |
|
| 348 | 348 | */ |
| 349 | 349 | public static function forwardMessage(array $data) |
| 350 | 350 | { |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | * @param array $data |
| 362 | 362 | * @param string $file |
| 363 | 363 | * |
| 364 | - * @return mixed |
|
| 364 | + * @return ServerResponse |
|
| 365 | 365 | */ |
| 366 | 366 | public static function sendPhoto(array $data, $file = null) |
| 367 | 367 | { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | * @param array $data |
| 383 | 383 | * @param string $file |
| 384 | 384 | * |
| 385 | - * @return mixed |
|
| 385 | + * @return ServerResponse |
|
| 386 | 386 | */ |
| 387 | 387 | public static function sendAudio(array $data, $file = null) |
| 388 | 388 | { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * @param array $data |
| 404 | 404 | * @param string $file |
| 405 | 405 | * |
| 406 | - * @return mixed |
|
| 406 | + * @return ServerResponse |
|
| 407 | 407 | */ |
| 408 | 408 | public static function sendDocument(array $data, $file = null) |
| 409 | 409 | { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * @param array $data |
| 425 | 425 | * @param string $file |
| 426 | 426 | * |
| 427 | - * @return mixed |
|
| 427 | + * @return ServerResponse |
|
| 428 | 428 | */ |
| 429 | 429 | public static function sendSticker(array $data, $file = null) |
| 430 | 430 | { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * @param array $data |
| 446 | 446 | * @param string $file |
| 447 | 447 | * |
| 448 | - * @return mixed |
|
| 448 | + * @return ServerResponse |
|
| 449 | 449 | */ |
| 450 | 450 | public static function sendVideo(array $data, $file = null) |
| 451 | 451 | { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @param array $data |
| 467 | 467 | * @param string $file |
| 468 | 468 | * |
| 469 | - * @return mixed |
|
| 469 | + * @return ServerResponse |
|
| 470 | 470 | */ |
| 471 | 471 | public static function sendVoice(array $data, $file = null) |
| 472 | 472 | { |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * |
| 487 | 487 | * @param array $data |
| 488 | 488 | * |
| 489 | - * @return mixed |
|
| 489 | + * @return ServerResponse |
|
| 490 | 490 | */ |
| 491 | 491 | public static function sendLocation(array $data) |
| 492 | 492 | { |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | * |
| 503 | 503 | * @param array $data |
| 504 | 504 | * |
| 505 | - * @return mixed |
|
| 505 | + * @return ServerResponse |
|
| 506 | 506 | */ |
| 507 | 507 | public static function sendVenue(array $data) |
| 508 | 508 | { |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | * |
| 519 | 519 | * @param array $data |
| 520 | 520 | * |
| 521 | - * @return mixed |
|
| 521 | + * @return ServerResponse |
|
| 522 | 522 | */ |
| 523 | 523 | public static function sendContact(array $data) |
| 524 | 524 | { |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @param array $data |
| 536 | 536 | * |
| 537 | - * @return mixed |
|
| 537 | + * @return ServerResponse |
|
| 538 | 538 | */ |
| 539 | 539 | public static function sendChatAction(array $data) |
| 540 | 540 | { |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * |
| 551 | 551 | * @param array $data |
| 552 | 552 | * |
| 553 | - * @return mixed |
|
| 553 | + * @return ServerResponse |
|
| 554 | 554 | */ |
| 555 | 555 | public static function getUserProfilePhotos(array $data) |
| 556 | 556 | { |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | * |
| 571 | 571 | * @param array $data |
| 572 | 572 | * |
| 573 | - * @return mixed |
|
| 573 | + * @return ServerResponse |
|
| 574 | 574 | */ |
| 575 | 575 | public static function getUpdates(array $data) |
| 576 | 576 | { |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * @param string $url |
| 584 | 584 | * @param string $file |
| 585 | 585 | * |
| 586 | - * @return mixed |
|
| 586 | + * @return ServerResponse |
|
| 587 | 587 | */ |
| 588 | 588 | public static function setWebhook($url = '', $file = null) |
| 589 | 589 | { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | * |
| 602 | 602 | * @param array $data |
| 603 | 603 | * |
| 604 | - * @return mixed |
|
| 604 | + * @return ServerResponse |
|
| 605 | 605 | */ |
| 606 | 606 | public static function getFile(array $data) |
| 607 | 607 | { |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | * |
| 618 | 618 | * @param array $data |
| 619 | 619 | * |
| 620 | - * @return mixed |
|
| 620 | + * @return ServerResponse |
|
| 621 | 621 | */ |
| 622 | 622 | public static function kickChatMember(array $data) |
| 623 | 623 | { |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * |
| 634 | 634 | * @param array $data |
| 635 | 635 | * |
| 636 | - * @return mixed |
|
| 636 | + * @return ServerResponse |
|
| 637 | 637 | */ |
| 638 | 638 | public static function leaveChat(array $data) |
| 639 | 639 | { |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | * |
| 650 | 650 | * @param array $data |
| 651 | 651 | * |
| 652 | - * @return mixed |
|
| 652 | + * @return ServerResponse |
|
| 653 | 653 | */ |
| 654 | 654 | public static function unbanChatMember(array $data) |
| 655 | 655 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | * |
| 668 | 668 | * @param array $data |
| 669 | 669 | * |
| 670 | - * @return mixed |
|
| 670 | + * @return ServerResponse |
|
| 671 | 671 | */ |
| 672 | 672 | public static function getChat(array $data) |
| 673 | 673 | { |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @param array $data |
| 687 | 687 | * |
| 688 | - * @return mixed |
|
| 688 | + * @return ServerResponse |
|
| 689 | 689 | */ |
| 690 | 690 | public static function getChatAdministrators(array $data) |
| 691 | 691 | { |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | * |
| 704 | 704 | * @param array $data |
| 705 | 705 | * |
| 706 | - * @return mixed |
|
| 706 | + * @return ServerResponse |
|
| 707 | 707 | */ |
| 708 | 708 | public static function getChatMembersCount(array $data) |
| 709 | 709 | { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | * |
| 722 | 722 | * @param array $data |
| 723 | 723 | * |
| 724 | - * @return mixed |
|
| 724 | + * @return ServerResponse |
|
| 725 | 725 | */ |
| 726 | 726 | public static function getChatMember(array $data) |
| 727 | 727 | { |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | * |
| 738 | 738 | * @param array $data |
| 739 | 739 | * |
| 740 | - * @return mixed |
|
| 740 | + * @return ServerResponse |
|
| 741 | 741 | */ |
| 742 | 742 | public static function answerCallbackQuery(array $data) |
| 743 | 743 | { |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @param array $data |
| 755 | 755 | * |
| 756 | - * @return mixed |
|
| 756 | + * @return ServerResponse |
|
| 757 | 757 | */ |
| 758 | 758 | public static function answerInlineQuery(array $data) |
| 759 | 759 | { |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | * |
| 770 | 770 | * @param array $data |
| 771 | 771 | * |
| 772 | - * @return mixed |
|
| 772 | + * @return ServerResponse |
|
| 773 | 773 | */ |
| 774 | 774 | public static function editMessageText(array $data) |
| 775 | 775 | { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | * |
| 786 | 786 | * @param array $data |
| 787 | 787 | * |
| 788 | - * @return mixed |
|
| 788 | + * @return ServerResponse |
|
| 789 | 789 | */ |
| 790 | 790 | public static function editMessageCaption(array $data) |
| 791 | 791 | { |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | * |
| 802 | 802 | * @param array $data |
| 803 | 803 | * |
| 804 | - * @return mixed |
|
| 804 | + * @return ServerResponse |
|
| 805 | 805 | */ |
| 806 | 806 | public static function editMessageReplyMarkup(array $data) |
| 807 | 807 | { |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | |
| 174 | 174 | //Fix so that the keyboard markup is a string, not an object |
| 175 | 175 | if (isset($data['reply_markup']) && !is_string($data['reply_markup'])) { |
| 176 | - $data['reply_markup'] = (string)$data['reply_markup']; |
|
| 176 | + $data['reply_markup'] = (string) $data['reply_markup']; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $request_params = ['debug' => $debug_handle]; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require __DIR__ . '/../vendor/autoload.php'; |
| 3 | 3 | |
| 4 | -$filename='logfile.log'; |
|
| 4 | +$filename = 'logfile.log'; |
|
| 5 | 5 | $API_KEY = 'random'; |
| 6 | 6 | $BOT_NAME = 'bot_name'; |
| 7 | 7 | |