@@ -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\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 | /** |
@@ -224,7 +224,7 @@ |
||
224 | 224 | 'selective' => true, |
225 | 225 | ] |
226 | 226 | ); |
227 | - $result = Request::sendMessage($data); |
|
227 | + $result = Request::sendMessage($data); |
|
228 | 228 | break; |
229 | 229 | } |
230 | 230 | $this->conversation->notes['phone_number'] = $message->getContact()->getPhoneNumber(); |
@@ -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 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new TelegramException($e->getMessage()); |
73 | 73 | } |
74 | 74 | |
75 | - return (string)$response->getBody(); |
|
75 | + return (string) $response->getBody(); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | //http://openweathermap.org/weather-conditions |
93 | - $conditions = [ |
|
93 | + $conditions = [ |
|
94 | 94 | 'clear' => ' ☀️', |
95 | 95 | 'clouds' => ' ☁️', |
96 | 96 | 'rain' => ' ☔', |
@@ -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 | /** |
@@ -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 | { |
@@ -153,7 +153,7 @@ |
||
153 | 153 | 'first_name' => 'botname', |
154 | 154 | 'username' => 'namebot', |
155 | 155 | ]; |
156 | - $data['chat'] = ['id' => $data['chat_id']]; |
|
156 | + $data['chat'] = ['id' => $data['chat_id']]; |
|
157 | 157 | |
158 | 158 | $fake_response['result'] = $data; |
159 | 159 | } |
@@ -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 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $command = trim($message->getText(true)); |
40 | 40 | |
41 | 41 | //Only get enabled Admin and User commands |
42 | - $commands = array_filter($this->telegram->getCommandsList(), function ($command) { |
|
42 | + $commands = array_filter($this->telegram->getCommandsList(), function($command) { |
|
43 | 43 | return (!$command->isSystemCommand() && $command->isEnabled()); |
44 | 44 | }); |
45 | 45 |
@@ -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)) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | /** |
476 | 476 | * Get date |
477 | 477 | * |
478 | - * @return mixed |
|
478 | + * @return integer|null |
|
479 | 479 | */ |
480 | 480 | public function getDate() |
481 | 481 | { |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | /** |
516 | 516 | * Get forward date |
517 | 517 | * |
518 | - * @return mixed |
|
518 | + * @return integer|null |
|
519 | 519 | */ |
520 | 520 | public function getForwardDate() |
521 | 521 | { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | /** |
526 | 526 | * Get edit date |
527 | 527 | * |
528 | - * @return mixed |
|
528 | + * @return integer|null |
|
529 | 529 | */ |
530 | 530 | public function getEditDate() |
531 | 531 | { |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | /** |
667 | 667 | * Get new chat participant |
668 | 668 | * |
669 | - * @return mixed |
|
669 | + * @return User|null |
|
670 | 670 | */ |
671 | 671 | public function getNewChatParticipant() |
672 | 672 | { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | /** |
677 | 677 | * Get left chat participant |
678 | 678 | * |
679 | - * @return mixed |
|
679 | + * @return User|null |
|
680 | 680 | */ |
681 | 681 | public function getLeftChatParticipant() |
682 | 682 | { |
@@ -47,8 +47,8 @@ |
||
47 | 47 | //return random picture from the telegram->getUploadPath(); |
48 | 48 | |
49 | 49 | private function ShowRandomImage($dir) { |
50 | - $image_list = scandir($dir); |
|
51 | - return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
52 | - } |
|
50 | + $image_list = scandir($dir); |
|
51 | + return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |