| @@ 308-326 (lines=19) @@ | ||
| 305 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 306 | * @throws \TelegramBot\Api\Exception |
|
| 307 | */ |
|
| 308 | public function sendMessage( |
|
| 309 | $chatId, |
|
| 310 | $text, |
|
| 311 | $parseMode = null, |
|
| 312 | $disablePreview = false, |
|
| 313 | $replyToMessageId = null, |
|
| 314 | $replyMarkup = null, |
|
| 315 | $disableNotification = false |
|
| 316 | ) { |
|
| 317 | return Message::fromResponse($this->call('sendMessage', [ |
|
| 318 | 'chat_id' => $chatId, |
|
| 319 | 'text' => $text, |
|
| 320 | 'parse_mode' => $parseMode, |
|
| 321 | 'disable_web_page_preview' => $disablePreview, |
|
| 322 | 'reply_to_message_id' => (int)$replyToMessageId, |
|
| 323 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 324 | 'disable_notification' => (bool)$disableNotification, |
|
| 325 | ])); |
|
| 326 | } |
|
| 327 | ||
| 328 | /** |
|
| 329 | * Use this method to send phone contacts |
|
| @@ 343-361 (lines=19) @@ | ||
| 340 | * @return \TelegramBot\Api\Types\Message |
|
| 341 | * @throws \TelegramBot\Api\Exception |
|
| 342 | */ |
|
| 343 | public function sendContact( |
|
| 344 | $chatId, |
|
| 345 | $phoneNumber, |
|
| 346 | $firstName, |
|
| 347 | $lastName = null, |
|
| 348 | $replyToMessageId = null, |
|
| 349 | $replyMarkup = null, |
|
| 350 | $disableNotification = false |
|
| 351 | ) { |
|
| 352 | return Message::fromResponse($this->call('sendContact', [ |
|
| 353 | 'chat_id' => $chatId, |
|
| 354 | 'phone_number' => $phoneNumber, |
|
| 355 | 'first_name' => $firstName, |
|
| 356 | 'last_name' => $lastName, |
|
| 357 | 'reply_to_message_id' => $replyToMessageId, |
|
| 358 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 359 | 'disable_notification' => (bool)$disableNotification, |
|
| 360 | ])); |
|
| 361 | } |
|
| 362 | ||
| 363 | /** |
|
| 364 | * Use this method when you need to tell the user that something is happening on the bot's side. |
|
| @@ 487-505 (lines=19) @@ | ||
| 484 | * @param null|int $livePeriod |
|
| 485 | * @return \TelegramBot\Api\Types\Message |
|
| 486 | */ |
|
| 487 | public function sendLocation( |
|
| 488 | $chatId, |
|
| 489 | $latitude, |
|
| 490 | $longitude, |
|
| 491 | $replyToMessageId = null, |
|
| 492 | $replyMarkup = null, |
|
| 493 | $disableNotification = false, |
|
| 494 | $livePeriod = null |
|
| 495 | ) { |
|
| 496 | return Message::fromResponse($this->call('sendLocation', [ |
|
| 497 | 'chat_id' => $chatId, |
|
| 498 | 'latitude' => $latitude, |
|
| 499 | 'longitude' => $longitude, |
|
| 500 | 'live_period' => $livePeriod, |
|
| 501 | 'reply_to_message_id' => $replyToMessageId, |
|
| 502 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 503 | 'disable_notification' => (bool)$disableNotification, |
|
| 504 | ])); |
|
| 505 | } |
|
| 506 | ||
| 507 | /** |
|
| 508 | * Use this method to edit live location messages sent by the bot or via the bot (for inline bots). |
|
| @@ 698-716 (lines=19) @@ | ||
| 695 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 696 | * @throws \TelegramBot\Api\Exception |
|
| 697 | */ |
|
| 698 | public function sendVoice( |
|
| 699 | $chatId, |
|
| 700 | $voice, |
|
| 701 | $duration = null, |
|
| 702 | $replyToMessageId = null, |
|
| 703 | $replyMarkup = null, |
|
| 704 | $disableNotification = false, |
|
| 705 | $parseMode = null |
|
| 706 | ) { |
|
| 707 | return Message::fromResponse($this->call('sendVoice', [ |
|
| 708 | 'chat_id' => $chatId, |
|
| 709 | 'voice' => $voice, |
|
| 710 | 'duration' => $duration, |
|
| 711 | 'reply_to_message_id' => $replyToMessageId, |
|
| 712 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 713 | 'disable_notification' => (bool)$disableNotification, |
|
| 714 | 'parse_mode' => $parseMode |
|
| 715 | ])); |
|
| 716 | } |
|
| 717 | ||
| 718 | /** |
|
| 719 | * Use this method to forward messages of any kind. On success, the sent Message is returned. |
|
| @@ 811-829 (lines=19) @@ | ||
| 808 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 809 | * @throws \TelegramBot\Api\Exception |
|
| 810 | */ |
|
| 811 | public function sendPhoto( |
|
| 812 | $chatId, |
|
| 813 | $photo, |
|
| 814 | $caption = null, |
|
| 815 | $replyToMessageId = null, |
|
| 816 | $replyMarkup = null, |
|
| 817 | $disableNotification = false, |
|
| 818 | $parseMode = null |
|
| 819 | ) { |
|
| 820 | return Message::fromResponse($this->call('sendPhoto', [ |
|
| 821 | 'chat_id' => $chatId, |
|
| 822 | 'photo' => $photo, |
|
| 823 | 'caption' => $caption, |
|
| 824 | 'reply_to_message_id' => $replyToMessageId, |
|
| 825 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 826 | 'disable_notification' => (bool)$disableNotification, |
|
| 827 | 'parse_mode' => $parseMode |
|
| 828 | ])); |
|
| 829 | } |
|
| 830 | ||
| 831 | /** |
|
| 832 | * Use this method to send general files. On success, the sent Message is returned. |
|
| @@ 848-866 (lines=19) @@ | ||
| 845 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 846 | * @throws \TelegramBot\Api\Exception |
|
| 847 | */ |
|
| 848 | public function sendDocument( |
|
| 849 | $chatId, |
|
| 850 | $document, |
|
| 851 | $caption = null, |
|
| 852 | $replyToMessageId = null, |
|
| 853 | $replyMarkup = null, |
|
| 854 | $disableNotification = false, |
|
| 855 | $parseMode = null |
|
| 856 | ) { |
|
| 857 | return Message::fromResponse($this->call('sendDocument', [ |
|
| 858 | 'chat_id' => $chatId, |
|
| 859 | 'document' => $document, |
|
| 860 | 'caption' => $caption, |
|
| 861 | 'reply_to_message_id' => $replyToMessageId, |
|
| 862 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 863 | 'disable_notification' => (bool)$disableNotification, |
|
| 864 | 'parse_mode' => $parseMode |
|
| 865 | ])); |
|
| 866 | } |
|
| 867 | ||
| 868 | /** |
|
| 869 | * Use this method to get basic info about a file and prepare it for downloading. |
|
| @@ 1026-1044 (lines=19) @@ | ||
| 1023 | * Types\ReplyKeyboardRemove|null $replyMarkup |
|
| 1024 | * @return Message |
|
| 1025 | */ |
|
| 1026 | public function editMessageText( |
|
| 1027 | $chatId, |
|
| 1028 | $messageId, |
|
| 1029 | $text, |
|
| 1030 | $parseMode = null, |
|
| 1031 | $disablePreview = false, |
|
| 1032 | $replyMarkup = null, |
|
| 1033 | $inlineMessageId = null |
|
| 1034 | ) { |
|
| 1035 | return Message::fromResponse($this->call('editMessageText', [ |
|
| 1036 | 'chat_id' => $chatId, |
|
| 1037 | 'message_id' => $messageId, |
|
| 1038 | 'text' => $text, |
|
| 1039 | 'inline_message_id' => $inlineMessageId, |
|
| 1040 | 'parse_mode' => $parseMode, |
|
| 1041 | 'disable_web_page_preview' => $disablePreview, |
|
| 1042 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1043 | ])); |
|
| 1044 | } |
|
| 1045 | ||
| 1046 | /** |
|
| 1047 | * Use this method to edit text messages sent by the bot or via the bot |
|
| @@ 1617-1635 (lines=19) @@ | ||
| 1614 | * @throws \TelegramBot\Api\InvalidArgumentException |
|
| 1615 | * @throws \TelegramBot\Api\Exception |
|
| 1616 | */ |
|
| 1617 | public function sendVideoNote( |
|
| 1618 | $chatId, |
|
| 1619 | $videoNote, |
|
| 1620 | $duration = null, |
|
| 1621 | $length = null, |
|
| 1622 | $replyToMessageId = null, |
|
| 1623 | $replyMarkup = null, |
|
| 1624 | $disableNotification = false |
|
| 1625 | ) { |
|
| 1626 | return Message::fromResponse($this->call('sendVideoNote', [ |
|
| 1627 | 'chat_id' => $chatId, |
|
| 1628 | 'video_note' => $videoNote, |
|
| 1629 | 'duration' => $duration, |
|
| 1630 | 'length' => $length, |
|
| 1631 | 'reply_to_message_id' => $replyToMessageId, |
|
| 1632 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
|
| 1633 | 'disable_notification' => (bool)$disableNotification |
|
| 1634 | ])); |
|
| 1635 | } |
|
| 1636 | ||
| 1637 | /** |
|
| 1638 | * Use this method to send a group of photos or videos as an album. |
|