├── .editorconfig
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── examples
├── DeleteChatPhoto.php
├── EditMessageLiveLocation.php
├── ExportChatInviteLink.php
├── ForwardMessage.php
├── GetChat.php
├── GetChatAdministrators.php
├── GetChatMembersCount.php
├── GetFile.php
├── GetMe.php
├── GetUpdates.php
├── GetUserProfilePhotos.php
├── KickChatMember.php
├── PromoteChatMember.php
├── RestrictChatMember.php
├── SendAnimation.php
├── SendAudio.php
├── SendChatAction.php
├── SendContact.php
├── SendDocument.php
├── SendLocation.php
├── SendMediaGroup.php
├── SendMessageWithInlineKeyboard.php
├── SendMessageWithKeyboard.php
├── SendMessageWithRemoveKeyboard.php
├── SendPhoto.php
├── SendPoll.php
├── SendVenue.php
├── SendVideo.php
├── SendVideoNote.php
├── SendVoice.php
├── SetChatDescription.php
├── SetChatPermissions.php
├── SetChatPhoto.php
├── SetChatTitle.php
├── StopMessageLiveLocation.php
├── UnbanChatMember.php
├── WebhookInfo.php
├── init.php
└── resources
│ ├── cat_need_chereshnya.mp3
│ ├── chereshnya.jpeg
│ ├── chereshnya.mp4
│ ├── chereshnya.txt
│ └── gifka.gif
├── phpunit.xml.dist
├── src
└── SimpleTelegramBotClient
│ ├── Builder
│ ├── Action
│ │ ├── AnswerCallbackQueryBuilder.php
│ │ ├── DeleteChatPhotoBuilder.php
│ │ ├── EditMessageLiveLocationBuilder.php
│ │ ├── ExportChatInviteLinkBuilder.php
│ │ ├── ForwardMessageBuilder.php
│ │ ├── GetFileBuilder.php
│ │ ├── GetUserProfilePhotosBuilder.php
│ │ ├── KickChatMemberBuilder.php
│ │ ├── PinChatMessageBuilder.php
│ │ ├── PromoteChatMemberBuilder.php
│ │ ├── RestrictChatMemberBuilder.php
│ │ ├── SendAnimationBuilder.php
│ │ ├── SendAudioBuilder.php
│ │ ├── SendChatActionBuilder.php
│ │ ├── SendContactBuilder.php
│ │ ├── SendDocumentBuilder.php
│ │ ├── SendLocationBuilder.php
│ │ ├── SendMediaGroupBuilder.php
│ │ ├── SendMessageBuilder.php
│ │ ├── SendPhotoBuilder.php
│ │ ├── SendPollBuilder.php
│ │ ├── SendVenueBuilder.php
│ │ ├── SendVideoBuilder.php
│ │ ├── SendVideoNoteBuilder.php
│ │ ├── SendVoiceBuilder.php
│ │ ├── SetChatDescriptionBuilder.php
│ │ ├── SetChatPermissionsBuilder.php
│ │ ├── SetChatPhotoBuilder.php
│ │ ├── SetChatTitleBuilder.php
│ │ ├── StopMessageLiveLocationBuilder.php
│ │ ├── UnbanChatMemberBuilder.php
│ │ └── Webhook
│ │ │ └── SetWebhookBuilder.php
│ ├── Keyboard
│ │ ├── ArrayKeyboardButtonBuilder.php
│ │ ├── InlineKeyboardButtonBuilder.php
│ │ ├── InlineKeyboardMarkupBuilder.php
│ │ ├── KeyboardButtonBuilder.php
│ │ ├── ReplyKeyboardMarkupBuilder.php
│ │ └── ReplyKeyboardRemoveBuilder.php
│ └── Type
│ │ ├── ChatPermissionsBuilder.php
│ │ ├── InputMediaPhotoBuilder.php
│ │ └── InputMediaVideoBuilder.php
│ ├── Config.php
│ ├── Constant
│ ├── ChatAction.php
│ └── ParseMode.php
│ ├── Dto
│ ├── Action
│ │ ├── ActionInterface.php
│ │ ├── AnswerCallbackQuery.php
│ │ ├── DeleteChatPhoto.php
│ │ ├── DeleteChatStickerSet.php
│ │ ├── EditMessageLiveLocation.php
│ │ ├── ExportChatInviteLink.php
│ │ ├── ForwardMessage.php
│ │ ├── GetChat.php
│ │ ├── GetChatAdministrators.php
│ │ ├── GetChatMembersCount.php
│ │ ├── GetFile.php
│ │ ├── GetUserProfilePhotos.php
│ │ ├── KickChatMember.php
│ │ ├── LeaveChat.php
│ │ ├── PinChatMessage.php
│ │ ├── PromoteChatMember.php
│ │ ├── RestrictChatMember.php
│ │ ├── SendAnimation.php
│ │ ├── SendAudio.php
│ │ ├── SendChatAction.php
│ │ ├── SendContact.php
│ │ ├── SendDocument.php
│ │ ├── SendLocation.php
│ │ ├── SendMediaGroup.php
│ │ ├── SendMessage.php
│ │ ├── SendPhoto.php
│ │ ├── SendPoll.php
│ │ ├── SendVenue.php
│ │ ├── SendVideo.php
│ │ ├── SendVideoNote.php
│ │ ├── SendVoice.php
│ │ ├── SetChatDescription.php
│ │ ├── SetChatPermissions.php
│ │ ├── SetChatPhoto.php
│ │ ├── SetChatStickerSet.php
│ │ ├── SetChatTitle.php
│ │ ├── StopMessageLiveLocation.php
│ │ ├── UnbanChatMember.php
│ │ ├── UnpinChatMessage.php
│ │ └── Webhook
│ │ │ └── SetWebhook.php
│ ├── Keyboard
│ │ ├── InlineKeyboardButton.php
│ │ ├── InlineKeyboardMarkup.php
│ │ ├── KeyboardButton.php
│ │ ├── ReplyKeyboardMarkup.php
│ │ └── ReplyKeyboardRemove.php
│ ├── Response
│ │ ├── ChatInviteLinkResponse.php
│ │ ├── Error.php
│ │ ├── GetChatAdministratorsResponse.php
│ │ ├── GetChatResponse.php
│ │ ├── GetFileResponse.php
│ │ ├── GetMeResponse.php
│ │ ├── GetUserProfilePhotosResponse.php
│ │ ├── GetWebhookInfoResponse.php
│ │ ├── IntResultResponse.php
│ │ ├── Response.php
│ │ ├── SendMediaGroupResponse.php
│ │ ├── SendMessageResponse.php
│ │ └── SimpleResponse.php
│ └── Type
│ │ ├── Animation.php
│ │ ├── Audio.php
│ │ ├── CallbackGame.php
│ │ ├── Chat.php
│ │ ├── ChatMember.php
│ │ ├── ChatPermissions.php
│ │ ├── ChatPhoto.php
│ │ ├── Contact.php
│ │ ├── Document.php
│ │ ├── File.php
│ │ ├── ForceReply.php
│ │ ├── Game.php
│ │ ├── InputMediaPhoto.php
│ │ ├── InputMediaVideo.php
│ │ ├── Invoice.php
│ │ ├── Location.php
│ │ ├── LoginUrl.php
│ │ ├── MaskPosition.php
│ │ ├── Message.php
│ │ ├── MessageEntity.php
│ │ ├── PassportData.php
│ │ ├── PhotoSize.php
│ │ ├── Poll.php
│ │ ├── PollOption.php
│ │ ├── Sticker.php
│ │ ├── SuccessfulPayment.php
│ │ ├── Update.php
│ │ ├── User.php
│ │ ├── UserProfilePhotos.php
│ │ ├── Venue.php
│ │ ├── Video.php
│ │ ├── VideoNote.php
│ │ ├── Voice.php
│ │ └── WebhookInfo.php
│ ├── Exception
│ ├── BadMethodCallException.php
│ └── ClientException.php
│ ├── ResponseFactory.php
│ ├── TelegramService.php
│ └── TelegramServiceFactory.php
└── tests
├── SimpleTelegramBotClient
└── TelegramServiceTest.php
└── resources
├── error.json
├── export_chat_invite_link.json
├── get_chat.json
├── get_chat_administrators.json
├── get_file.json
├── get_me.json
├── get_updates.json
├── get_user_profile_photos.json
├── get_webhook_info.json
├── int_response.json
├── send_contact.json
├── send_location.json
├── send_media_group.json
├── send_message_inline_result.json
├── send_message_keyboard.json
├── send_poll.json
├── send_venue.json
├── send_video_note.json
├── send_voice.json
├── simple_response.json
├── stop_message_live_location.json
└── stub_file
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor/
2 | .idea
3 | examples/.telegramkey
4 | .php_cs.cache
5 | phpunit.xml
6 | .phpunit.result.cache
7 | clover.xml
8 | composer.lock
9 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - '7.3'
4 | - '7.4'
5 | install:
6 | - composer install
7 | script:
8 | - vendor/bin/phpstan analyse ./src
9 | - vendor/bin/php-cs-fixer fix ./src --dry-run
10 | - vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml
11 |
12 | after_success:
13 | - bash <(curl -s https://codecov.io/bash)
14 |
15 | branches:
16 | only:
17 | - master
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Stepan Franchuk
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SimpleTelegramBotClient
2 |
3 | [](https://travis-ci.org/xcorter/SimpleTelegramBotClient)
4 | [](https://codecov.io/gh/xcorter/SimpleTelegramBotClient/)
5 | [](https://packagist.org/packages/franchuk/simple-telegram-client)
6 |
7 | ## Usages:
8 |
9 | ### Installation
10 |
11 | `composer require franchuk/simple-telegram-client`
12 |
13 | Require php >= 7.3
14 |
15 | ### Initialize
16 |
17 | Basic initialize with
18 |
19 | ```php
20 | build();
44 |
45 | $telegramService = new TelegramService($config, new Client(), $serializer);
46 | ```
47 |
48 |
49 | ### Get Updates
50 | ```php
51 | getUpdates();
53 | ```
54 |
55 | ### Send message
56 |
57 | ```php
58 | build();
64 | $telegramService->sendMessage($message);
65 | ```
66 |
67 | More examples you can find in `./examples` folder.
68 | Add file `.telegramkey` in `./examples` and put telegram key into it.
69 |
70 | ### PROXY
71 | If you have problems with telegram connection you can use proxy.
72 | ```php
73 | setProxy('socks4://ip:port');
78 | ```
79 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "franchuk/simple-telegram-client",
3 | "license": "MIT",
4 | "authors": [
5 | {
6 | "name": "franchuk",
7 | "email": "franchuk@vl.ru"
8 | }
9 | ],
10 | "version": "0.1.4",
11 | "require": {
12 | "guzzlehttp/guzzle": "~6.0",
13 | "jms/serializer": "^3.1",
14 | "ext-json": "*",
15 | "php": "^7.3.0"
16 | },
17 | "require-dev": {
18 | "roave/security-advisories": "dev-master",
19 | "friendsofphp/php-cs-fixer": "^2.15",
20 | "phpstan/phpstan": "^0.11.12",
21 | "phpunit/phpunit": "^8.3"
22 | },
23 | "autoload": {
24 | "psr-4": {
25 | "SimpleTelegramBotClient\\": "src/SimpleTelegramBotClient"
26 | }
27 | },
28 | "autoload-dev": {
29 | "psr-4": {
30 | "SimpleTelegramBotClient\\Tests\\": "tests/SimpleTelegramBotClient"
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/examples/DeleteChatPhoto.php:
--------------------------------------------------------------------------------
1 | build();
11 | $response = $telegramService->deleteChatPhoto($message);
12 | var_dump($response);
13 |
14 |
--------------------------------------------------------------------------------
/examples/EditMessageLiveLocation.php:
--------------------------------------------------------------------------------
1 | setLivePeriod(100);
13 |
14 | $message = $sendLocationBuilder->build();
15 | $sendMLocationResponse = $telegramService->sendLocation($message);
16 |
17 | // EDIT LOCATION
18 | $editMessageLiveLocationBuilder = new EditMessageLiveLocationBuilder(0, 0);
19 | $editMessageLiveLocationBuilder->setMessageId($sendMLocationResponse->getResult()->getMessageId())->setChatId($chatId);
20 |
21 | $message = $editMessageLiveLocationBuilder->build();
22 | $sendMessageResponse = $telegramService->editMessageLiveLocation($message);
23 |
24 | var_dump($sendMessageResponse);
25 |
--------------------------------------------------------------------------------
/examples/ExportChatInviteLink.php:
--------------------------------------------------------------------------------
1 | build();
12 |
13 | $response = $telegramService->exportChatInviteLink($message);
14 |
15 | var_dump($response);
16 |
--------------------------------------------------------------------------------
/examples/ForwardMessage.php:
--------------------------------------------------------------------------------
1 | build();
14 | $sendMessageResponse = $telegramService->forwardMessage($message);
15 |
16 | var_dump($sendMessageResponse);
17 |
--------------------------------------------------------------------------------
/examples/GetChat.php:
--------------------------------------------------------------------------------
1 | getChat($message);
11 |
12 | var_dump($response);
13 |
--------------------------------------------------------------------------------
/examples/GetChatAdministrators.php:
--------------------------------------------------------------------------------
1 | getChatAdministrators($message);
11 |
12 | var_dump($response);
13 |
--------------------------------------------------------------------------------
/examples/GetChatMembersCount.php:
--------------------------------------------------------------------------------
1 | getChatMembersCount($message);
11 |
12 | var_dump($response);
13 |
--------------------------------------------------------------------------------
/examples/GetFile.php:
--------------------------------------------------------------------------------
1 | build();
11 |
12 | $response = $telegramService->getFile($getFile);
13 | var_dump($response);
14 |
--------------------------------------------------------------------------------
/examples/GetMe.php:
--------------------------------------------------------------------------------
1 | getMe();
6 | var_dump($response);
7 |
--------------------------------------------------------------------------------
/examples/GetUpdates.php:
--------------------------------------------------------------------------------
1 | getUpdates();
6 | var_dump($response);
7 |
--------------------------------------------------------------------------------
/examples/GetUserProfilePhotos.php:
--------------------------------------------------------------------------------
1 | build();
15 | $sendMessageResponse = $telegramService->getUserProfilePhotos($message);
16 |
17 | var_dump($sendMessageResponse);
18 |
--------------------------------------------------------------------------------
/examples/KickChatMember.php:
--------------------------------------------------------------------------------
1 | build();
14 | $sendMessageResponse = $telegramService->kickChatMember($message);
15 |
16 | var_dump($sendMessageResponse);
17 |
--------------------------------------------------------------------------------
/examples/PromoteChatMember.php:
--------------------------------------------------------------------------------
1 | setCanChangeInfo(true);
13 | $promoteChatMember = $promoteChatMemberBuilder->build();
14 |
15 | $response = $telegramService->promoteChatMember($promoteChatMember);
16 |
17 | var_dump($response);
18 |
--------------------------------------------------------------------------------
/examples/RestrictChatMember.php:
--------------------------------------------------------------------------------
1 | allowAll();
14 | $chatPermissions = $chatPermissionsBuilder->build();
15 |
16 | $restrictChatMemberBuilder = new RestrictChatMemberBuilder($chatId, $userId, $chatPermissions);
17 |
18 | $message = $restrictChatMemberBuilder->build();
19 | $response = $telegramService->restrictChatMember($message);
20 |
21 | var_dump($response);
22 |
--------------------------------------------------------------------------------
/examples/SendAnimation.php:
--------------------------------------------------------------------------------
1 | setThumb($thumb);
13 |
14 | $message = $sendPhotoBuilder->build();
15 | $sendMessageResponse = $telegramService->sendAnimation($message);
16 |
17 | var_dump($sendMessageResponse);
18 |
--------------------------------------------------------------------------------
/examples/SendAudio.php:
--------------------------------------------------------------------------------
1 | setThumb($thumb);
15 |
16 | $message = $sendPhotoBuilder->build();
17 | $sendMessageResponse = $telegramService->sendAudio($message);
18 |
19 | var_dump($sendMessageResponse);
20 |
--------------------------------------------------------------------------------
/examples/SendChatAction.php:
--------------------------------------------------------------------------------
1 | build();
13 | $sendChatActionResponse = $telegramService->sendChatAction($message);
14 |
15 | var_dump($sendChatActionResponse);
16 |
--------------------------------------------------------------------------------
/examples/SendContact.php:
--------------------------------------------------------------------------------
1 | build();
12 | $sendContactResponse = $telegramService->sendContact($message);
13 |
14 | var_dump($sendContactResponse);
15 |
--------------------------------------------------------------------------------
/examples/SendDocument.php:
--------------------------------------------------------------------------------
1 | sendDocument($sendDocumentBuilder->build());
10 | var_dump($response);
11 |
--------------------------------------------------------------------------------
/examples/SendLocation.php:
--------------------------------------------------------------------------------
1 | build();
12 | $sendMLocationResponse = $telegramService->sendLocation($message);
13 |
14 | var_dump($sendMLocationResponse);
15 |
--------------------------------------------------------------------------------
/examples/SendMediaGroup.php:
--------------------------------------------------------------------------------
1 | addMedia($inputMediaVideoBuilder->build())
16 | ->addMedia($inputMediaPhotoBuilder->build())
17 | ;
18 |
19 | $message = $sendMediaGroupBuilder->build();
20 | $sendMessageResponse = $telegramService->sendMediaGroup($message);
21 |
22 | var_dump($sendMessageResponse);
23 |
--------------------------------------------------------------------------------
/examples/SendMessageWithInlineKeyboard.php:
--------------------------------------------------------------------------------
1 | add((new InlineKeyboardButtonBuilder('text'))->setUrl('https://google.com')->build())
21 | ->add((new InlineKeyboardButtonBuilder('text2'))->setUrl('https://google.com')->build())
22 | ;
23 |
24 | $arrayKeyboardButtonBuilder2 = new ArrayKeyboardButtonBuilder();
25 | $arrayKeyboardButtonBuilder2->add((new InlineKeyboardButtonBuilder('long text'))->setUrl('https://google.com')->build());
26 |
27 | $inlineKeyboardMarkupBuilder
28 | ->addInlineKeyboardButtonArray($arrayKeyboardButtonBuilder->build())
29 | ->addInlineKeyboardButtonArray($arrayKeyboardButtonBuilder2->build())
30 | ;
31 |
32 | $sendMessageBuilder->setReplyMarkup($inlineKeyboardMarkupBuilder->build());
33 | $message = $sendMessageBuilder->build();
34 | $sendMessageResponse = $telegramService->sendMessage($message);
35 |
36 | var_dump($sendMessageResponse);
37 |
--------------------------------------------------------------------------------
/examples/SendMessageWithKeyboard.php:
--------------------------------------------------------------------------------
1 | add((new KeyboardButtonBuilder('text'))->build())
20 | ->add((new KeyboardButtonBuilder('text2'))->build())
21 | ;
22 |
23 | $arrayKeyboardButtonBuilder2 = new ArrayKeyboardButtonBuilder();
24 | $arrayKeyboardButtonBuilder2->add((new KeyboardButtonBuilder('long text'))->build());
25 |
26 |
27 | $replyKeyboardMarkupBuilder
28 | ->addArrayOfKeyboardButton($arrayKeyboardButtonBuilder->build())
29 | ->addArrayOfKeyboardButton($arrayKeyboardButtonBuilder2->build())
30 | ;
31 |
32 | $sendMessageBuilder->setReplyMarkup($replyKeyboardMarkupBuilder->build());
33 | $message = $sendMessageBuilder->build();
34 | $sendMessageResponse = $telegramService->sendMessage($message);
35 |
36 | var_dump($sendMessageResponse);
37 |
--------------------------------------------------------------------------------
/examples/SendMessageWithRemoveKeyboard.php:
--------------------------------------------------------------------------------
1 | build();
13 |
14 | $sendMessageBuilder->setReplyMarkup($replyKeyboardRemove);
15 | $message = $sendMessageBuilder->build();
16 | $sendMessageResponse = $telegramService->sendMessage($message);
17 |
18 | var_dump($sendMessageResponse);
19 |
--------------------------------------------------------------------------------
/examples/SendPhoto.php:
--------------------------------------------------------------------------------
1 | setCaption('Caption');
14 |
15 | $message = $sendPhotoBuilder->build();
16 | $sendMessageResponse = $telegramService->sendPhoto($message);
17 |
18 | var_dump($sendMessageResponse);
19 |
--------------------------------------------------------------------------------
/examples/SendPoll.php:
--------------------------------------------------------------------------------
1 | addOption('2')
12 | ->addOption('4')
13 | ->addOption('8')
14 | ;
15 |
16 |
17 | $message = $sendPollBuilder->build();
18 | $sendPollResponse = $telegramService->sendPoll($message);
19 |
20 | var_dump($sendPollResponse);
21 |
--------------------------------------------------------------------------------
/examples/SendVenue.php:
--------------------------------------------------------------------------------
1 | build();
12 | $sendMLocationResponse = $telegramService->sendVenue($message);
13 |
14 | var_dump($sendMLocationResponse);
15 |
--------------------------------------------------------------------------------
/examples/SendVideo.php:
--------------------------------------------------------------------------------
1 | setThumb($thumb);
13 |
14 | $message = $sendVideoBuilder->build();
15 | $sendMessageResponse = $telegramService->sendVideo($message);
16 |
17 | var_dump($sendMessageResponse);
18 |
--------------------------------------------------------------------------------
/examples/SendVideoNote.php:
--------------------------------------------------------------------------------
1 | build();
13 | $sendMessageResponse = $telegramService->sendVideoNote($message);
14 |
15 | var_dump($sendMessageResponse);
16 |
--------------------------------------------------------------------------------
/examples/SendVoice.php:
--------------------------------------------------------------------------------
1 | build();
13 | $sendMessageResponse = $telegramService->sendVoice($message);
14 |
15 | var_dump($sendMessageResponse);
16 |
--------------------------------------------------------------------------------
/examples/SetChatDescription.php:
--------------------------------------------------------------------------------
1 | setDescription('1231231');
11 | $message = $builder->build();
12 | $response = $telegramService->setChatDescription($message);
13 | var_dump($response);
14 |
--------------------------------------------------------------------------------
/examples/SetChatPermissions.php:
--------------------------------------------------------------------------------
1 | allowAll();
13 | $chatPermissions = $chatPermissionsBuilder->build();
14 |
15 | $setChatPermissionsBuilder = new SetChatPermissionsBuilder($chatId, $chatPermissions);
16 |
17 | $message = $setChatPermissionsBuilder->build();
18 | $response = $telegramService->setChatPermissions($message);
19 |
20 | var_dump($response);
21 |
--------------------------------------------------------------------------------
/examples/SetChatPhoto.php:
--------------------------------------------------------------------------------
1 | build();
12 | $response = $telegramService->setChatPhoto($message);
13 | var_dump($response);
14 |
--------------------------------------------------------------------------------
/examples/SetChatTitle.php:
--------------------------------------------------------------------------------
1 | build();
11 | $response = $telegramService->setChatTitle($message);
12 | var_dump($response);
13 |
--------------------------------------------------------------------------------
/examples/StopMessageLiveLocation.php:
--------------------------------------------------------------------------------
1 | setLivePeriod(100);
13 |
14 | $message = $sendLocationBuilder->build();
15 | $sendMLocationResponse = $telegramService->sendLocation($message);
16 |
17 | // EDIT LOCATION
18 | $stopMessageLiveLocationBuilder = new StopMessageLiveLocationBuilder();
19 | $stopMessageLiveLocationBuilder->setMessageId($sendMLocationResponse->getResult()->getMessageId())->setChatId($chatId);
20 |
21 | $message = $stopMessageLiveLocationBuilder->build();
22 | $sendMessageResponse = $telegramService->stopMessageLiveLocation($message);
23 |
24 | var_dump($sendMessageResponse);
25 |
--------------------------------------------------------------------------------
/examples/UnbanChatMember.php:
--------------------------------------------------------------------------------
1 | build();
14 | $response = $telegramService->unbanChatMember($message);
15 |
16 | var_dump($response);
17 |
--------------------------------------------------------------------------------
/examples/WebhookInfo.php:
--------------------------------------------------------------------------------
1 | getWebhookInfo($message);
10 | var_dump($response);
11 |
--------------------------------------------------------------------------------
/examples/init.php:
--------------------------------------------------------------------------------
1 | build();
18 |
19 | $telegramService = new TelegramService($config, new Client(), $serializer);
20 |
--------------------------------------------------------------------------------
/examples/resources/cat_need_chereshnya.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcorter/SimpleTelegramBotClient/c2dcff6b170a22fccc4fee6edb255951b63cb5fb/examples/resources/cat_need_chereshnya.mp3
--------------------------------------------------------------------------------
/examples/resources/chereshnya.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcorter/SimpleTelegramBotClient/c2dcff6b170a22fccc4fee6edb255951b63cb5fb/examples/resources/chereshnya.jpeg
--------------------------------------------------------------------------------
/examples/resources/chereshnya.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcorter/SimpleTelegramBotClient/c2dcff6b170a22fccc4fee6edb255951b63cb5fb/examples/resources/chereshnya.mp4
--------------------------------------------------------------------------------
/examples/resources/chereshnya.txt:
--------------------------------------------------------------------------------
1 | asdfasdfasd
--------------------------------------------------------------------------------
/examples/resources/gifka.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcorter/SimpleTelegramBotClient/c2dcff6b170a22fccc4fee6edb255951b63cb5fb/examples/resources/gifka.gif
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 | tests
11 |
12 |
13 |
14 |
15 |
16 | src
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/AnswerCallbackQueryBuilder.php:
--------------------------------------------------------------------------------
1 | callbackQueryId = $callbackQueryId;
37 | }
38 |
39 | public function build(): AnswerCallbackQuery
40 | {
41 | return new AnswerCallbackQuery(
42 | $this->callbackQueryId,
43 | $this->text,
44 | $this->showAlert,
45 | $this->url,
46 | $this->cacheTime
47 | );
48 | }
49 |
50 | /**
51 | * @param string|null $text
52 | * @return AnswerCallbackQueryBuilder
53 | */
54 | public function setText(?string $text): AnswerCallbackQueryBuilder
55 | {
56 | $this->text = $text;
57 | return $this;
58 | }
59 |
60 | /**
61 | * @param bool|null $showAlert
62 | * @return AnswerCallbackQueryBuilder
63 | */
64 | public function setShowAlert(?bool $showAlert): AnswerCallbackQueryBuilder
65 | {
66 | $this->showAlert = $showAlert;
67 | return $this;
68 | }
69 |
70 | /**
71 | * @param string|null $url
72 | * @return AnswerCallbackQueryBuilder
73 | */
74 | public function setUrl(?string $url): AnswerCallbackQueryBuilder
75 | {
76 | $this->url = $url;
77 | return $this;
78 | }
79 |
80 | /**
81 | * @param int|null $cacheTime
82 | * @return AnswerCallbackQueryBuilder
83 | */
84 | public function setCacheTime(?int $cacheTime): AnswerCallbackQueryBuilder
85 | {
86 | $this->cacheTime = $cacheTime;
87 | return $this;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/DeleteChatPhotoBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
21 | }
22 |
23 | public function build(): DeleteChatPhoto
24 | {
25 | return new DeleteChatPhoto($this->chatId);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/EditMessageLiveLocationBuilder.php:
--------------------------------------------------------------------------------
1 | latitude = $latitude;
43 | $this->longitude = $longitude;
44 | }
45 |
46 | /**
47 | * @return EditMessageLiveLocation
48 | */
49 | public function build(): EditMessageLiveLocation
50 | {
51 | return new EditMessageLiveLocation(
52 | $this->chatId,
53 | $this->messageId,
54 | $this->inlineMessageId,
55 | $this->latitude,
56 | $this->longitude,
57 | $this->replyMarkup
58 | );
59 | }
60 |
61 | /**
62 | * @param string|null $chatId
63 | * @return EditMessageLiveLocationBuilder
64 | */
65 | public function setChatId(?string $chatId): EditMessageLiveLocationBuilder
66 | {
67 | $this->chatId = $chatId;
68 | return $this;
69 | }
70 |
71 | /**
72 | * @param int|null $messageId
73 | * @return EditMessageLiveLocationBuilder
74 | */
75 | public function setMessageId(?int $messageId): EditMessageLiveLocationBuilder
76 | {
77 | $this->messageId = $messageId;
78 | return $this;
79 | }
80 |
81 | /**
82 | * @param string|null $inlineMessageId
83 | * @return EditMessageLiveLocationBuilder
84 | */
85 | public function setInlineMessageId(?string $inlineMessageId): EditMessageLiveLocationBuilder
86 | {
87 | $this->inlineMessageId = $inlineMessageId;
88 | return $this;
89 | }
90 |
91 | /**
92 | * @param InlineKeyboardMarkup|null $replyMarkup
93 | * @return EditMessageLiveLocationBuilder
94 | */
95 | public function setReplyMarkup(?InlineKeyboardMarkup $replyMarkup): EditMessageLiveLocationBuilder
96 | {
97 | $this->replyMarkup = $replyMarkup;
98 | return $this;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/ExportChatInviteLinkBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
21 | }
22 |
23 | public function build(): ExportChatInviteLink
24 | {
25 | return new ExportChatInviteLink($this->chatId);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/ForwardMessageBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
35 | $this->fromChatId = $fromChatId;
36 | $this->messageId = $messageId;
37 | }
38 |
39 | /**
40 | * @param bool|null $disableNotification
41 | * @return ForwardMessageBuilder
42 | */
43 | public function setDisableNotification(?bool $disableNotification): ForwardMessageBuilder
44 | {
45 | $this->disableNotification = $disableNotification;
46 | return $this;
47 | }
48 |
49 | public function build(): ForwardMessage
50 | {
51 | return new ForwardMessage(
52 | $this->chatId,
53 | $this->fromChatId,
54 | $this->disableNotification,
55 | $this->messageId
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/GetFileBuilder.php:
--------------------------------------------------------------------------------
1 | fileId = $fileId;
21 | }
22 |
23 | public function build(): GetFile
24 | {
25 | return new GetFile($this->fileId);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/GetUserProfilePhotosBuilder.php:
--------------------------------------------------------------------------------
1 | userId = $userId;
29 | }
30 |
31 | public function build(): GetUserProfilePhotos
32 | {
33 | return new GetUserProfilePhotos(
34 | $this->userId,
35 | $this->offset,
36 | $this->limit
37 | );
38 | }
39 |
40 | /**
41 | * @param int|null $offset
42 | * @return GetUserProfilePhotosBuilder
43 | */
44 | public function setOffset(?int $offset): GetUserProfilePhotosBuilder
45 | {
46 | $this->offset = $offset;
47 | return $this;
48 | }
49 |
50 | /**
51 | * @param int|null $limit
52 | * @return GetUserProfilePhotosBuilder
53 | */
54 | public function setLimit(?int $limit): GetUserProfilePhotosBuilder
55 | {
56 | $this->limit = $limit;
57 | return $this;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/KickChatMemberBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
30 | $this->userId = $userId;
31 | }
32 |
33 | public function build(): KickChatMember
34 | {
35 | return new KickChatMember(
36 | $this->chatId,
37 | $this->userId,
38 | $this->untilDate
39 | );
40 | }
41 |
42 | /**
43 | * @param int|null $untilDate
44 | * @return KickChatMemberBuilder
45 | */
46 | public function setUntilDate(?int $untilDate): KickChatMemberBuilder
47 | {
48 | $this->untilDate = $untilDate;
49 | return $this;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/PinChatMessageBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
30 | $this->messageId = $messageId;
31 | }
32 |
33 | /**
34 | * @param bool|null $disableNotification
35 | * @return PinChatMessageBuilder
36 | */
37 | public function setDisableNotification(?bool $disableNotification): PinChatMessageBuilder
38 | {
39 | $this->disableNotification = $disableNotification;
40 | return $this;
41 | }
42 |
43 | public function build(): PinChatMessage
44 | {
45 | return new PinChatMessage($this->chatId, $this->messageId, $this->disableNotification);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/RestrictChatMemberBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
36 | $this->userId = $userId;
37 | $this->permissions = $permissions;
38 | }
39 |
40 | /**
41 | * @param int|null $untilDate
42 | * @return RestrictChatMemberBuilder
43 | */
44 | public function setUntilDate(?int $untilDate): RestrictChatMemberBuilder
45 | {
46 | $this->untilDate = $untilDate;
47 | return $this;
48 | }
49 |
50 | public function build(): RestrictChatMember
51 | {
52 | return new RestrictChatMember(
53 | $this->chatId,
54 | $this->userId,
55 | $this->permissions,
56 | $this->untilDate
57 | );
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendChatActionBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | if (!in_array($action, ChatAction::ACTIONS, true)) {
29 | throw new \UnexpectedValueException('Wrong action');
30 | }
31 | $this->action = $action;
32 | }
33 |
34 | /**
35 | * @return SendChatAction
36 | */
37 | public function build(): SendChatAction
38 | {
39 | return new SendChatAction(
40 | $this->chatId,
41 | $this->action
42 | );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendContactBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
55 | $this->phoneNumber = $phoneNumber;
56 | $this->firstName = $firstName;
57 | }
58 |
59 | public function build(): SendContact
60 | {
61 | return new SendContact(
62 | $this->chatId,
63 | $this->phoneNumber,
64 | $this->firstName,
65 | $this->lastName,
66 | $this->vcard,
67 | $this->disableNotification,
68 | $this->replyToMessageId,
69 | $this->replyMarkup
70 | );
71 | }
72 |
73 | /**
74 | * @param string|null $lastName
75 | * @return SendContactBuilder
76 | */
77 | public function setLastName(?string $lastName): SendContactBuilder
78 | {
79 | $this->lastName = $lastName;
80 | return $this;
81 | }
82 |
83 | /**
84 | * @param string|null $vcard
85 | * @return SendContactBuilder
86 | */
87 | public function setVcard(?string $vcard): SendContactBuilder
88 | {
89 | $this->vcard = $vcard;
90 | return $this;
91 | }
92 |
93 | /**
94 | * @param bool|null $disableNotification
95 | * @return SendContactBuilder
96 | */
97 | public function setDisableNotification(?bool $disableNotification): SendContactBuilder
98 | {
99 | $this->disableNotification = $disableNotification;
100 | return $this;
101 | }
102 |
103 | /**
104 | * @param int|null $replyToMessageId
105 | * @return SendContactBuilder
106 | */
107 | public function setReplyToMessageId(?int $replyToMessageId): SendContactBuilder
108 | {
109 | $this->replyToMessageId = $replyToMessageId;
110 | return $this;
111 | }
112 |
113 | /**
114 | * @param ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null $replyMarkup
115 | * @return SendContactBuilder
116 | */
117 | public function setReplyMarkup($replyMarkup)
118 | {
119 | $this->replyMarkup = $replyMarkup;
120 | return $this;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendLocationBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
51 | $this->latitude = $latitude;
52 | $this->longitude = $longitude;
53 | }
54 |
55 | public function build(): SendLocation
56 | {
57 | return new SendLocation(
58 | $this->chatId,
59 | $this->latitude,
60 | $this->longitude,
61 | $this->livePeriod,
62 | $this->disableNotification,
63 | $this->replyToMessageId,
64 | $this->replyMarkup
65 | );
66 | }
67 |
68 | /**
69 | * @param int|null $livePeriod
70 | * @return SendLocationBuilder
71 | */
72 | public function setLivePeriod(?int $livePeriod): SendLocationBuilder
73 | {
74 | $this->livePeriod = $livePeriod;
75 | return $this;
76 | }
77 |
78 | /**
79 | * @param bool|null $disableNotification
80 | * @return SendLocationBuilder
81 | */
82 | public function setDisableNotification(?bool $disableNotification): SendLocationBuilder
83 | {
84 | $this->disableNotification = $disableNotification;
85 | return $this;
86 | }
87 |
88 | /**
89 | * @param int|null $replyToMessageId
90 | * @return SendLocationBuilder
91 | */
92 | public function setReplyToMessageId(?int $replyToMessageId): SendLocationBuilder
93 | {
94 | $this->replyToMessageId = $replyToMessageId;
95 | return $this;
96 | }
97 |
98 | /**
99 | * @param ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null $replyMarkup
100 | * @return SendLocationBuilder
101 | */
102 | public function setReplyMarkup($replyMarkup): SendLocationBuilder
103 | {
104 | $this->replyMarkup = $replyMarkup;
105 | return $this;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendMediaGroupBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
35 | }
36 |
37 | public function build(): SendMediaGroup
38 | {
39 | return new SendMediaGroup(
40 | $this->chatId,
41 | $this->media,
42 | $this->disableNotification,
43 | $this->replyToMessageId
44 | );
45 | }
46 |
47 | /**
48 | * @param InputMediaPhoto|InputMediaVideo $media
49 | * @return SendMediaGroupBuilder
50 | */
51 | public function addMedia($media): SendMediaGroupBuilder
52 | {
53 | $this->media[] = $media;
54 | return $this;
55 | }
56 |
57 | /**
58 | * @param bool|null $disableNotification
59 | * @return SendMediaGroupBuilder
60 | */
61 | public function setDisableNotification(?bool $disableNotification): SendMediaGroupBuilder
62 | {
63 | $this->disableNotification = $disableNotification;
64 | return $this;
65 | }
66 |
67 | /**
68 | * @param int|null $replyToMessageId
69 | * @return SendMediaGroupBuilder
70 | */
71 | public function setReplyToMessageId(?int $replyToMessageId): SendMediaGroupBuilder
72 | {
73 | $this->replyToMessageId = $replyToMessageId;
74 | return $this;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendMessageBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
46 | $this->text = $text;
47 | }
48 |
49 | /**
50 | * Values from constants of ParseMode
51 | *
52 | * @param string $parseMode
53 | * @return SendMessageBuilder
54 | */
55 | public function setParseMode(string $parseMode): SendMessageBuilder
56 | {
57 | if (!in_array($parseMode, ParseMode::AVAILABLE_VALUES, true)) {
58 | throw new \UnexpectedValueException('Wrong parse mode');
59 | }
60 | $this->parseMode = $parseMode;
61 | return $this;
62 | }
63 |
64 | /**
65 | * @param bool|null $disableWebPagePreview
66 | * @return SendMessageBuilder
67 | */
68 | public function setDisableWebPagePreview(?bool $disableWebPagePreview): SendMessageBuilder
69 | {
70 | $this->disableWebPagePreview = $disableWebPagePreview;
71 | return $this;
72 | }
73 |
74 | /**
75 | * @param bool|null $disableNotification
76 | * @return SendMessageBuilder
77 | */
78 | public function setDisableNotification(?bool $disableNotification): SendMessageBuilder
79 | {
80 | $this->disableNotification = $disableNotification;
81 | return $this;
82 | }
83 |
84 | /**
85 | * @param int|null $replyToMessageId
86 | * @return SendMessageBuilder
87 | */
88 | public function setReplyToMessageId(?int $replyToMessageId): SendMessageBuilder
89 | {
90 | $this->replyToMessageId = $replyToMessageId;
91 | return $this;
92 | }
93 |
94 | /**
95 | * @param ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|InlineKeyboardMarkup|null $replyMarkup
96 | * @return SendMessageBuilder
97 | */
98 | public function setReplyMarkup($replyMarkup): SendMessageBuilder
99 | {
100 | $this->replyMarkup = $replyMarkup;
101 | return $this;
102 | }
103 |
104 | /**
105 | * @return SendMessage
106 | */
107 | public function build(): SendMessage
108 | {
109 | return new SendMessage(
110 | $this->chatId,
111 | $this->text,
112 | $this->parseMode,
113 | $this->disableWebPagePreview,
114 | $this->disableNotification,
115 | $this->replyToMessageId,
116 | $this->replyMarkup
117 | );
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendPhotoBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
45 | $this->photo = $photo;
46 | }
47 |
48 | /**
49 | * @return SendPhoto
50 | */
51 | public function build(): SendPhoto
52 | {
53 | return new SendPhoto(
54 | $this->chatId,
55 | $this->photo,
56 | $this->caption,
57 | $this->parseMode,
58 | $this->disableNotification,
59 | $this->replyToMessageId,
60 | $this->replyMarkup
61 | );
62 | }
63 |
64 | /**
65 | * @param string|null $caption
66 | * @return SendPhotoBuilder
67 | */
68 | public function setCaption(?string $caption): SendPhotoBuilder
69 | {
70 | $this->caption = $caption;
71 | return $this;
72 | }
73 |
74 | /**
75 | * @param string|null $parseMode
76 | * @return SendPhotoBuilder
77 | */
78 | public function setParseMode(?string $parseMode): SendPhotoBuilder
79 | {
80 | $this->parseMode = $parseMode;
81 | return $this;
82 | }
83 |
84 | /**
85 | * @param bool|null $disableNotification
86 | * @return SendPhotoBuilder
87 | */
88 | public function setDisableNotification(?bool $disableNotification): SendPhotoBuilder
89 | {
90 | $this->disableNotification = $disableNotification;
91 | return $this;
92 | }
93 |
94 | /**
95 | * @param int|null $replyToMessageId
96 | * @return SendPhotoBuilder
97 | */
98 | public function setReplyToMessageId(?int $replyToMessageId): SendPhotoBuilder
99 | {
100 | $this->replyToMessageId = $replyToMessageId;
101 | return $this;
102 | }
103 |
104 | /**
105 | * @param ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null $replyMarkup
106 | * @return SendPhotoBuilder
107 | */
108 | public function setReplyMarkup($replyMarkup)
109 | {
110 | $this->replyMarkup = $replyMarkup;
111 | return $this;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendPollBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
46 | $this->question = $question;
47 | }
48 |
49 | public function build(): SendPoll
50 | {
51 | if (!$this->options) {
52 | throw new \DomainException('At least one option must be set');
53 | }
54 | return new SendPoll(
55 | $this->chatId,
56 | $this->question,
57 | $this->options,
58 | $this->disableNotification,
59 | $this->replyToMessageId,
60 | $this->replyMarkup
61 | );
62 | }
63 |
64 | public function addOption(string $option): SendPollBuilder
65 | {
66 | $this->options[] = $option;
67 | return $this;
68 | }
69 |
70 | /**
71 | * @param bool|null $disableNotification
72 | * @return SendPollBuilder
73 | */
74 | public function setDisableNotification(?bool $disableNotification): SendPollBuilder
75 | {
76 | $this->disableNotification = $disableNotification;
77 | return $this;
78 | }
79 |
80 | /**
81 | * @param int|null $replyToMessageId
82 | * @return SendPollBuilder
83 | */
84 | public function setReplyToMessageId(?int $replyToMessageId): SendPollBuilder
85 | {
86 | $this->replyToMessageId = $replyToMessageId;
87 | return $this;
88 | }
89 |
90 | /**
91 | * @param ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null $replyMarkup
92 | * @return SendPollBuilder
93 | */
94 | public function setReplyMarkup($replyMarkup)
95 | {
96 | $this->replyMarkup = $replyMarkup;
97 | return $this;
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SendVoiceBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
54 | $this->voice = $voice;
55 | }
56 |
57 | /**
58 | * @return SendVoice
59 | */
60 | public function build(): SendVoice
61 | {
62 | return new SendVoice(
63 | $this->chatId,
64 | $this->voice,
65 | $this->caption,
66 | $this->parseMode,
67 | $this->duration,
68 | $this->disableNotification,
69 | $this->replyToMessageId,
70 | $this->replyMarkup
71 | );
72 | }
73 |
74 | /**
75 | * @param string|null $caption
76 | * @return SendVoiceBuilder
77 | */
78 | public function setCaption(?string $caption): SendVoiceBuilder
79 | {
80 | $this->caption = $caption;
81 | return $this;
82 | }
83 |
84 | /**
85 | * @param string|null $parseMode
86 | * @return SendVoiceBuilder
87 | */
88 | public function setParseMode(?string $parseMode): SendVoiceBuilder
89 | {
90 | $this->parseMode = $parseMode;
91 | return $this;
92 | }
93 |
94 | /**
95 | * @param int|null $duration
96 | * @return SendVoiceBuilder
97 | */
98 | public function setDuration(?int $duration): SendVoiceBuilder
99 | {
100 | $this->duration = $duration;
101 | return $this;
102 | }
103 |
104 | /**
105 | * @param bool|null $disableNotification
106 | * @return SendVoiceBuilder
107 | */
108 | public function setDisableNotification(?bool $disableNotification): SendVoiceBuilder
109 | {
110 | $this->disableNotification = $disableNotification;
111 | return $this;
112 | }
113 |
114 | /**
115 | * @param int|null $replyToMessageId
116 | * @return SendVoiceBuilder
117 | */
118 | public function setReplyToMessageId(?int $replyToMessageId): SendVoiceBuilder
119 | {
120 | $this->replyToMessageId = $replyToMessageId;
121 | return $this;
122 | }
123 |
124 | /**
125 | * @param ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null $replyMarkup
126 | * @return SendVoiceBuilder
127 | */
128 | public function setReplyMarkup($replyMarkup): SendVoiceBuilder
129 | {
130 | $this->replyMarkup = $replyMarkup;
131 | return $this;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SetChatDescriptionBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
25 | }
26 |
27 | /**
28 | * @param string|null $description
29 | * @return SetChatDescriptionBuilder
30 | */
31 | public function setDescription(?string $description): SetChatDescriptionBuilder
32 | {
33 | $this->description = $description;
34 | return $this;
35 | }
36 |
37 | public function build(): SetChatDescription
38 | {
39 | return new SetChatDescription($this->chatId, $this->description);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SetChatPermissionsBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
27 | $this->permissions = $permissions;
28 | }
29 |
30 | public function build(): SetChatPermissions
31 | {
32 | return new SetChatPermissions($this->chatId, $this->permissions);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SetChatPhotoBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
26 | $this->photo = $photo;
27 | }
28 |
29 | public function build(): SetChatPhoto
30 | {
31 | return new SetChatPhoto(
32 | $this->chatId,
33 | $this->photo
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/SetChatTitleBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
30 | $this->title = $title;
31 | }
32 |
33 | public function build(): SetChatTitle
34 | {
35 | return new SetChatTitle($this->chatId, $this->title);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/StopMessageLiveLocationBuilder.php:
--------------------------------------------------------------------------------
1 | chatId,
34 | $this->messageId,
35 | $this->inlineMessageId,
36 | $this->replyMarkup
37 | );
38 | }
39 |
40 | /**
41 | * @param string|null $chatId
42 | * @return StopMessageLiveLocationBuilder
43 | */
44 | public function setChatId(?string $chatId): StopMessageLiveLocationBuilder
45 | {
46 | $this->chatId = $chatId;
47 | return $this;
48 | }
49 |
50 | /**
51 | * @param int|null $messageId
52 | * @return StopMessageLiveLocationBuilder
53 | */
54 | public function setMessageId(?int $messageId): StopMessageLiveLocationBuilder
55 | {
56 | $this->messageId = $messageId;
57 | return $this;
58 | }
59 |
60 | /**
61 | * @param string|null $inlineMessageId
62 | * @return StopMessageLiveLocationBuilder
63 | */
64 | public function setInlineMessageId(?string $inlineMessageId): StopMessageLiveLocationBuilder
65 | {
66 | $this->inlineMessageId = $inlineMessageId;
67 | return $this;
68 | }
69 |
70 | /**
71 | * @param InlineKeyboardMarkup|null $replyMarkup
72 | * @return StopMessageLiveLocationBuilder
73 | */
74 | public function setReplyMarkup(?InlineKeyboardMarkup $replyMarkup): StopMessageLiveLocationBuilder
75 | {
76 | $this->replyMarkup = $replyMarkup;
77 | return $this;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/UnbanChatMemberBuilder.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
26 | $this->userId = $userId;
27 | }
28 |
29 | public function build(): UnbanChatMember
30 | {
31 | return new UnbanChatMember($this->chatId, $this->userId);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Action/Webhook/SetWebhookBuilder.php:
--------------------------------------------------------------------------------
1 | url = $url;
45 | }
46 |
47 | /**
48 | * @return SetWebhook
49 | */
50 | public function build(): SetWebhook
51 | {
52 | return new SetWebhook(
53 | $this->url,
54 | $this->certificate,
55 | $this->maxConnections,
56 | $this->allowedUpdates
57 | );
58 | }
59 |
60 | /**
61 | * @param string $certificate
62 | * @return SetWebhookBuilder
63 | */
64 | public function setCertificate(string $certificate): SetWebhookBuilder
65 | {
66 | $this->certificate = $certificate;
67 | return $this;
68 | }
69 |
70 | /**
71 | * @param int|null $maxConnections
72 | * @return SetWebhookBuilder
73 | */
74 | public function setMaxConnections(?int $maxConnections): SetWebhookBuilder
75 | {
76 | $this->maxConnections = $maxConnections;
77 | return $this;
78 | }
79 |
80 | public function addAllowedUpdate(string $type): SetWebhookBuilder
81 | {
82 | if (!in_array($type, self::TYPES, true)) {
83 | throw new \UnexpectedValueException('Wrong type');
84 | }
85 | if ($this->allowedUpdates === null) {
86 | $this->allowedUpdates = [];
87 | }
88 | $this->allowedUpdates[] = $type;
89 | return $this;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Keyboard/ArrayKeyboardButtonBuilder.php:
--------------------------------------------------------------------------------
1 | buttons[] = $inlineKeyboardButton;
22 | return $this;
23 | }
24 |
25 | /**
26 | * @return InlineKeyboardButton[]|KeyboardButton[]
27 | */
28 | public function build(): array
29 | {
30 | return $this->buttons;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Keyboard/InlineKeyboardMarkupBuilder.php:
--------------------------------------------------------------------------------
1 | arrayOfArrayInlineKeyboardButton[] = $arrayKeyboardButton;
14 | return $this;
15 | }
16 |
17 |
18 | public function build(): InlineKeyboardMarkup
19 | {
20 | return new InlineKeyboardMarkup(
21 | $this->arrayOfArrayInlineKeyboardButton
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Keyboard/KeyboardButtonBuilder.php:
--------------------------------------------------------------------------------
1 | text = $text;
29 | }
30 |
31 | /**
32 | * @return KeyboardButton
33 | */
34 | public function build(): KeyboardButton
35 | {
36 | return new KeyboardButton(
37 | $this->text,
38 | $this->requestContact,
39 | $this->requestLocation
40 | );
41 | }
42 |
43 | /**
44 | * @param bool|null $requestContact
45 | * @return KeyboardButtonBuilder
46 | */
47 | public function setRequestContact(?bool $requestContact): KeyboardButtonBuilder
48 | {
49 | $this->requestContact = $requestContact;
50 | return $this;
51 | }
52 |
53 | /**
54 | * @param bool|null $requestLocation
55 | * @return KeyboardButtonBuilder
56 | */
57 | public function setRequestLocation(?bool $requestLocation): KeyboardButtonBuilder
58 | {
59 | $this->requestLocation = $requestLocation;
60 | return $this;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Keyboard/ReplyKeyboardMarkupBuilder.php:
--------------------------------------------------------------------------------
1 | keyboard[] = $arrayKeyboardButton;
35 | return $this;
36 | }
37 |
38 | /**
39 | * @param bool|null $resizeKeyboard
40 | */
41 | public function setResizeKeyboard(?bool $resizeKeyboard): void
42 | {
43 | $this->resizeKeyboard = $resizeKeyboard;
44 | }
45 |
46 | /**
47 | * @param bool|null $oneTimeKeyboard
48 | */
49 | public function setOneTimeKeyboard(?bool $oneTimeKeyboard): void
50 | {
51 | $this->oneTimeKeyboard = $oneTimeKeyboard;
52 | }
53 |
54 | /**
55 | * @param bool|null $selective
56 | */
57 | public function setSelective(?bool $selective): void
58 | {
59 | $this->selective = $selective;
60 | }
61 |
62 | public function build(): ReplyKeyboardMarkup
63 | {
64 | return new ReplyKeyboardMarkup(
65 | $this->keyboard,
66 | $this->resizeKeyboard,
67 | $this->oneTimeKeyboard,
68 | $this->selective
69 | );
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Keyboard/ReplyKeyboardRemoveBuilder.php:
--------------------------------------------------------------------------------
1 | selective = $selective;
21 | return $this;
22 | }
23 |
24 | public function build(): ReplyKeyboardRemove
25 | {
26 | return new ReplyKeyboardRemove(true, false);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Type/InputMediaPhotoBuilder.php:
--------------------------------------------------------------------------------
1 | media = $media;
33 | }
34 |
35 | public function build(): InputMediaPhoto
36 | {
37 | return new InputMediaPhoto(
38 | $this->type,
39 | $this->media,
40 | $this->caption,
41 | $this->parseMode
42 | );
43 | }
44 |
45 | /**
46 | * @param string|null $caption
47 | * @return InputMediaPhotoBuilder
48 | */
49 | public function setCaption(?string $caption): InputMediaPhotoBuilder
50 | {
51 | $this->caption = $caption;
52 | return $this;
53 | }
54 |
55 | /**
56 | * @param string|null $parseMode
57 | * @return InputMediaPhotoBuilder
58 | */
59 | public function setParseMode(?string $parseMode): InputMediaPhotoBuilder
60 | {
61 | $this->parseMode = $parseMode;
62 | return $this;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Builder/Type/InputMediaVideoBuilder.php:
--------------------------------------------------------------------------------
1 | media = $media;
53 | }
54 |
55 | public function build(): InputMediaVideo
56 | {
57 | return new InputMediaVideo(
58 | $this->type,
59 | $this->media,
60 | $this->thumb,
61 | $this->caption,
62 | $this->parseMode,
63 | $this->width,
64 | $this->height,
65 | $this->duration,
66 | $this->supportsStreaming
67 | );
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Config.php:
--------------------------------------------------------------------------------
1 | key = $key;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getUrl(): string
34 | {
35 | return $this->host . 'bot' . $this->key . '/';
36 | }
37 |
38 | /**
39 | * @return string|null
40 | */
41 | public function getProxy(): ?string
42 | {
43 | return $this->proxy;
44 | }
45 |
46 | /**
47 | * @param string|null $proxy
48 | * @return Config
49 | */
50 | public function setProxy(?string $proxy): Config
51 | {
52 | $this->proxy = $proxy;
53 | return $this;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Constant/ChatAction.php:
--------------------------------------------------------------------------------
1 | callbackQueryId = $callbackQueryId;
52 | $this->text = $text;
53 | $this->showAlert = $showAlert;
54 | $this->url = $url;
55 | $this->cacheTime = $cacheTime;
56 | }
57 |
58 | /**
59 | * @return string
60 | */
61 | public function getCallbackQueryId(): string
62 | {
63 | return $this->callbackQueryId;
64 | }
65 |
66 | /**
67 | * @return string|null
68 | */
69 | public function getText(): ?string
70 | {
71 | return $this->text;
72 | }
73 |
74 | /**
75 | * @return bool|null
76 | */
77 | public function getShowAlert(): ?bool
78 | {
79 | return $this->showAlert;
80 | }
81 |
82 | /**
83 | * @return string|null
84 | */
85 | public function getUrl(): ?string
86 | {
87 | return $this->url;
88 | }
89 |
90 | /**
91 | * @return int|null
92 | */
93 | public function getCacheTime(): ?int
94 | {
95 | return $this->cacheTime;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/DeleteChatPhoto.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/DeleteChatStickerSet.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/EditMessageLiveLocation.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
66 | $this->messageId = $messageId;
67 | $this->inlineMessageId = $inlineMessageId;
68 | $this->latitude = $latitude;
69 | $this->longitude = $longitude;
70 | $this->replyMarkup = $replyMarkup;
71 | }
72 |
73 | /**
74 | * @return string|null
75 | */
76 | public function getChatId(): ?string
77 | {
78 | return $this->chatId;
79 | }
80 |
81 | /**
82 | * @return int|null
83 | */
84 | public function getMessageId(): ?int
85 | {
86 | return $this->messageId;
87 | }
88 |
89 | /**
90 | * @return string|null
91 | */
92 | public function getInlineMessageId(): ?string
93 | {
94 | return $this->inlineMessageId;
95 | }
96 |
97 | /**
98 | * @return float
99 | */
100 | public function getLatitude(): float
101 | {
102 | return $this->latitude;
103 | }
104 |
105 | /**
106 | * @return float
107 | */
108 | public function getLongitude(): float
109 | {
110 | return $this->longitude;
111 | }
112 |
113 | /**
114 | * @return InlineKeyboardMarkup|null
115 | */
116 | public function getReplyMarkup(): ?InlineKeyboardMarkup
117 | {
118 | return $this->replyMarkup;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/ExportChatInviteLink.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/ForwardMessage.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
46 | $this->fromChatId = $fromChatId;
47 | $this->disableNotification = $disableNotification;
48 | $this->messageId = $messageId;
49 | }
50 |
51 | /**
52 | * @return string
53 | */
54 | public function getChatId(): string
55 | {
56 | return $this->chatId;
57 | }
58 |
59 | /**
60 | * @return string
61 | */
62 | public function getFromChatId(): string
63 | {
64 | return $this->fromChatId;
65 | }
66 |
67 | /**
68 | * @return bool|null
69 | */
70 | public function getDisableNotification(): ?bool
71 | {
72 | return $this->disableNotification;
73 | }
74 |
75 | /**
76 | * @return int
77 | */
78 | public function getMessageId(): int
79 | {
80 | return $this->messageId;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/GetChat.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/GetChatAdministrators.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/GetChatMembersCount.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/GetFile.php:
--------------------------------------------------------------------------------
1 | fileId = $fileId;
22 | }
23 |
24 | /**
25 | * @return string
26 | */
27 | public function getFileId(): string
28 | {
29 | return $this->fileId;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/GetUserProfilePhotos.php:
--------------------------------------------------------------------------------
1 | userId = $userId;
40 | $this->offset = $offset;
41 | $this->limit = $limit;
42 | }
43 |
44 | /**
45 | * @return int
46 | */
47 | public function getUserId(): int
48 | {
49 | return $this->userId;
50 | }
51 |
52 | /**
53 | * @return int|null
54 | */
55 | public function getOffset(): ?int
56 | {
57 | return $this->offset;
58 | }
59 |
60 | /**
61 | * @return int|null
62 | */
63 | public function getLimit(): ?int
64 | {
65 | return $this->limit;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/KickChatMember.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
40 | $this->userId = $userId;
41 | $this->untilDate = $untilDate;
42 | }
43 |
44 | /**
45 | * @return string
46 | */
47 | public function getChatId(): string
48 | {
49 | return $this->chatId;
50 | }
51 |
52 | /**
53 | * @return int
54 | */
55 | public function getUserId(): int
56 | {
57 | return $this->userId;
58 | }
59 |
60 | /**
61 | * @return int|null
62 | */
63 | public function getUntilDate(): ?int
64 | {
65 | return $this->untilDate;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/LeaveChat.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
29 | }
30 |
31 | /**
32 | * @return string
33 | */
34 | public function getChatId(): string
35 | {
36 | return $this->chatId;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/PinChatMessage.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
40 | $this->messageId = $messageId;
41 | $this->disableNotification = $disableNotification;
42 | }
43 |
44 | /**
45 | * @return string
46 | */
47 | public function getChatId(): string
48 | {
49 | return $this->chatId;
50 | }
51 |
52 | /**
53 | * @return int
54 | */
55 | public function getMessageId(): int
56 | {
57 | return $this->messageId;
58 | }
59 |
60 | /**
61 | * @return bool|null
62 | */
63 | public function getDisableNotification(): ?bool
64 | {
65 | return $this->disableNotification;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/RestrictChatMember.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
47 | $this->userId = $userId;
48 | $this->permissions = $permissions;
49 | $this->untilDate = $untilDate;
50 | }
51 |
52 | /**
53 | * @return string
54 | */
55 | public function getChatId(): string
56 | {
57 | return $this->chatId;
58 | }
59 |
60 | /**
61 | * @return int
62 | */
63 | public function getUserId(): int
64 | {
65 | return $this->userId;
66 | }
67 |
68 | /**
69 | * @return ChatPermissions
70 | */
71 | public function getPermissions(): ChatPermissions
72 | {
73 | return $this->permissions;
74 | }
75 |
76 | /**
77 | * @return int|null
78 | */
79 | public function getUntilDate(): ?int
80 | {
81 | return $this->untilDate;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SendChatAction.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | $this->action = $action;
29 | }
30 |
31 | /**
32 | * @return string
33 | */
34 | public function getChatId(): string
35 | {
36 | return $this->chatId;
37 | }
38 |
39 | /**
40 | * @return string
41 | */
42 | public function getAction(): string
43 | {
44 | return $this->action;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SendMediaGroup.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
49 | $this->media = $media;
50 | $this->disableNotification = $disableNotification;
51 | $this->replyToMessageId = $replyToMessageId;
52 | }
53 |
54 | /**
55 | * @return string
56 | */
57 | public function getChatId(): string
58 | {
59 | return $this->chatId;
60 | }
61 |
62 | /**
63 | * @return InputMediaPhoto[]|InputMediaVideo[]
64 | */
65 | public function getMedia()
66 | {
67 | return $this->media;
68 | }
69 |
70 | /**
71 | * @return bool|null
72 | */
73 | public function getDisableNotification(): ?bool
74 | {
75 | return $this->disableNotification;
76 | }
77 |
78 | /**
79 | * @return int|null
80 | */
81 | public function getReplyToMessageId(): ?int
82 | {
83 | return $this->replyToMessageId;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SendPhoto.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
75 | $this->photo = $photo;
76 | $this->caption = $caption;
77 | $this->parseMode = $parseMode;
78 | $this->disableNotification = $disableNotification;
79 | $this->replyToMessageId = $replyToMessageId;
80 | $this->replyMarkup = $replyMarkup;
81 | }
82 |
83 | /**
84 | * @return string
85 | */
86 | public function getChatId(): string
87 | {
88 | return $this->chatId;
89 | }
90 |
91 | /**
92 | * @return resource|string
93 | */
94 | public function getPhoto()
95 | {
96 | return $this->photo;
97 | }
98 |
99 | /**
100 | * @return string|null
101 | */
102 | public function getCaption(): ?string
103 | {
104 | return $this->caption;
105 | }
106 |
107 | /**
108 | * @return string|null
109 | */
110 | public function getParseMode(): ?string
111 | {
112 | return $this->parseMode;
113 | }
114 |
115 | /**
116 | * @return bool|null
117 | */
118 | public function getDisableNotification(): ?bool
119 | {
120 | return $this->disableNotification;
121 | }
122 |
123 | /**
124 | * @return int|null
125 | */
126 | public function getReplyToMessageId(): ?int
127 | {
128 | return $this->replyToMessageId;
129 | }
130 |
131 | /**
132 | * @return ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null
133 | */
134 | public function getReplyMarkup()
135 | {
136 | return $this->replyMarkup;
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SendPoll.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
63 | $this->question = $question;
64 | $this->options = $options;
65 | $this->disableNotification = $disableNotification;
66 | $this->replyToMessageId = $replyToMessageId;
67 | $this->replyMarkup = $replyMarkup;
68 | }
69 |
70 | /**
71 | * @return string
72 | */
73 | public function getChatId(): string
74 | {
75 | return $this->chatId;
76 | }
77 |
78 | /**
79 | * @return string
80 | */
81 | public function getQuestion(): string
82 | {
83 | return $this->question;
84 | }
85 |
86 | /**
87 | * @return string[]
88 | */
89 | public function getOptions(): array
90 | {
91 | return $this->options;
92 | }
93 |
94 | /**
95 | * @return bool|null
96 | */
97 | public function getDisableNotification(): ?bool
98 | {
99 | return $this->disableNotification;
100 | }
101 |
102 | /**
103 | * @return int|null
104 | */
105 | public function getReplyToMessageId(): ?int
106 | {
107 | return $this->replyToMessageId;
108 | }
109 |
110 | /**
111 | * @return ForceReply|InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|null
112 | */
113 | public function getReplyMarkup()
114 | {
115 | return $this->replyMarkup;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SetChatDescription.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
34 | $this->description = $description;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getChatId(): string
41 | {
42 | return $this->chatId;
43 | }
44 |
45 | /**
46 | * @return string|null
47 | */
48 | public function getDescription(): ?string
49 | {
50 | return $this->description;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SetChatPermissions.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
35 | $this->permissions = $permissions;
36 | }
37 |
38 | /**
39 | * @return string
40 | */
41 | public function getChatId(): string
42 | {
43 | return $this->chatId;
44 | }
45 |
46 | /**
47 | * @return ChatPermissions
48 | */
49 | public function getPermissions(): ChatPermissions
50 | {
51 | return $this->permissions;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SetChatPhoto.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
35 | $this->photo = $photo;
36 | }
37 |
38 | /**
39 | * @return string
40 | */
41 | public function getChatId(): string
42 | {
43 | return $this->chatId;
44 | }
45 |
46 | /**
47 | * @return resource|string
48 | */
49 | public function getPhoto()
50 | {
51 | return $this->photo;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SetChatStickerSet.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
34 | $this->stickerSetName = $stickerSetName;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getChatId(): string
41 | {
42 | return $this->chatId;
43 | }
44 |
45 | /**
46 | * @return string
47 | */
48 | public function getStickerSetName(): string
49 | {
50 | return $this->stickerSetName;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/SetChatTitle.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
34 | $this->title = $title;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getChatId(): string
41 | {
42 | return $this->chatId;
43 | }
44 |
45 | /**
46 | * @return string
47 | */
48 | public function getTitle(): string
49 | {
50 | return $this->title;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/StopMessageLiveLocation.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
52 | $this->messageId = $messageId;
53 | $this->inlineMessageId = $inlineMessageId;
54 | $this->replyMarkup = $replyMarkup;
55 | }
56 |
57 | /**
58 | * @return string|null
59 | */
60 | public function getChatId(): ?string
61 | {
62 | return $this->chatId;
63 | }
64 |
65 | /**
66 | * @return int|null
67 | */
68 | public function getMessageId(): ?int
69 | {
70 | return $this->messageId;
71 | }
72 |
73 | /**
74 | * @return string|null
75 | */
76 | public function getInlineMessageId(): ?string
77 | {
78 | return $this->inlineMessageId;
79 | }
80 |
81 | /**
82 | * @return InlineKeyboardMarkup|null
83 | */
84 | public function getReplyMarkup(): ?InlineKeyboardMarkup
85 | {
86 | return $this->replyMarkup;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/UnbanChatMember.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
34 | $this->userId = $userId;
35 | }
36 |
37 | /**
38 | * @return string
39 | */
40 | public function getChatId(): string
41 | {
42 | return $this->chatId;
43 | }
44 |
45 | /**
46 | * @return int
47 | */
48 | public function getUserId(): int
49 | {
50 | return $this->userId;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/UnpinChatMessage.php:
--------------------------------------------------------------------------------
1 | chatId = $chatId;
28 | }
29 |
30 | /**
31 | * @return string
32 | */
33 | public function getChatId(): string
34 | {
35 | return $this->chatId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Action/Webhook/SetWebhook.php:
--------------------------------------------------------------------------------
1 | ")
35 | */
36 | private $allowedUpdates;
37 |
38 | /**
39 | * SetWebhook constructor.
40 | * @param string $url
41 | * @param string $certificate
42 | * @param int|null $maxConnections
43 | * @param array|null $allowedUpdates
44 | */
45 | public function __construct(string $url, string $certificate, ?int $maxConnections, ?array $allowedUpdates)
46 | {
47 | $this->url = $url;
48 | $this->certificate = $certificate;
49 | $this->maxConnections = $maxConnections;
50 | $this->allowedUpdates = $allowedUpdates;
51 | }
52 |
53 | /**
54 | * @return string
55 | */
56 | public function getUrl(): string
57 | {
58 | return $this->url;
59 | }
60 |
61 | /**
62 | * @return string
63 | */
64 | public function getCertificate(): string
65 | {
66 | return $this->certificate;
67 | }
68 |
69 | /**
70 | * @return int|null
71 | */
72 | public function getMaxConnections(): ?int
73 | {
74 | return $this->maxConnections;
75 | }
76 |
77 | /**
78 | * @return array|null
79 | */
80 | public function getAllowedUpdates(): ?array
81 | {
82 | return $this->allowedUpdates;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Keyboard/InlineKeyboardMarkup.php:
--------------------------------------------------------------------------------
1 | >")
17 | */
18 | private $inlineKeyboard;
19 |
20 | /**
21 | * InlineKeyboardMarkup constructor.
22 | * @param $inlineKeyboard
23 | */
24 | public function __construct(array $inlineKeyboard)
25 | {
26 | $this->inlineKeyboard = $inlineKeyboard;
27 | }
28 |
29 | /**
30 | * @return InlineKeyboardButton[][]
31 | */
32 | public function getInlineKeyboard(): array
33 | {
34 | return $this->inlineKeyboard;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Keyboard/KeyboardButton.php:
--------------------------------------------------------------------------------
1 | text = $text;
34 | $this->requestContact = $requestContact;
35 | $this->requestLocation = $requestLocation;
36 | }
37 |
38 | /**
39 | * @return string
40 | */
41 | public function getText(): string
42 | {
43 | return $this->text;
44 | }
45 |
46 | /**
47 | * @return bool|null
48 | */
49 | public function getRequestContact(): ?bool
50 | {
51 | return $this->requestContact;
52 | }
53 |
54 | /**
55 | * @return bool|null
56 | */
57 | public function getRequestLocation(): ?bool
58 | {
59 | return $this->requestLocation;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Keyboard/ReplyKeyboardMarkup.php:
--------------------------------------------------------------------------------
1 | keyboard = $keyboard;
34 | $this->resizeKeyboard = $resizeKeyboard;
35 | $this->oneTimeKeyboard = $oneTimeKeyboard;
36 | $this->selective = $selective;
37 | }
38 |
39 | /**
40 | * @return array
41 | */
42 | public function getKeyboard(): array
43 | {
44 | return $this->keyboard;
45 | }
46 |
47 | /**
48 | * @return bool|null
49 | */
50 | public function getResizeKeyboard(): ?bool
51 | {
52 | return $this->resizeKeyboard;
53 | }
54 |
55 | /**
56 | * @return bool|null
57 | */
58 | public function getOneTimeKeyboard(): ?bool
59 | {
60 | return $this->oneTimeKeyboard;
61 | }
62 |
63 | /**
64 | * @return bool|null
65 | */
66 | public function getSelective(): ?bool
67 | {
68 | return $this->selective;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Keyboard/ReplyKeyboardRemove.php:
--------------------------------------------------------------------------------
1 | removeKeyboard = $removeKeyboard;
24 | $this->selective = $selective;
25 | }
26 |
27 | /**
28 | * @return bool
29 | */
30 | public function isRemoveKeyboard(): bool
31 | {
32 | return $this->removeKeyboard;
33 | }
34 |
35 | /**
36 | * @return bool|null
37 | */
38 | public function getSelective(): ?bool
39 | {
40 | return $this->selective;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/ChatInviteLinkResponse.php:
--------------------------------------------------------------------------------
1 | ok;
26 | }
27 |
28 | /**
29 | * @return string
30 | */
31 | public function getResult(): string
32 | {
33 | return $this->result;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/Error.php:
--------------------------------------------------------------------------------
1 | ok;
31 | }
32 |
33 | /**
34 | * @return int
35 | */
36 | public function getErrorCode(): int
37 | {
38 | return $this->errorCode;
39 | }
40 |
41 | /**
42 | * @return string
43 | */
44 | public function getDescription(): string
45 | {
46 | return $this->description;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetChatAdministratorsResponse.php:
--------------------------------------------------------------------------------
1 | ")
18 | */
19 | private $result;
20 |
21 | /**
22 | * @return bool
23 | */
24 | public function isOk(): bool
25 | {
26 | return $this->ok;
27 | }
28 |
29 | /**
30 | * @return ChatMember[]
31 | */
32 | public function getResult(): array
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetChatResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return Chat
31 | */
32 | public function getResult(): Chat
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetFileResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return File
31 | */
32 | public function getResult(): File
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetMeResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return User
31 | */
32 | public function getResult(): User
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetUserProfilePhotosResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return UserProfilePhotos
31 | */
32 | public function getResult(): UserProfilePhotos
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/GetWebhookInfoResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return WebhookInfo
31 | */
32 | public function getResult(): WebhookInfo
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/IntResultResponse.php:
--------------------------------------------------------------------------------
1 | ok;
26 | }
27 |
28 | /**
29 | * @return int
30 | */
31 | public function getResult(): int
32 | {
33 | return $this->result;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/Response.php:
--------------------------------------------------------------------------------
1 | ")
18 | */
19 | private $result;
20 |
21 | /**
22 | * @return bool
23 | */
24 | public function isOk(): bool
25 | {
26 | return $this->ok;
27 | }
28 |
29 | /**
30 | * @return Update[]
31 | */
32 | public function getResult(): array
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/SendMediaGroupResponse.php:
--------------------------------------------------------------------------------
1 | ")
18 | */
19 | private $result;
20 |
21 | /**
22 | * @return bool
23 | */
24 | public function isOk(): bool
25 | {
26 | return $this->ok;
27 | }
28 |
29 | /**
30 | * @return Message[]
31 | */
32 | public function getResult(): array
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/SendMessageResponse.php:
--------------------------------------------------------------------------------
1 | ok;
27 | }
28 |
29 | /**
30 | * @return Message
31 | */
32 | public function getResult(): Message
33 | {
34 | return $this->result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Response/SimpleResponse.php:
--------------------------------------------------------------------------------
1 | ok;
26 | }
27 |
28 | /**
29 | * @return bool
30 | */
31 | public function isResult(): bool
32 | {
33 | return $this->result;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Animation.php:
--------------------------------------------------------------------------------
1 | fileId;
61 | }
62 |
63 | /**
64 | * @return int
65 | */
66 | public function getWidth(): int
67 | {
68 | return $this->width;
69 | }
70 |
71 | /**
72 | * @return int
73 | */
74 | public function getHeight(): int
75 | {
76 | return $this->height;
77 | }
78 |
79 | /**
80 | * @return int
81 | */
82 | public function getDuration(): int
83 | {
84 | return $this->duration;
85 | }
86 |
87 | /**
88 | * @return PhotoSize|null
89 | */
90 | public function getThumb(): ?PhotoSize
91 | {
92 | return $this->thumb;
93 | }
94 |
95 | /**
96 | * @return string|null
97 | */
98 | public function getFileName(): ?string
99 | {
100 | return $this->fileName;
101 | }
102 |
103 | /**
104 | * @return string|null
105 | */
106 | public function getMimeType(): ?string
107 | {
108 | return $this->mimeType;
109 | }
110 |
111 | /**
112 | * @return int|null
113 | */
114 | public function getFileSize(): ?int
115 | {
116 | return $this->fileSize;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Audio.php:
--------------------------------------------------------------------------------
1 | fileId;
56 | }
57 |
58 | /**
59 | * @return int
60 | */
61 | public function getDuration(): int
62 | {
63 | return $this->duration;
64 | }
65 |
66 | /**
67 | * @return string|null
68 | */
69 | public function getPerformer(): ?string
70 | {
71 | return $this->performer;
72 | }
73 |
74 | /**
75 | * @return string|null
76 | */
77 | public function getTitle(): ?string
78 | {
79 | return $this->title;
80 | }
81 |
82 | /**
83 | * @return string|null
84 | */
85 | public function getMimeType(): ?string
86 | {
87 | return $this->mimeType;
88 | }
89 |
90 | /**
91 | * @return int|null
92 | */
93 | public function getFileSize(): ?int
94 | {
95 | return $this->fileSize;
96 | }
97 |
98 | /**
99 | * @return PhotoSize|null
100 | */
101 | public function getThumb(): ?PhotoSize
102 | {
103 | return $this->thumb;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/CallbackGame.php:
--------------------------------------------------------------------------------
1 | smallFileId;
26 | }
27 |
28 | /**
29 | * @return string
30 | */
31 | public function getBigFileId(): string
32 | {
33 | return $this->bigFileId;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Contact.php:
--------------------------------------------------------------------------------
1 | phoneNumber;
46 | }
47 |
48 | /**
49 | * @return string
50 | */
51 | public function getFirstName(): string
52 | {
53 | return $this->firstName;
54 | }
55 |
56 | /**
57 | * @return string|null
58 | */
59 | public function getLastName(): ?string
60 | {
61 | return $this->lastName;
62 | }
63 |
64 | /**
65 | * @return int|null
66 | */
67 | public function getUserId(): ?int
68 | {
69 | return $this->userId;
70 | }
71 |
72 | /**
73 | * @return string|null
74 | */
75 | public function getVcard(): ?string
76 | {
77 | return $this->vcard;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Document.php:
--------------------------------------------------------------------------------
1 | fileId;
46 | }
47 |
48 | /**
49 | * @return PhotoSize|null
50 | */
51 | public function getThumb(): ?PhotoSize
52 | {
53 | return $this->thumb;
54 | }
55 |
56 | /**
57 | * @return string|null
58 | */
59 | public function getFileName(): ?string
60 | {
61 | return $this->fileName;
62 | }
63 |
64 | /**
65 | * @return string|null
66 | */
67 | public function getMimeType(): ?string
68 | {
69 | return $this->mimeType;
70 | }
71 |
72 | /**
73 | * @return string|null
74 | */
75 | public function getFileSize(): ?string
76 | {
77 | return $this->fileSize;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/File.php:
--------------------------------------------------------------------------------
1 | fileId;
37 | }
38 |
39 | /**
40 | * @return int|null
41 | */
42 | public function getFileSize(): ?int
43 | {
44 | return $this->fileSize;
45 | }
46 |
47 | /**
48 | * @return string|null
49 | */
50 | public function getFilePath(): ?string
51 | {
52 | return $this->filePath;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/ForceReply.php:
--------------------------------------------------------------------------------
1 | forceReply;
31 | }
32 |
33 | /**
34 | * @return bool|null
35 | */
36 | public function getSelective(): ?bool
37 | {
38 | return $this->selective;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Game.php:
--------------------------------------------------------------------------------
1 | ")
27 | */
28 | private $photo;
29 | /**
30 | * @var string|null
31 | * @Type("string")
32 | */
33 | private $text;
34 | /**
35 | * @var MessageEntity[]|null
36 | * @Type("array")
37 | */
38 | private $textEntities;
39 | /**
40 | * @var Animation|null
41 | * @Type("SimpleTelegramBotClient\Dto\Type\Animation")
42 | */
43 | private $animation;
44 |
45 | /**
46 | * @return string
47 | */
48 | public function getTitle(): string
49 | {
50 | return $this->title;
51 | }
52 |
53 | /**
54 | * @return string
55 | */
56 | public function getDescription(): string
57 | {
58 | return $this->description;
59 | }
60 |
61 | /**
62 | * @return PhotoSize[]
63 | */
64 | public function getPhoto(): array
65 | {
66 | return $this->photo;
67 | }
68 |
69 | /**
70 | * @return string|null
71 | */
72 | public function getText(): ?string
73 | {
74 | return $this->text;
75 | }
76 |
77 | /**
78 | * @return MessageEntity[]|null
79 | */
80 | public function getTextEntities(): ?array
81 | {
82 | return $this->textEntities;
83 | }
84 |
85 | /**
86 | * @return Animation|null
87 | */
88 | public function getAnimation(): ?Animation
89 | {
90 | return $this->animation;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/InputMediaPhoto.php:
--------------------------------------------------------------------------------
1 | type = $type;
46 | $this->media = $media;
47 | $this->caption = $caption;
48 | $this->parseMode = $parseMode;
49 | }
50 |
51 | /**
52 | * @return string
53 | */
54 | public function getType(): string
55 | {
56 | return $this->type;
57 | }
58 |
59 | /**
60 | * @return string
61 | */
62 | public function getMedia(): string
63 | {
64 | return $this->media;
65 | }
66 |
67 | /**
68 | * @return string|null
69 | */
70 | public function getCaption(): ?string
71 | {
72 | return $this->caption;
73 | }
74 |
75 | /**
76 | * @return string|null
77 | */
78 | public function getParseMode(): ?string
79 | {
80 | return $this->parseMode;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Invoice.php:
--------------------------------------------------------------------------------
1 | title;
46 | }
47 |
48 | /**
49 | * @return string
50 | */
51 | public function getDescription(): string
52 | {
53 | return $this->description;
54 | }
55 |
56 | /**
57 | * @return string
58 | */
59 | public function getStartParameter(): string
60 | {
61 | return $this->startParameter;
62 | }
63 |
64 | /**
65 | * @return string
66 | */
67 | public function getCurrency(): string
68 | {
69 | return $this->currency;
70 | }
71 |
72 | /**
73 | * @return int
74 | */
75 | public function getTotalAmount(): int
76 | {
77 | return $this->totalAmount;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Location.php:
--------------------------------------------------------------------------------
1 | longitude;
31 | }
32 |
33 | /**
34 | * @return float
35 | */
36 | public function getLatitude(): float
37 | {
38 | return $this->latitude;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/LoginUrl.php:
--------------------------------------------------------------------------------
1 | url;
36 | }
37 |
38 | /**
39 | * @return string|null
40 | */
41 | public function getForwardText(): ?string
42 | {
43 | return $this->forwardText;
44 | }
45 |
46 | /**
47 | * @return string|null
48 | */
49 | public function getBotUsername(): ?string
50 | {
51 | return $this->botUsername;
52 | }
53 |
54 | /**
55 | * @return bool|null
56 | */
57 | public function getRequestWriteAccess(): ?bool
58 | {
59 | return $this->requestWriteAccess;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/MaskPosition.php:
--------------------------------------------------------------------------------
1 | point;
41 | }
42 |
43 | /**
44 | * @return float
45 | */
46 | public function getXShift(): float
47 | {
48 | return $this->xShift;
49 | }
50 |
51 | /**
52 | * @return float
53 | */
54 | public function getYShift(): float
55 | {
56 | return $this->yShift;
57 | }
58 |
59 | /**
60 | * @return float
61 | */
62 | public function getScale(): float
63 | {
64 | return $this->scale;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/MessageEntity.php:
--------------------------------------------------------------------------------
1 | length;
46 | }
47 |
48 | /**
49 | * @return int
50 | */
51 | public function getOffset(): int
52 | {
53 | return $this->offset;
54 | }
55 |
56 | /**
57 | * @return string
58 | */
59 | public function getType(): string
60 | {
61 | return $this->type;
62 | }
63 |
64 | /**
65 | * @return string|null
66 | */
67 | public function getUrl(): ?string
68 | {
69 | return $this->url;
70 | }
71 |
72 | /**
73 | * @return User|null
74 | */
75 | public function getUser(): ?User
76 | {
77 | return $this->user;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/PassportData.php:
--------------------------------------------------------------------------------
1 | fileId;
41 | }
42 |
43 | /**
44 | * @return int
45 | */
46 | public function getWidth(): int
47 | {
48 | return $this->width;
49 | }
50 |
51 | /**
52 | * @return int
53 | */
54 | public function getHeight(): int
55 | {
56 | return $this->height;
57 | }
58 |
59 | /**
60 | * @return int
61 | */
62 | public function getFileSize(): int
63 | {
64 | return $this->fileSize;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Poll.php:
--------------------------------------------------------------------------------
1 | ")
27 | */
28 | private $options;
29 | /**
30 | * @var bool
31 | * @Type("bool")
32 | */
33 | private $isClosed;
34 |
35 | /**
36 | * @return string
37 | */
38 | public function getId(): string
39 | {
40 | return $this->id;
41 | }
42 |
43 | /**
44 | * @return string
45 | */
46 | public function getQuestion(): string
47 | {
48 | return $this->question;
49 | }
50 |
51 | /**
52 | * @return PollOption[]
53 | */
54 | public function getOptions(): array
55 | {
56 | return $this->options;
57 | }
58 |
59 | /**
60 | * @return bool
61 | */
62 | public function isClosed(): bool
63 | {
64 | return $this->isClosed;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/PollOption.php:
--------------------------------------------------------------------------------
1 | text;
32 | }
33 |
34 | /**
35 | * @return int
36 | */
37 | public function getVoterCount(): int
38 | {
39 | return $this->voterCount;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Sticker.php:
--------------------------------------------------------------------------------
1 | fileId;
61 | }
62 |
63 | /**
64 | * @return int
65 | */
66 | public function getWidth(): int
67 | {
68 | return $this->width;
69 | }
70 |
71 | /**
72 | * @return int
73 | */
74 | public function getHeight(): int
75 | {
76 | return $this->height;
77 | }
78 |
79 | /**
80 | * @return PhotoSize|null
81 | */
82 | public function getThumb(): ?PhotoSize
83 | {
84 | return $this->thumb;
85 | }
86 |
87 | /**
88 | * @return string|null
89 | */
90 | public function getEmoji(): ?string
91 | {
92 | return $this->emoji;
93 | }
94 |
95 | /**
96 | * @return string|null
97 | */
98 | public function getSetName(): ?string
99 | {
100 | return $this->setName;
101 | }
102 |
103 | /**
104 | * @return MaskPosition|null
105 | */
106 | public function getMaskPosition(): ?MaskPosition
107 | {
108 | return $this->maskPosition;
109 | }
110 |
111 | /**
112 | * @return int|null
113 | */
114 | public function getFileSize(): ?int
115 | {
116 | return $this->fileSize;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/SuccessfulPayment.php:
--------------------------------------------------------------------------------
1 | updateId;
76 | }
77 |
78 | /**
79 | * @return Message|null
80 | */
81 | public function getMessage(): ?Message
82 | {
83 | return $this->message;
84 | }
85 |
86 | /**
87 | * @return Message|null
88 | */
89 | public function getEditedMessage(): ?Message
90 | {
91 | return $this->editedMessage;
92 | }
93 |
94 | /**
95 | * @return Message|null
96 | */
97 | public function getChannelPost(): ?Message
98 | {
99 | return $this->channelPost;
100 | }
101 |
102 | /**
103 | * @return Message|null
104 | */
105 | public function getEditedChannelPost(): ?Message
106 | {
107 | return $this->editedChannelPost;
108 | }
109 |
110 | /**
111 | * @return Poll|null
112 | */
113 | public function getPoll(): ?Poll
114 | {
115 | return $this->poll;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/User.php:
--------------------------------------------------------------------------------
1 | id;
51 | }
52 |
53 | /**
54 | * @return bool
55 | */
56 | public function isBot(): bool
57 | {
58 | return $this->isBot;
59 | }
60 |
61 | /**
62 | * @return string
63 | */
64 | public function getFirstName(): string
65 | {
66 | return $this->firstName;
67 | }
68 |
69 | /**
70 | * @return string|null
71 | */
72 | public function getLastName(): ?string
73 | {
74 | return $this->lastName;
75 | }
76 |
77 | /**
78 | * @return string|null
79 | */
80 | public function getUsername(): ?string
81 | {
82 | return $this->username;
83 | }
84 |
85 | /**
86 | * @return string|null
87 | */
88 | public function getLanguageCode(): ?string
89 | {
90 | return $this->languageCode;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/UserProfilePhotos.php:
--------------------------------------------------------------------------------
1 | >")
23 | */
24 | private $photos;
25 |
26 | /**
27 | * @return int
28 | */
29 | public function getTotalCount(): int
30 | {
31 | return $this->totalCount;
32 | }
33 |
34 | /**
35 | * @return array
36 | */
37 | public function getPhotos(): array
38 | {
39 | return $this->photos;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Venue.php:
--------------------------------------------------------------------------------
1 | location;
46 | }
47 |
48 | /**
49 | * @return string
50 | */
51 | public function getTitle(): string
52 | {
53 | return $this->title;
54 | }
55 |
56 | /**
57 | * @return string
58 | */
59 | public function getAddress(): string
60 | {
61 | return $this->address;
62 | }
63 |
64 | /**
65 | * @return string|null
66 | */
67 | public function getFoursquareId(): ?string
68 | {
69 | return $this->foursquareId;
70 | }
71 |
72 | /**
73 | * @return string|null
74 | */
75 | public function getFoursquareType(): ?string
76 | {
77 | return $this->foursquareType;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Video.php:
--------------------------------------------------------------------------------
1 | fileId;
51 | }
52 |
53 | /**
54 | * @return int
55 | */
56 | public function getWidth(): int
57 | {
58 | return $this->width;
59 | }
60 |
61 | /**
62 | * @return int
63 | */
64 | public function getHeight(): int
65 | {
66 | return $this->height;
67 | }
68 |
69 | /**
70 | * @return PhotoSize|null
71 | */
72 | public function getThumb(): ?PhotoSize
73 | {
74 | return $this->thumb;
75 | }
76 |
77 | /**
78 | * @return string|null
79 | */
80 | public function getMimeType(): ?string
81 | {
82 | return $this->mimeType;
83 | }
84 |
85 | /**
86 | * @return int|null
87 | */
88 | public function getFileSize(): ?int
89 | {
90 | return $this->fileSize;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/VideoNote.php:
--------------------------------------------------------------------------------
1 | fileId;
46 | }
47 |
48 | /**
49 | * @return int
50 | */
51 | public function getLength(): int
52 | {
53 | return $this->length;
54 | }
55 |
56 | /**
57 | * @return int
58 | */
59 | public function getDuration(): int
60 | {
61 | return $this->duration;
62 | }
63 |
64 | /**
65 | * @return PhotoSize|null
66 | */
67 | public function getThumb(): ?PhotoSize
68 | {
69 | return $this->thumb;
70 | }
71 |
72 | /**
73 | * @return int|null
74 | */
75 | public function getFileSize(): ?int
76 | {
77 | return $this->fileSize;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/Voice.php:
--------------------------------------------------------------------------------
1 | fileId;
41 | }
42 |
43 | /**
44 | * @return int
45 | */
46 | public function getDuration(): int
47 | {
48 | return $this->duration;
49 | }
50 |
51 | /**
52 | * @return string|null
53 | */
54 | public function getMimeType(): ?string
55 | {
56 | return $this->mimeType;
57 | }
58 |
59 | /**
60 | * @return int|null
61 | */
62 | public function getFileSize(): ?int
63 | {
64 | return $this->fileSize;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Dto/Type/WebhookInfo.php:
--------------------------------------------------------------------------------
1 | ")
48 | */
49 | private $allowedUpdates;
50 |
51 | /**
52 | * @return string
53 | */
54 | public function getUrl(): string
55 | {
56 | return $this->url;
57 | }
58 |
59 | /**
60 | * @return bool
61 | */
62 | public function isHasCustomCertificate(): bool
63 | {
64 | return $this->hasCustomCertificate;
65 | }
66 |
67 | /**
68 | * @return int
69 | */
70 | public function getPendingUpdateCount(): int
71 | {
72 | return $this->pendingUpdateCount;
73 | }
74 |
75 | /**
76 | * @return int|null
77 | */
78 | public function getLastErrorDate(): ?int
79 | {
80 | return $this->lastErrorDate;
81 | }
82 |
83 | /**
84 | * @return string|null
85 | */
86 | public function getLastErrorMessage(): ?string
87 | {
88 | return $this->lastErrorMessage;
89 | }
90 |
91 | /**
92 | * @return int|null
93 | */
94 | public function getMaxConnections(): ?int
95 | {
96 | return $this->maxConnections;
97 | }
98 |
99 | /**
100 | * @return string[]|null
101 | */
102 | public function getAllowedUpdates(): ?array
103 | {
104 | return $this->allowedUpdates;
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/Exception/BadMethodCallException.php:
--------------------------------------------------------------------------------
1 | response = $response;
20 | }
21 |
22 | /**
23 | * @return Error|null
24 | */
25 | public function getResponse(): ?Error
26 | {
27 | return $this->response;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/SimpleTelegramBotClient/ResponseFactory.php:
--------------------------------------------------------------------------------
1 | build();
19 | $clientConfig = [
20 | 'timeout' => 30
21 | ];
22 | return new TelegramService($config, new Client($clientConfig), $serializer);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tests/resources/error.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": false,
3 | "error_code": 400,
4 | "description": "Bad Request: chat member status can't be changed in private chats"
5 | }
6 |
--------------------------------------------------------------------------------
/tests/resources/export_chat_invite_link.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": "url"
4 | }
5 |
--------------------------------------------------------------------------------
/tests/resources/get_chat.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "id": -1001003073997,
5 | "title": "\u0414\u0432\u0430\u0447",
6 | "username": "twochannel",
7 | "type": "supergroup",
8 | "description": "descr",
9 | "sticker_set_name": "twochannelsticker",
10 | "permissions": {
11 | "can_send_messages": true,
12 | "can_send_media_messages": true,
13 | "can_send_polls": true,
14 | "can_send_other_messages": true,
15 | "can_add_web_page_previews": true,
16 | "can_change_info": false,
17 | "can_invite_users": false,
18 | "can_pin_messages": false
19 | },
20 | "photo": {
21 | "small_file_id": "AQADBAATXfQhGwAEAgADMz6R7xb___-ij_HLc_Yejkv_AwABFgQ",
22 | "big_file_id": "AQADBAATXfQhGwAEAwADMz6R7xb___-ij_HLc_Yejk3_AwABFgQ"
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/resources/get_chat_administrators.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": [
4 | {
5 | "user": {
6 | "id": 547698289,
7 | "is_bot": false,
8 | "first_name": "aaaa",
9 | "username": "dddd"
10 | },
11 | "status": "administrator",
12 | "can_be_edited": false,
13 | "can_change_info": true,
14 | "can_delete_messages": true,
15 | "can_invite_users": true,
16 | "can_restrict_members": true,
17 | "can_pin_messages": true,
18 | "can_promote_members": false
19 | },
20 | {
21 | "user": {
22 | "id": 588967987,
23 | "is_bot": false,
24 | "first_name": "cccc",
25 | "username": "dddd"
26 | },
27 | "status": "administrator",
28 | "can_be_edited": false,
29 | "can_change_info": true,
30 | "can_delete_messages": true,
31 | "can_invite_users": true,
32 | "can_restrict_members": true,
33 | "can_pin_messages": true,
34 | "can_promote_members": false
35 | },
36 | {
37 | "user": {
38 | "id": 122876507,
39 | "is_bot": false,
40 | "first_name": "eeee",
41 | "last_name": "wwwww",
42 | "username": "qqqqq"
43 | },
44 | "status": "administrator",
45 | "can_be_edited": false,
46 | "can_change_info": true,
47 | "can_delete_messages": true,
48 | "can_invite_users": true,
49 | "can_restrict_members": true,
50 | "can_pin_messages": true,
51 | "can_promote_members": true
52 | },
53 | {
54 | "user": {
55 | "id": 3115326,
56 | "is_bot": false,
57 | "first_name": "Nariman",
58 | "last_name": "Abu",
59 | "username": "abunya"
60 | },
61 | "status": "creator"
62 | }
63 | ]
64 | }
65 |
--------------------------------------------------------------------------------
/tests/resources/get_file.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "file_id": "AgADAgADAqgxG-W8dQXkhnSrMjWwg-mimg4ABAEAAwIAA2EAAwN6AAIWBA",
5 | "file_size": 9855,
6 | "file_path": "photos/file_0.jpg"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/tests/resources/get_me.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "id": 31231,
5 | "is_bot": true,
6 | "first_name": "asdasd",
7 | "username": "fdafads"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/tests/resources/get_updates.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok":true,
3 | "result":[
4 | {
5 | "update_id":789380994,
6 | "message":{
7 | "message_id":234,
8 | "from":{
9 | "id":165068132,
10 | "is_bot":false,
11 | "first_name":"testname",
12 | "last_name":"testname2",
13 | "username":"username",
14 | "language_code":"ru"
15 | },
16 | "chat":{
17 | "id":165068132,
18 | "first_name":"test",
19 | "last_name":"test",
20 | "username":"test",
21 | "type":"private"
22 | },
23 | "date":1564811052,
24 | "text":"test"
25 | }
26 | }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/tests/resources/get_user_profile_photos.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "total_count": 1,
5 | "photos": [
6 | [
7 | {
8 | "file_id": "AgADAgADAqgxG-W8dQXkhnSrMjWwg-mimg4ABAEAAwIAA2EAAwN6AAIWBA",
9 | "file_size": 9855,
10 | "width": 160,
11 | "height": 160
12 | },
13 | {
14 | "file_id": "AgADAgADAqgxG-W8dQXkhnSrMjWwg-mimg4ABAEAAwIAA2IAAwR6AAIWBA",
15 | "file_size": 36315,
16 | "width": 320,
17 | "height": 320
18 | },
19 | {
20 | "file_id": "AgADAgADAqgxG-W8dQXkhnSrMjWwg-mimg4ABAEAAwIAA2MAAwV6AAIWBA",
21 | "file_size": 138573,
22 | "width": 640,
23 | "height": 640
24 | }
25 | ]
26 | ]
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/resources/get_webhook_info.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "url": "",
5 | "has_custom_certificate": false,
6 | "pending_update_count": 7
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/tests/resources/int_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": 7319
4 | }
5 |
--------------------------------------------------------------------------------
/tests/resources/send_contact.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 304,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1566315483,
19 | "contact": {
20 | "phone_number": "123123123",
21 | "first_name": "TestName"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tests/resources/send_location.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 244,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1565009385,
19 | "location": {
20 | "latitude": 0.999997,
21 | "longitude": 2.233401
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tests/resources/send_media_group.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": [
4 | {
5 | "message_id": 289,
6 | "from": {
7 | "id": 780995632,
8 | "is_bot": true,
9 | "first_name": "BotStory",
10 | "username": "TellMeTheStoryBot"
11 | },
12 | "chat": {
13 | "id": 165068132,
14 | "first_name": "Stepan",
15 | "last_name": "Franchuk",
16 | "username": "fstepa",
17 | "type": "private"
18 | },
19 | "date": 1565531386,
20 | "video": {
21 | "duration": 0,
22 | "width": 240,
23 | "height": 240,
24 | "mime_type": "video/mp4",
25 | "file_id": "BAADAgADtAIAAk78gUq7BhANg6k_xBYE",
26 | "file_size": 29878668
27 | }
28 | },
29 | {
30 | "message_id": 290,
31 | "from": {
32 | "id": 780995632,
33 | "is_bot": true,
34 | "first_name": "BotStory",
35 | "username": "TellMeTheStoryBot"
36 | },
37 | "chat": {
38 | "id": 165068132,
39 | "first_name": "Stepan",
40 | "last_name": "Franchuk",
41 | "username": "fstepa",
42 | "type": "private"
43 | },
44 | "date": 1565531386,
45 | "media_group_id": "12524251091004274",
46 | "photo": [
47 | {
48 | "file_id": "AgADAgADgasxG6vtgEoJZkOykvbLmc_Ntw8ABAEAAwIAA20AAzUwAgABFgQ",
49 | "file_size": 5657,
50 | "width": 276,
51 | "height": 183
52 | }
53 | ]
54 | }
55 | ]
56 | }
57 |
--------------------------------------------------------------------------------
/tests/resources/send_message_inline_result.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok":true,
3 | "result":{
4 | "message_id":238,
5 | "from":{
6 | "id":780995632,
7 | "is_bot":true,
8 | "first_name":"BotStory",
9 | "username":"TellMeTheStoryBot"
10 | },
11 | "chat":{
12 | "id":165068132,
13 | "first_name":"Stepan",
14 | "last_name":"Franchuk",
15 | "username":"fstepa",
16 | "type":"private"
17 | },
18 | "date":1564920110,
19 | "text":"Hello World!",
20 | "reply_markup":{
21 | "inline_keyboard":[
22 | [
23 | {
24 | "text":"text",
25 | "url":"https://google.com/"
26 | },
27 | {
28 | "text":"text2",
29 | "url":"https://google.com/"
30 | }
31 | ],
32 | [
33 | {
34 | "text":"long text",
35 | "url":"https://google.com/"
36 | }
37 | ]
38 | ]
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/resources/send_message_keyboard.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok":true,
3 | "result":{
4 | "message_id":240,
5 | "from":{
6 | "id":780995632,
7 | "is_bot":true,
8 | "first_name":"BotStory",
9 | "username":"TellMeTheStoryBot"
10 | },
11 | "chat":{
12 | "id":165068132,
13 | "first_name":"Stepan",
14 | "last_name":"Franchuk",
15 | "username":"fstepa",
16 | "type":"private"
17 | },
18 | "date":1564920826,
19 | "text":"Hello World!"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/resources/send_poll.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 303,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": -399749550,
13 | "title": "\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0447\u0430\u0442",
14 | "type": "group",
15 | "all_members_are_administrators": true
16 | },
17 | "date": 1566315367,
18 | "poll": {
19 | "id": "5395736507380137986",
20 | "question": "2+2=?",
21 | "options": [
22 | {
23 | "text": "2",
24 | "voter_count": 0
25 | },
26 | {
27 | "text": "4",
28 | "voter_count": 0
29 | },
30 | {
31 | "text": "8",
32 | "voter_count": 0
33 | }
34 | ],
35 | "is_closed": false
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/resources/send_venue.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 296,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1565533741,
19 | "location": {
20 | "latitude": 1.120005,
21 | "longitude": 2.233403
22 | },
23 | "venue": {
24 | "location": {
25 | "latitude": 1.120005,
26 | "longitude": 2.233403
27 | },
28 | "title": "Title",
29 | "address": "address"
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/resources/send_video_note.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 280,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1565489854,
19 | "video": {
20 | "duration": 0,
21 | "width": 240,
22 | "height": 240,
23 | "mime_type": "video/mp4",
24 | "file_id": "BAADAgADtAIAAk78gUq7BhANg6k_xBYE",
25 | "file_size": 29878668
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/resources/send_voice.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 278,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1565488607,
19 | "voice": {
20 | "duration": 7,
21 | "mime_type": "audio/mpeg",
22 | "file_id": "AwADAgADrQIAAk78gUrVCYCgQMHd9hYE",
23 | "file_size": 37655
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/resources/simple_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": true
4 | }
5 |
--------------------------------------------------------------------------------
/tests/resources/stop_message_live_location.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": true,
3 | "result": {
4 | "message_id": 294,
5 | "from": {
6 | "id": 780995632,
7 | "is_bot": true,
8 | "first_name": "BotStory",
9 | "username": "TellMeTheStoryBot"
10 | },
11 | "chat": {
12 | "id": 165068132,
13 | "first_name": "Stepan",
14 | "last_name": "Franchuk",
15 | "username": "fstepa",
16 | "type": "private"
17 | },
18 | "date": 1565532613,
19 | "edit_date": 1565532616,
20 | "location": {
21 | "latitude": 0.999997,
22 | "longitude": 2.233401
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/resources/stub_file:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcorter/SimpleTelegramBotClient/c2dcff6b170a22fccc4fee6edb255951b63cb5fb/tests/resources/stub_file
--------------------------------------------------------------------------------