Complex classes like Request often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Request, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
19 | class Request |
||
20 | { |
||
21 | /** |
||
22 | * Telegram object |
||
23 | * |
||
24 | * @var \Longman\TelegramBot\Telegram |
||
25 | */ |
||
26 | private static $telegram; |
||
27 | |||
28 | /** |
||
29 | * URI of the Telegram API |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private static $api_base_uri = 'https://api.telegram.org'; |
||
34 | |||
35 | /** |
||
36 | * Guzzle Client object |
||
37 | * |
||
38 | * @var \GuzzleHttp\Client |
||
39 | */ |
||
40 | private static $client; |
||
41 | |||
42 | /** |
||
43 | * Input value of the request |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private static $input; |
||
48 | |||
49 | /** |
||
50 | * Available actions to send |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private static $actions = [ |
||
55 | 'getUpdates', |
||
56 | 'setWebhook', |
||
57 | 'deleteWebhook', |
||
58 | 'getMe', |
||
59 | 'sendMessage', |
||
60 | 'forwardMessage', |
||
61 | 'sendPhoto', |
||
62 | 'sendAudio', |
||
63 | 'sendDocument', |
||
64 | 'sendSticker', |
||
65 | 'sendVideo', |
||
66 | 'sendVoice', |
||
67 | 'sendLocation', |
||
68 | 'sendVenue', |
||
69 | 'sendContact', |
||
70 | 'sendChatAction', |
||
71 | 'getUserProfilePhotos', |
||
72 | 'getFile', |
||
73 | 'kickChatMember', |
||
74 | 'leaveChat', |
||
75 | 'unbanChatMember', |
||
76 | 'getChat', |
||
77 | 'getChatAdministrators', |
||
78 | 'getChatMember', |
||
79 | 'getChatMembersCount', |
||
80 | 'answerCallbackQuery', |
||
81 | 'answerInlineQuery', |
||
82 | 'editMessageText', |
||
83 | 'editMessageCaption', |
||
84 | 'editMessageReplyMarkup', |
||
85 | 'getWebhookInfo', |
||
86 | ]; |
||
87 | |||
88 | /** |
||
89 | * Initialize |
||
90 | * |
||
91 | * @param \Longman\TelegramBot\Telegram $telegram |
||
92 | * |
||
93 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
94 | */ |
||
95 | 39 | public static function initialize(Telegram $telegram) |
|
104 | |||
105 | /** |
||
106 | * Set input from custom input or stdin and return it |
||
107 | * |
||
108 | * @return string |
||
109 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
110 | */ |
||
111 | public static function getInput() |
||
129 | |||
130 | /** |
||
131 | * Generate general fake server response |
||
132 | * |
||
133 | * @param array $data Data to add to fake response |
||
134 | * |
||
135 | * @return array Fake response data |
||
136 | */ |
||
137 | 6 | public static function generateGeneralFakeServerResponse(array $data = []) |
|
167 | |||
168 | /** |
||
169 | * Properly set up the request params |
||
170 | * |
||
171 | * If any item of the array is a resource, reformat it to a multipart request. |
||
172 | * Else, just return the passed data as form params. |
||
173 | * |
||
174 | * @param array $data |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | private static function setUpRequestParams(array $data) |
||
199 | |||
200 | /** |
||
201 | * Execute HTTP Request |
||
202 | * |
||
203 | * @param string $action Action to execute |
||
204 | * @param array $data Data to attach to the execution |
||
205 | * |
||
206 | * @return string Result of the HTTP Request |
||
207 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
208 | */ |
||
209 | public static function execute($action, array $data = []) |
||
240 | |||
241 | /** |
||
242 | * Download file |
||
243 | * |
||
244 | * @param \Longman\TelegramBot\Entities\File $file |
||
245 | * |
||
246 | * @return boolean |
||
247 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
248 | */ |
||
249 | public static function downloadFile(File $file) |
||
277 | |||
278 | /** |
||
279 | * Encode file |
||
280 | * |
||
281 | * @param string $file |
||
282 | * |
||
283 | * @return resource |
||
284 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
285 | */ |
||
286 | protected static function encodeFile($file) |
||
295 | |||
296 | /** |
||
297 | * Send command |
||
298 | * |
||
299 | * @todo Fake response doesn't need json encoding? |
||
300 | * |
||
301 | * @param string $action |
||
302 | * @param array $data |
||
303 | * |
||
304 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
305 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
306 | */ |
||
307 | 5 | public static function send($action, array $data = []) |
|
329 | |||
330 | /** |
||
331 | * Make sure the data isn't empty, else throw an exception |
||
332 | * |
||
333 | * @param array $data |
||
334 | * |
||
335 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
336 | */ |
||
337 | private static function ensureNonEmptyData(array $data) |
||
343 | |||
344 | /** |
||
345 | * Make sure the action is valid, else throw an exception |
||
346 | * |
||
347 | * @param string $action |
||
348 | * |
||
349 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
350 | */ |
||
351 | 5 | private static function ensureValidAction($action) |
|
357 | |||
358 | /** |
||
359 | * Assign an encoded file to a data array |
||
360 | * |
||
361 | * @param array $data |
||
362 | * @param string $field |
||
363 | * @param string $file |
||
364 | * |
||
365 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
366 | */ |
||
367 | private static function assignEncodedFile(&$data, $field, $file) |
||
373 | |||
374 | /** |
||
375 | * Returns basic information about the bot in form of a User object |
||
376 | * |
||
377 | * @link https://core.telegram.org/bots/api#getme |
||
378 | * |
||
379 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
380 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
381 | */ |
||
382 | public static function getMe() |
||
388 | |||
389 | /** |
||
390 | * Use this method to send text messages. On success, the sent Message is returned |
||
391 | * |
||
392 | * @link https://core.telegram.org/bots/api#sendmessage |
||
393 | * |
||
394 | * @param array $data |
||
395 | * |
||
396 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
397 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
398 | */ |
||
399 | 5 | public static function sendMessage(array $data) |
|
414 | |||
415 | /** |
||
416 | * Use this method to forward messages of any kind. On success, the sent Message is returned |
||
417 | * |
||
418 | * @link https://core.telegram.org/bots/api#forwardmessage |
||
419 | * |
||
420 | * @param array $data |
||
421 | * |
||
422 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
423 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
424 | */ |
||
425 | public static function forwardMessage(array $data) |
||
429 | |||
430 | /** |
||
431 | * Use this method to send photos. On success, the sent Message is returned |
||
432 | * |
||
433 | * @link https://core.telegram.org/bots/api#sendphoto |
||
434 | * |
||
435 | * @param array $data |
||
436 | * @param string $file |
||
437 | * |
||
438 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
439 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
440 | */ |
||
441 | public static function sendPhoto(array $data, $file = null) |
||
447 | |||
448 | /** |
||
449 | * Use this method to send audio files |
||
450 | * |
||
451 | * Your audio must be in the .mp3 format. On success, the sent Message is returned. |
||
452 | * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. |
||
453 | * For sending voice messages, use the sendVoice method instead. |
||
454 | * |
||
455 | * @link https://core.telegram.org/bots/api#sendaudio |
||
456 | * |
||
457 | * @param array $data |
||
458 | * @param string $file |
||
459 | * |
||
460 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
461 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
462 | */ |
||
463 | public static function sendAudio(array $data, $file = null) |
||
469 | |||
470 | /** |
||
471 | * Use this method to send general files. On success, the sent Message is returned. |
||
472 | * |
||
473 | * Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. |
||
474 | * |
||
475 | * @link https://core.telegram.org/bots/api#senddocument |
||
476 | * |
||
477 | * @param array $data |
||
478 | * @param string $file |
||
479 | * |
||
480 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
481 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
482 | */ |
||
483 | public static function sendDocument(array $data, $file = null) |
||
489 | |||
490 | /** |
||
491 | * Use this method to send .webp stickers. On success, the sent Message is returned. |
||
492 | * |
||
493 | * @link https://core.telegram.org/bots/api#sendsticker |
||
494 | * |
||
495 | * @param array $data |
||
496 | * @param string $file |
||
497 | * |
||
498 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
499 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
500 | */ |
||
501 | public static function sendSticker(array $data, $file = null) |
||
507 | |||
508 | /** |
||
509 | * Use this method to send video files. On success, the sent Message is returned. |
||
510 | * |
||
511 | * Telegram clients support mp4 videos (other formats may be sent as Document). |
||
512 | * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. |
||
513 | * |
||
514 | * @link https://core.telegram.org/bots/api#sendvideo |
||
515 | * |
||
516 | * @param array $data |
||
517 | * @param string $file |
||
518 | * |
||
519 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
520 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
521 | */ |
||
522 | public static function sendVideo(array $data, $file = null) |
||
528 | |||
529 | /** |
||
530 | * Use this method to send audio files. On success, the sent Message is returned. |
||
531 | * |
||
532 | * Telegram clients will display the file as a playable voice message. |
||
533 | * For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). |
||
534 | * Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. |
||
535 | * |
||
536 | * @link https://core.telegram.org/bots/api#sendvoice |
||
537 | * |
||
538 | * @param array $data |
||
539 | * @param string $file |
||
540 | * |
||
541 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
542 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
543 | */ |
||
544 | public static function sendVoice(array $data, $file = null) |
||
550 | |||
551 | /** |
||
552 | * Use this method to send point on the map. On success, the sent Message is returned. |
||
553 | * |
||
554 | * @link https://core.telegram.org/bots/api#sendlocation |
||
555 | * |
||
556 | * @param array $data |
||
557 | * |
||
558 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
559 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
560 | */ |
||
561 | public static function sendLocation(array $data) |
||
565 | |||
566 | /** |
||
567 | * Use this method to send information about a venue. On success, the sent Message is returned. |
||
568 | * |
||
569 | * @link https://core.telegram.org/bots/api#sendvenue |
||
570 | * |
||
571 | * @param array $data |
||
572 | * |
||
573 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
574 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
575 | */ |
||
576 | public static function sendVenue(array $data) |
||
580 | |||
581 | /** |
||
582 | * Use this method to send phone contacts. On success, the sent Message is returned. |
||
583 | * |
||
584 | * @link https://core.telegram.org/bots/api#sendcontact |
||
585 | * |
||
586 | * @param array $data |
||
587 | * |
||
588 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
589 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
590 | */ |
||
591 | public static function sendContact(array $data) |
||
595 | |||
596 | /** |
||
597 | * Use this method when you need to tell the user that something is happening on the bot's side. |
||
598 | * |
||
599 | * The status is set for 5 seconds or less. |
||
600 | * (when a message arrives from your bot, Telegram clients clear its typing status) |
||
601 | * |
||
602 | * @link https://core.telegram.org/bots/api#sendchataction |
||
603 | * |
||
604 | * @param array $data |
||
605 | * |
||
606 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
607 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
608 | */ |
||
609 | public static function sendChatAction(array $data) |
||
613 | |||
614 | /** |
||
615 | * Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. |
||
616 | * |
||
617 | * @param array $data |
||
618 | * |
||
619 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
620 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
621 | */ |
||
622 | public static function getUserProfilePhotos(array $data) |
||
626 | |||
627 | /** |
||
628 | * Use this method to get basic info about a file and prepare it for downloading. On success, a File object is returned. |
||
629 | * |
||
630 | * For the moment, bots can download files of up to 20MB in size. |
||
631 | * The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, |
||
632 | * where <file_path> is taken from the response. |
||
633 | * It is guaranteed that the link will be valid for at least 1 hour. |
||
634 | * When the link expires, a new one can be requested by calling getFile again. |
||
635 | * |
||
636 | * @link https://core.telegram.org/bots/api#getfile |
||
637 | * |
||
638 | * @param array $data |
||
639 | * |
||
640 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
641 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
642 | */ |
||
643 | public static function getFile(array $data) |
||
647 | |||
648 | /** |
||
649 | * Use this method to kick a user from a group or a supergroup. Returns True on success. |
||
650 | * |
||
651 | * In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. |
||
652 | * The bot must be an administrator in the group for this to work. |
||
653 | * |
||
654 | * @link https://core.telegram.org/bots/api#kickchatmember |
||
655 | * |
||
656 | * @param array $data |
||
657 | * |
||
658 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
659 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
660 | */ |
||
661 | public static function kickChatMember(array $data) |
||
665 | |||
666 | /** |
||
667 | * Use this method for your bot to leave a group, supergroup or channel. Returns True on success. |
||
668 | * |
||
669 | * @link https://core.telegram.org/bots/api#leavechat |
||
670 | * |
||
671 | * @param array $data |
||
672 | * |
||
673 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
674 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
675 | */ |
||
676 | public static function leaveChat(array $data) |
||
680 | |||
681 | /** |
||
682 | * Use this method to unban a previously kicked user in a supergroup. Returns True on success. |
||
683 | * |
||
684 | * The user will not return to the group automatically, but will be able to join via link, etc. |
||
685 | * The bot must be an administrator in the group for this to work. |
||
686 | * |
||
687 | * @link https://core.telegram.org/bots/api#unbanchatmember |
||
688 | * |
||
689 | * @param array $data |
||
690 | * |
||
691 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
692 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
693 | */ |
||
694 | public static function unbanChatMember(array $data) |
||
698 | |||
699 | /** |
||
700 | * Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. |
||
701 | * |
||
702 | * @todo add get response in ServerResponse.php? |
||
703 | * |
||
704 | * @link https://core.telegram.org/bots/api#getchat |
||
705 | * |
||
706 | * @param array $data |
||
707 | * |
||
708 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
709 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
710 | */ |
||
711 | public static function getChat(array $data) |
||
715 | |||
716 | /** |
||
717 | * Use this method to get a list of administrators in a chat. |
||
718 | * |
||
719 | * On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. |
||
720 | * If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. |
||
721 | * |
||
722 | * @todo add get response in ServerResponse.php? |
||
723 | * |
||
724 | * @link https://core.telegram.org/bots/api#getchatadministrators |
||
725 | * |
||
726 | * @param array $data |
||
727 | * |
||
728 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
729 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
730 | */ |
||
731 | public static function getChatAdministrators(array $data) |
||
735 | |||
736 | /** |
||
737 | * Use this method to get the number of members in a chat. Returns Int on success. |
||
738 | * |
||
739 | * @todo add get response in ServerResponse.php? |
||
740 | * |
||
741 | * @link https://core.telegram.org/bots/api#getchatmemberscount |
||
742 | * |
||
743 | * @param array $data |
||
744 | * |
||
745 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
746 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
747 | */ |
||
748 | public static function getChatMembersCount(array $data) |
||
752 | |||
753 | /** |
||
754 | * Use this method to get information about a member of a chat. Returns a ChatMember object on success. |
||
755 | * |
||
756 | * @todo add get response in ServerResponse.php? |
||
757 | * |
||
758 | * @link https://core.telegram.org/bots/api#getchatmember |
||
759 | * |
||
760 | * @param array $data |
||
761 | * |
||
762 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
763 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
764 | */ |
||
765 | public static function getChatMember(array $data) |
||
769 | |||
770 | /** |
||
771 | * Use this method to send answers to callback queries sent from inline keyboards. On success, True is returned. |
||
772 | * |
||
773 | * The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. |
||
774 | * |
||
775 | * @link https://core.telegram.org/bots/api#answercallbackquery |
||
776 | * |
||
777 | * @param array $data |
||
778 | * |
||
779 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
780 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
781 | */ |
||
782 | public static function answerCallbackQuery(array $data) |
||
786 | |||
787 | /** |
||
788 | * Get updates |
||
789 | * |
||
790 | * @link https://core.telegram.org/bots/api#getupdates |
||
791 | * |
||
792 | * @param array $data |
||
793 | * |
||
794 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
795 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
796 | */ |
||
797 | public static function getUpdates(array $data) |
||
801 | |||
802 | /** |
||
803 | * Set webhook |
||
804 | * |
||
805 | * @link https://core.telegram.org/bots/api#setwebhook |
||
806 | * |
||
807 | * @param string $url |
||
808 | * @param array $data Optional parameters. |
||
809 | * |
||
810 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
811 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
812 | */ |
||
813 | public static function setWebhook($url = '', array $data = []) |
||
828 | |||
829 | /** |
||
830 | * Delete webhook |
||
831 | * |
||
832 | * @link https://core.telegram.org/bots/api#deletewebhook |
||
833 | * |
||
834 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
835 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
836 | */ |
||
837 | public static function deleteWebhook() |
||
842 | |||
843 | /** |
||
844 | * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). |
||
845 | * |
||
846 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
847 | * |
||
848 | * @link https://core.telegram.org/bots/api#editmessagetext |
||
849 | * |
||
850 | * @param array $data |
||
851 | * |
||
852 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
853 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
854 | */ |
||
855 | public static function editMessageText(array $data) |
||
859 | |||
860 | /** |
||
861 | * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). |
||
862 | * |
||
863 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
864 | * |
||
865 | * @link https://core.telegram.org/bots/api#editmessagecaption |
||
866 | * |
||
867 | * @param array $data |
||
868 | * |
||
869 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
870 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
871 | */ |
||
872 | public static function editMessageCaption(array $data) |
||
876 | |||
877 | /** |
||
878 | * Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). |
||
879 | * |
||
880 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
881 | * |
||
882 | * @link https://core.telegram.org/bots/api#editmessagereplymarkup |
||
883 | * |
||
884 | * @param array $data |
||
885 | * |
||
886 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
887 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
888 | */ |
||
889 | public static function editMessageReplyMarkup(array $data) |
||
893 | |||
894 | /** |
||
895 | * Use this method to send answers to an inline query. On success, True is returned. |
||
896 | * |
||
897 | * No more than 50 results per query are allowed. |
||
898 | * |
||
899 | * @link https://core.telegram.org/bots/api#answerinlinequery |
||
900 | * |
||
901 | * @param array $data |
||
902 | * |
||
903 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
904 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
905 | */ |
||
906 | public static function answerInlineQuery(array $data) |
||
910 | |||
911 | /** |
||
912 | * Return an empty Server Response |
||
913 | * |
||
914 | * No request to telegram are sent, this function is used in commands that |
||
915 | * don't need to fire a message after execution |
||
916 | * |
||
917 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
918 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
919 | */ |
||
920 | public static function emptyResponse() |
||
924 | |||
925 | /** |
||
926 | * Send message to all active chats |
||
927 | * |
||
928 | * @param string $callback_function |
||
929 | * @param array $data |
||
930 | * @param boolean $send_groups |
||
931 | * @param boolean $send_super_groups |
||
932 | * @param boolean $send_users |
||
933 | * @param string $date_from |
||
934 | * @param string $date_to |
||
935 | * |
||
936 | * @return array |
||
937 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
938 | */ |
||
939 | public static function sendToActiveChats( |
||
965 | |||
966 | /** |
||
967 | * Use this method to get current webhook status. |
||
968 | * |
||
969 | * @link https://core.telegram.org/bots/api#getwebhookinfo |
||
970 | * |
||
971 | * @return Entities\ServerResponse |
||
972 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
973 | */ |
||
974 | public static function getWebhookInfo() |
||
979 | } |
||
980 |