| @@ 322-340 (lines=19) @@ | ||
| 319 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 320 | * @throws \TelegramBot\Api\Exception |
|
| 321 | */ |
|
| 322 | public function sendMessage( |
|
| 323 | $chatId, |
|
| 324 | $text, |
|
| 325 | $parseMode = null, |
|
| 326 | $disablePreview = false, |
|
| 327 | $replyToMessageId = null, |
|
| 328 | $replyMarkup = null, |
|
| 329 | $disableNotification = false |
|
| 330 | ) { |
|
| 331 | return Message::fromResponse($this->call('sendMessage', [ |
|
| 332 | 'chat_id' => $chatId, |
|
| 333 | 'text' => $text, |
|
| 334 | 'parse_mode' => $parseMode, |
|
| 335 | 'disable_web_page_preview' => $disablePreview, |
|
| 336 | 'reply_to_message_id' => (int)$replyToMessageId, |
|
| 337 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 338 | 'disable_notification' => (bool)$disableNotification, |
|
| 339 | ])); |
|
| 340 | } |
|
| 341 | ||
| 342 | /** |
|
| 343 | * Use this method to send phone contacts |
|
| @@ 357-375 (lines=19) @@ | ||
| 354 | * @return \TelegramBot\Api\Types\Message |
|
| 355 | * @throws \TelegramBot\Api\Exception |
|
| 356 | */ |
|
| 357 | public function sendContact( |
|
| 358 | $chatId, |
|
| 359 | $phoneNumber, |
|
| 360 | $firstName, |
|
| 361 | $lastName = null, |
|
| 362 | $replyToMessageId = null, |
|
| 363 | $replyMarkup = null, |
|
| 364 | $disableNotification = false |
|
| 365 | ) { |
|
| 366 | return Message::fromResponse($this->call('sendContact', [ |
|
| 367 | 'chat_id' => $chatId, |
|
| 368 | 'phone_number' => $phoneNumber, |
|
| 369 | 'first_name' => $firstName, |
|
| 370 | 'last_name' => $lastName, |
|
| 371 | 'reply_to_message_id' => $replyToMessageId, |
|
| 372 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 373 | 'disable_notification' => (bool)$disableNotification, |
|
| 374 | ])); |
|
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * Use this method when you need to tell the user that something is happening on the bot's side. |
|
| @@ 501-519 (lines=19) @@ | ||
| 498 | * @param null|int $livePeriod |
|
| 499 | * @return \TelegramBot\Api\Types\Message |
|
| 500 | */ |
|
| 501 | public function sendLocation( |
|
| 502 | $chatId, |
|
| 503 | $latitude, |
|
| 504 | $longitude, |
|
| 505 | $replyToMessageId = null, |
|
| 506 | $replyMarkup = null, |
|
| 507 | $disableNotification = false, |
|
| 508 | $livePeriod = null |
|
| 509 | ) { |
|
| 510 | return Message::fromResponse($this->call('sendLocation', [ |
|
| 511 | 'chat_id' => $chatId, |
|
| 512 | 'latitude' => $latitude, |
|
| 513 | 'longitude' => $longitude, |
|
| 514 | 'live_period' => $livePeriod, |
|
| 515 | 'reply_to_message_id' => $replyToMessageId, |
|
| 516 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 517 | 'disable_notification' => (bool)$disableNotification, |
|
| 518 | ])); |
|
| 519 | } |
|
| 520 | ||
| 521 | /** |
|
| 522 | * Use this method to edit live location messages sent by the bot or via the bot (for inline bots). |
|
| @@ 710-730 (lines=21) @@ | ||
| 707 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 708 | * @throws \TelegramBot\Api\Exception |
|
| 709 | */ |
|
| 710 | public function sendAnimation( |
|
| 711 | $chatId, |
|
| 712 | $animation, |
|
| 713 | $duration = null, |
|
| 714 | $caption = null, |
|
| 715 | $replyToMessageId = null, |
|
| 716 | $replyMarkup = null, |
|
| 717 | $disableNotification = false, |
|
| 718 | $parseMode = null |
|
| 719 | ) { |
|
| 720 | return Message::fromResponse($this->call('sendAnimation', [ |
|
| 721 | 'chat_id' => $chatId, |
|
| 722 | 'animation' => $animation, |
|
| 723 | 'duration' => $duration, |
|
| 724 | 'caption' => $caption, |
|
| 725 | 'reply_to_message_id' => $replyToMessageId, |
|
| 726 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 727 | 'disable_notification' => (bool)$disableNotification, |
|
| 728 | 'parse_mode' => $parseMode |
|
| 729 | ])); |
|
| 730 | } |
|
| 731 | ||
| 732 | /** |
|
| 733 | * Use this method to send audio files, |
|
| @@ 753-771 (lines=19) @@ | ||
| 750 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 751 | * @throws \TelegramBot\Api\Exception |
|
| 752 | */ |
|
| 753 | public function sendVoice( |
|
| 754 | $chatId, |
|
| 755 | $voice, |
|
| 756 | $duration = null, |
|
| 757 | $replyToMessageId = null, |
|
| 758 | $replyMarkup = null, |
|
| 759 | $disableNotification = false, |
|
| 760 | $parseMode = null |
|
| 761 | ) { |
|
| 762 | return Message::fromResponse($this->call('sendVoice', [ |
|
| 763 | 'chat_id' => $chatId, |
|
| 764 | 'voice' => $voice, |
|
| 765 | 'duration' => $duration, |
|
| 766 | 'reply_to_message_id' => $replyToMessageId, |
|
| 767 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 768 | 'disable_notification' => (bool)$disableNotification, |
|
| 769 | 'parse_mode' => $parseMode |
|
| 770 | ])); |
|
| 771 | } |
|
| 772 | ||
| 773 | /** |
|
| 774 | * Use this method to forward messages of any kind. On success, the sent Message is returned. |
|
| @@ 866-884 (lines=19) @@ | ||
| 863 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 864 | * @throws \TelegramBot\Api\Exception |
|
| 865 | */ |
|
| 866 | public function sendPhoto( |
|
| 867 | $chatId, |
|
| 868 | $photo, |
|
| 869 | $caption = null, |
|
| 870 | $replyToMessageId = null, |
|
| 871 | $replyMarkup = null, |
|
| 872 | $disableNotification = false, |
|
| 873 | $parseMode = null |
|
| 874 | ) { |
|
| 875 | return Message::fromResponse($this->call('sendPhoto', [ |
|
| 876 | 'chat_id' => $chatId, |
|
| 877 | 'photo' => $photo, |
|
| 878 | 'caption' => $caption, |
|
| 879 | 'reply_to_message_id' => $replyToMessageId, |
|
| 880 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 881 | 'disable_notification' => (bool)$disableNotification, |
|
| 882 | 'parse_mode' => $parseMode |
|
| 883 | ])); |
|
| 884 | } |
|
| 885 | ||
| 886 | /** |
|
| 887 | * Use this method to send general files. On success, the sent Message is returned. |
|
| @@ 903-921 (lines=19) @@ | ||
| 900 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 901 | * @throws \TelegramBot\Api\Exception |
|
| 902 | */ |
|
| 903 | public function sendDocument( |
|
| 904 | $chatId, |
|
| 905 | $document, |
|
| 906 | $caption = null, |
|
| 907 | $replyToMessageId = null, |
|
| 908 | $replyMarkup = null, |
|
| 909 | $disableNotification = false, |
|
| 910 | $parseMode = null |
|
| 911 | ) { |
|
| 912 | return Message::fromResponse($this->call('sendDocument', [ |
|
| 913 | 'chat_id' => $chatId, |
|
| 914 | 'document' => $document, |
|
| 915 | 'caption' => $caption, |
|
| 916 | 'reply_to_message_id' => $replyToMessageId, |
|
| 917 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 918 | 'disable_notification' => (bool)$disableNotification, |
|
| 919 | 'parse_mode' => $parseMode |
|
| 920 | ])); |
|
| 921 | } |
|
| 922 | ||
| 923 | /** |
|
| 924 | * Use this method to get basic info about a file and prepare it for downloading. |
|
| @@ 1081-1099 (lines=19) @@ | ||
| 1078 | * Types\ReplyKeyboardRemove|null $replyMarkup |
|
| 1079 | * @return Message |
|
| 1080 | */ |
|
| 1081 | public function editMessageText( |
|
| 1082 | $chatId, |
|
| 1083 | $messageId, |
|
| 1084 | $text, |
|
| 1085 | $parseMode = null, |
|
| 1086 | $disablePreview = false, |
|
| 1087 | $replyMarkup = null, |
|
| 1088 | $inlineMessageId = null |
|
| 1089 | ) { |
|
| 1090 | return Message::fromResponse($this->call('editMessageText', [ |
|
| 1091 | 'chat_id' => $chatId, |
|
| 1092 | 'message_id' => $messageId, |
|
| 1093 | 'text' => $text, |
|
| 1094 | 'inline_message_id' => $inlineMessageId, |
|
| 1095 | 'parse_mode' => $parseMode, |
|
| 1096 | 'disable_web_page_preview' => $disablePreview, |
|
| 1097 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1098 | ])); |
|
| 1099 | } |
|
| 1100 | ||
| 1101 | /** |
|
| 1102 | * Use this method to edit text messages sent by the bot or via the bot |
|
| @@ 1672-1690 (lines=19) @@ | ||
| 1669 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 1670 | * @throws \TelegramBot\Api\Exception |
|
| 1671 | */ |
|
| 1672 | public function sendVideoNote( |
|
| 1673 | $chatId, |
|
| 1674 | $videoNote, |
|
| 1675 | $duration = null, |
|
| 1676 | $length = null, |
|
| 1677 | $replyToMessageId = null, |
|
| 1678 | $replyMarkup = null, |
|
| 1679 | $disableNotification = false |
|
| 1680 | ) { |
|
| 1681 | return Message::fromResponse($this->call('sendVideoNote', [ |
|
| 1682 | 'chat_id' => $chatId, |
|
| 1683 | 'video_note' => $videoNote, |
|
| 1684 | 'duration' => $duration, |
|
| 1685 | 'length' => $length, |
|
| 1686 | 'reply_to_message_id' => $replyToMessageId, |
|
| 1687 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1688 | 'disable_notification' => (bool)$disableNotification |
|
| 1689 | ])); |
|
| 1690 | } |
|
| 1691 | ||
| 1692 | /** |
|
| 1693 | * Use this method to send a group of photos or videos as an album. |
|
| @@ 1760-1776 (lines=17) @@ | ||
| 1757 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 1758 | * @throws \TelegramBot\Api\Exception |
|
| 1759 | */ |
|
| 1760 | public function sendPoll( |
|
| 1761 | $chatId, |
|
| 1762 | $question, |
|
| 1763 | $options, |
|
| 1764 | $disableNotification = false, |
|
| 1765 | $replyToMessageId = null, |
|
| 1766 | $replyMarkup = null |
|
| 1767 | ) { |
|
| 1768 | return Message::fromResponse($this->call('sendPoll', [ |
|
| 1769 | 'chat_id' => $chatId, |
|
| 1770 | 'question' => $question, |
|
| 1771 | 'options' => json_encode($options), |
|
| 1772 | 'disable_notification' => (bool)$disableNotification, |
|
| 1773 | 'reply_to_message_id' => (int)$replyToMessageId, |
|
| 1774 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1775 | ])); |
|
| 1776 | } |
|
| 1777 | ||
| 1778 | /** |
|
| 1779 | * Use this method to stop a poll which was sent by the bot. |
|