| @@ 321-339 (lines=19) @@ | ||
| 318 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 319 | * @throws \TelegramBot\Api\Exception |
|
| 320 | */ |
|
| 321 | public function sendMessage( |
|
| 322 | $chatId, |
|
| 323 | $text, |
|
| 324 | $parseMode = null, |
|
| 325 | $disablePreview = false, |
|
| 326 | $replyToMessageId = null, |
|
| 327 | $replyMarkup = null, |
|
| 328 | $disableNotification = false |
|
| 329 | ) { |
|
| 330 | return Message::fromResponse($this->call('sendMessage', [ |
|
| 331 | 'chat_id' => $chatId, |
|
| 332 | 'text' => $text, |
|
| 333 | 'parse_mode' => $parseMode, |
|
| 334 | 'disable_web_page_preview' => $disablePreview, |
|
| 335 | 'reply_to_message_id' => (int)$replyToMessageId, |
|
| 336 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 337 | 'disable_notification' => (bool)$disableNotification, |
|
| 338 | ])); |
|
| 339 | } |
|
| 340 | ||
| 341 | /** |
|
| 342 | * Use this method to send phone contacts |
|
| @@ 356-374 (lines=19) @@ | ||
| 353 | * @return \TelegramBot\Api\Types\Message |
|
| 354 | * @throws \TelegramBot\Api\Exception |
|
| 355 | */ |
|
| 356 | public function sendContact( |
|
| 357 | $chatId, |
|
| 358 | $phoneNumber, |
|
| 359 | $firstName, |
|
| 360 | $lastName = null, |
|
| 361 | $replyToMessageId = null, |
|
| 362 | $replyMarkup = null, |
|
| 363 | $disableNotification = false |
|
| 364 | ) { |
|
| 365 | return Message::fromResponse($this->call('sendContact', [ |
|
| 366 | 'chat_id' => $chatId, |
|
| 367 | 'phone_number' => $phoneNumber, |
|
| 368 | 'first_name' => $firstName, |
|
| 369 | 'last_name' => $lastName, |
|
| 370 | 'reply_to_message_id' => $replyToMessageId, |
|
| 371 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 372 | 'disable_notification' => (bool)$disableNotification, |
|
| 373 | ])); |
|
| 374 | } |
|
| 375 | ||
| 376 | /** |
|
| 377 | * Use this method when you need to tell the user that something is happening on the bot's side. |
|
| @@ 512-530 (lines=19) @@ | ||
| 509 | * @param null|int $livePeriod |
|
| 510 | * @return \TelegramBot\Api\Types\Message |
|
| 511 | */ |
|
| 512 | public function sendLocation( |
|
| 513 | $chatId, |
|
| 514 | $latitude, |
|
| 515 | $longitude, |
|
| 516 | $replyToMessageId = null, |
|
| 517 | $replyMarkup = null, |
|
| 518 | $disableNotification = false, |
|
| 519 | $livePeriod = null |
|
| 520 | ) { |
|
| 521 | return Message::fromResponse($this->call('sendLocation', [ |
|
| 522 | 'chat_id' => $chatId, |
|
| 523 | 'latitude' => $latitude, |
|
| 524 | 'longitude' => $longitude, |
|
| 525 | 'live_period' => $livePeriod, |
|
| 526 | 'reply_to_message_id' => $replyToMessageId, |
|
| 527 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 528 | 'disable_notification' => (bool)$disableNotification, |
|
| 529 | ])); |
|
| 530 | } |
|
| 531 | ||
| 532 | /** |
|
| 533 | * Use this method to edit live location messages sent by the bot or via the bot (for inline bots). |
|
| @@ 723-741 (lines=19) @@ | ||
| 720 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 721 | * @throws \TelegramBot\Api\Exception |
|
| 722 | */ |
|
| 723 | public function sendVoice( |
|
| 724 | $chatId, |
|
| 725 | $voice, |
|
| 726 | $duration = null, |
|
| 727 | $replyToMessageId = null, |
|
| 728 | $replyMarkup = null, |
|
| 729 | $disableNotification = false, |
|
| 730 | $parseMode = null |
|
| 731 | ) { |
|
| 732 | return Message::fromResponse($this->call('sendVoice', [ |
|
| 733 | 'chat_id' => $chatId, |
|
| 734 | 'voice' => $voice, |
|
| 735 | 'duration' => $duration, |
|
| 736 | 'reply_to_message_id' => $replyToMessageId, |
|
| 737 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 738 | 'disable_notification' => (bool)$disableNotification, |
|
| 739 | 'parse_mode' => $parseMode |
|
| 740 | ])); |
|
| 741 | } |
|
| 742 | ||
| 743 | /** |
|
| 744 | * Use this method to forward messages of any kind. On success, the sent Message is returned. |
|
| @@ 836-854 (lines=19) @@ | ||
| 833 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 834 | * @throws \TelegramBot\Api\Exception |
|
| 835 | */ |
|
| 836 | public function sendPhoto( |
|
| 837 | $chatId, |
|
| 838 | $photo, |
|
| 839 | $caption = null, |
|
| 840 | $replyToMessageId = null, |
|
| 841 | $replyMarkup = null, |
|
| 842 | $disableNotification = false, |
|
| 843 | $parseMode = null |
|
| 844 | ) { |
|
| 845 | return Message::fromResponse($this->call('sendPhoto', [ |
|
| 846 | 'chat_id' => $chatId, |
|
| 847 | 'photo' => $photo, |
|
| 848 | 'caption' => $caption, |
|
| 849 | 'reply_to_message_id' => $replyToMessageId, |
|
| 850 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 851 | 'disable_notification' => (bool)$disableNotification, |
|
| 852 | 'parse_mode' => $parseMode |
|
| 853 | ])); |
|
| 854 | } |
|
| 855 | ||
| 856 | /** |
|
| 857 | * Use this method to send general files. On success, the sent Message is returned. |
|
| @@ 873-891 (lines=19) @@ | ||
| 870 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 871 | * @throws \TelegramBot\Api\Exception |
|
| 872 | */ |
|
| 873 | public function sendDocument( |
|
| 874 | $chatId, |
|
| 875 | $document, |
|
| 876 | $caption = null, |
|
| 877 | $replyToMessageId = null, |
|
| 878 | $replyMarkup = null, |
|
| 879 | $disableNotification = false, |
|
| 880 | $parseMode = null |
|
| 881 | ) { |
|
| 882 | return Message::fromResponse($this->call('sendDocument', [ |
|
| 883 | 'chat_id' => $chatId, |
|
| 884 | 'document' => $document, |
|
| 885 | 'caption' => $caption, |
|
| 886 | 'reply_to_message_id' => $replyToMessageId, |
|
| 887 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 888 | 'disable_notification' => (bool)$disableNotification, |
|
| 889 | 'parse_mode' => $parseMode |
|
| 890 | ])); |
|
| 891 | } |
|
| 892 | ||
| 893 | /** |
|
| 894 | * Use this method to get basic info about a file and prepare it for downloading. |
|
| @@ 1051-1069 (lines=19) @@ | ||
| 1048 | * Types\ReplyKeyboardRemove|null $replyMarkup |
|
| 1049 | * @return Message |
|
| 1050 | */ |
|
| 1051 | public function editMessageText( |
|
| 1052 | $chatId, |
|
| 1053 | $messageId, |
|
| 1054 | $text, |
|
| 1055 | $parseMode = null, |
|
| 1056 | $disablePreview = false, |
|
| 1057 | $replyMarkup = null, |
|
| 1058 | $inlineMessageId = null |
|
| 1059 | ) { |
|
| 1060 | return Message::fromResponse($this->call('editMessageText', [ |
|
| 1061 | 'chat_id' => $chatId, |
|
| 1062 | 'message_id' => $messageId, |
|
| 1063 | 'text' => $text, |
|
| 1064 | 'inline_message_id' => $inlineMessageId, |
|
| 1065 | 'parse_mode' => $parseMode, |
|
| 1066 | 'disable_web_page_preview' => $disablePreview, |
|
| 1067 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1068 | ])); |
|
| 1069 | } |
|
| 1070 | ||
| 1071 | /** |
|
| 1072 | * Use this method to edit text messages sent by the bot or via the bot |
|
| @@ 1642-1660 (lines=19) @@ | ||
| 1639 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 1640 | * @throws \TelegramBot\Api\Exception |
|
| 1641 | */ |
|
| 1642 | public function sendVideoNote( |
|
| 1643 | $chatId, |
|
| 1644 | $videoNote, |
|
| 1645 | $duration = null, |
|
| 1646 | $length = null, |
|
| 1647 | $replyToMessageId = null, |
|
| 1648 | $replyMarkup = null, |
|
| 1649 | $disableNotification = false |
|
| 1650 | ) { |
|
| 1651 | return Message::fromResponse($this->call('sendVideoNote', [ |
|
| 1652 | 'chat_id' => $chatId, |
|
| 1653 | 'video_note' => $videoNote, |
|
| 1654 | 'duration' => $duration, |
|
| 1655 | 'length' => $length, |
|
| 1656 | 'reply_to_message_id' => $replyToMessageId, |
|
| 1657 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1658 | 'disable_notification' => (bool)$disableNotification |
|
| 1659 | ])); |
|
| 1660 | } |
|
| 1661 | ||
| 1662 | /** |
|
| 1663 | * Use this method to send a group of photos or videos as an album. |
|