Skip to content

Commit e88d5bf

Browse files
authored
Merge pull request #44 from tg-bot-api/feature/#42-new-bot-api-version
Feature/#42 new bot api version
2 parents 98ed5ec + 583fc90 commit e88d5bf

File tree

384 files changed

+35483
-35740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+35483
-35740
lines changed

CHANGELOG.md

+104-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
All notable changes to `telegram-bot-api` will be documented in this file.
44

5+
<!---
56
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
67
7-
<!---
88
## NEXT - YYYY-MM-DD
99
1010
### Added
@@ -23,6 +23,109 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2323
- Nothing
2424
--->
2525

26+
## 1.7.0 - 2020-12-12
27+
#### Bot API 5.0 - november November 4, 2020
28+
29+
### Added
30+
- #### Run Your Own Bot API Server Usage
31+
- You can pass url as 4th param in bot api
32+
```php
33+
$bot = new \TgBotApi\BotApiBase\BotApi('<bot key>', $apiClient, new \TgBotApi\BotApiBase\BotApiNormalizer(), '<your-domain>');
34+
```
35+
- Added the method `logOut` (`LogOutMethod`), which can be used to log out from the cloud Bot API server before launching your bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive all updates.
36+
- Added the method `close` (`CloseMethod`), which can be used to close the bot instance before moving it from one local server to another.
37+
38+
- #### Webhooks
39+
- Added the parameter `ipAddress` to the class `SetWebhookMethod`, allowing to bypass DNS resolving and use the specified fixed IP address to send webhook requests.
40+
- Added the field `ipAddress` to the class `WebhookInfoType`, containing the current IP address used for webhook connections creation.
41+
- Added the ability to drop all pending updates when changing webhook URL using the parameter `dropPendingUpdates` to the class `SetWebhookMethod` and to `DeleteWebhookMethod`.
42+
43+
- #### Working with Groups
44+
- The `getChat` request now returns the identifier of the linked chat for supergroups and channels, i.e. the discussion group identifier for a channel and vice versa in the `linkedChatId` property.
45+
- The `getChat` request now returns the location to which the supergroup is connected (see `ChatType::$location`). Added the class `ChatLocationType` to represent the location.
46+
- Added the parameter `onlyIfBanned` to the class `UnbanChatMemberMethod` to allow safe unban.
47+
48+
- #### Working with Files
49+
- Added the property `fileName` to the classes `AudioType` and `VideoType`, containing the name of the original file.
50+
- Added the ability to disable server-side file content type detection using the property `disableContentTypeDetection` in the `SendDocumentMethod` and the class inputMediaDocument.
51+
52+
- #### Multiple Pinned Messages
53+
- Added the parameter `messageId` to the `UnpinChatMessageMethod` to allow unpinning of the specific pinned message.
54+
- Added the method `UnpinAllChatMessagesMethod`, which can be used to unpin all pinned messages in a chat.
55+
56+
- #### File Albums
57+
- Added support for sending and receiving audio and document albums in the `SendMediaGroupMethod`.
58+
59+
- #### Live Locations
60+
- Added the field `livePeriod` to the class `LocationType`, representing a maximum period for which the live location can be updated.
61+
- Added support for live location heading: added the field `heading` to the classes `LocationType`, `InlineQueryResultLocationType`, `InputLocationMessageContentType`, `SendLocationMethod` and `EditMessageLiveLocationMethod`.
62+
- Added support for proximity alerts in live locations: added the field `proximityAlertRadius` to the classes `LocationType`, `InlineQueryResultLocationType`, `InputLocationMessageContentType`, `SendLocationMethod` and `EditMessageLiveLocationMethod`.
63+
- Added the type `ProximityAlertTriggered` and the field `proximityAlertTriggered` to the class Message.
64+
- Added possibility to specify the horizontal accuracy of a location. Added the field `horizontalAccuracy` to the classes `LocationType`, `InlineQueryResultLocationType`, `InputLocationMessageContentType`, `SendLocationMethod` and `EditMessageLiveLocationMethod`.
65+
66+
- #### Anonymous Admins
67+
- Added the field `senderChat` to the class `MessageType`, containing the sender of a message which is a chat (group or channel). For backward compatibility in non-channel chats, the field from in such messages will contain the user 777000 for messages automatically forwarded to the discussion group and the user 1087968824 (@GroupAnonymousBot) for messages from anonymous group administrators.
68+
- Added the field `isAnonymous` to the class `ChatMemberType`, which can be used to distinguish anonymous chat administrators.
69+
- Added the parameter `isAnonymous` to the `PromoteChatMemberMethod`, which allows to promote anonymous chat administrators. The bot itself should have the `isAnonymous` right to do this. Despite the fact that bots can have the `isAnonymous` right, they will never appear as anonymous in the chat. Bots can use the right only for passing to other administrators.
70+
- Added the custom title of an anonymous message sender to the class `MessageType` as `authorSignature`.
71+
72+
- #### And More
73+
- Added the method `BotApi::copyMessage` and `CopyMessageMethod`, which sends a copy of any message.
74+
- Maximum poll question length increased to 300.
75+
- Added the ability to manually specify text entities (property `entities` or `captionEntities`) instead of specifying the `parseMode` in the classes
76+
- `InputMediaPhotoType`
77+
- `InputMediaVideoType`
78+
- `InputMediaAnimationType`
79+
- `InputMediaAudioType`
80+
- `InputMediaDocumentType`
81+
- `InlineQueryResultPhotoType`
82+
- `InlineQueryResultGifType`
83+
- `InlineQueryResultMpeg4GifType`
84+
- `InlineQueryResultVideoType`
85+
- `InlineQueryResultAudioType`
86+
- `InlineQueryResultVoiceType`
87+
- `InlineQueryResultDocumentType`
88+
- `InlineQueryResultCachedPhotoType`
89+
- `InlineQueryResultCachedGifType`
90+
- `InlineQueryResultCachedMpeg4GifType`
91+
- `InlineQueryResultCachedVideoType`
92+
- `InlineQueryResultCachedAudioType`
93+
- `InlineQueryResultCachedVoiceType`
94+
- `InlineQueryResultCachedDocumentType`
95+
- `InputTextMessageContentType`
96+
- `SendMessageMethod`
97+
- `SendPhotoMethod`
98+
- `SendVideoMethod`
99+
- `SendAnimationMethod`
100+
- `SendAudioMethod`
101+
- `SendDocumentMethod`
102+
- `SendVoiceMethod`
103+
- `SendPollMethod`
104+
- `EditMessageTextMethod`
105+
- `EditMessageCaptionMethod`
106+
- Added the fields `googlePlaceId` and `googlePlaceType` to the classes `VenueType`, `InlineQueryResultVenueType`, `InputVenueMessageContentType` and to the methods `SendVenueMethod` to support Google Places as a venue API provider.
107+
- Added the field `allowSendingWithoutReply` to allow sending messages not a as reply if the replied-to message has already been deleted to following classes:
108+
- `sendMessageMethod`
109+
- `sendPhotoMethod`
110+
- `sendVideoMethod`
111+
- `SendAnimationMethod`
112+
- `SendAudioMethod`
113+
- `SendDocumentMethod`
114+
- `SendStickerMethod`
115+
- `SendVideoNoteMethod`
116+
- `SendVoiceMethod`
117+
- `SendLocationMethod`
118+
- `SendVenueMethod`
119+
- `SendContactMethod`
120+
- `SendPollMethod`
121+
- `SendDiceMethod`
122+
- `SendInvoiceMethod`
123+
- `SendGameMethod`
124+
- `SendMediaGroupMethod`
125+
126+
- #### And Last but bot Least
127+
- Supported the new football and slot machine animations for the random dice. Choose between different animations (dice, darts, basketball, football, slot machine) by specifying the emoji parameter in the method sendDice.
128+
26129
## 1.6.2 - 2020-07-13
27130

28131
### Fixed

README.md

+46-37
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[![Duplicated Lines (%)][sonar-duplicated-lines-icon]][sonar-path]
1515
[![Security Rating][sonar-security-rating-icon]][sonar-path]
1616

17-
#### Supported Telegram Bot API v4.9 (June 4, 2020)
17+
#### Supported Telegram Bot API 5.0 (November 4, 2020)
1818

1919
## Installation
2020

@@ -48,45 +48,54 @@ $bot->send(\TgBotApi\BotApiBase\Method\SendMessageMethod::create($userId, 'Hi'))
4848

4949
You can configure it to work in symfony, for example, in [this way](https://gist.github.com/greenplugin/09179bee606aa01b1ee00d049ab78fc4).
5050

51+
If you want to use your own api server - you can set url as 4th param in bot api
52+
53+
```php
54+
$bot = new \TgBotApi\BotApiBase\BotApi('<bot key>', $apiClient, new \TgBotApi\BotApiBase\BotApiNormalizer(), '<your-domain>');
55+
```
56+
5157
### Allowed methods:
5258

5359
|Method|Allowed type|response|
5460
|:--|:--|:--|
55-
|add|AddStickerToSetMethod|bool|
56-
|answer|AnswerCallbackQueryMethod, AnswerInlineQueryMethod, AnswerPreCheckoutQueryMethod, AnswerShippingQueryMethod|bool|
57-
|create|CreateNewStickerSetMethod|bool|
58-
|delete|DeleteChatPhotoMethod, DeleteChatStickerSetMethod, DeleteMessageMethod, DeleteStickerFromSetMethod, DeleteWebhookMethod|bool|
59-
|edit|EditMessageCaptionMethod, EditMessageLiveLocationMethod, EditMessageMediaMethod, EditMessageReplyMarkupMethod, EditMessageTextMethod|bool|
60-
|forward|ForwardMessageMethod|MessageType|
61-
|kick|KickChatMemberMethod|bool|
62-
|leave|LeaveChatMethod|bool|
63-
|pin|PinChatMessageMethod|bool|
64-
|promote|PromoteChatMemberMethod|bool|
65-
|restrict|RestrictChatMemberMethod|bool|
66-
|send|SendPhotoMethod, SendAudioMethod, SendDocumentMethod, SendVideoMethod, SendAnimationMethod, SendVoiceMethod, SendVideoNoteMethod, SendGameMethod, SendInvoiceMethod, SendLocationMethod, SendVenueMethod, SendContactMethod, SendStickerMethod, SendMessageMethod, SendPollMethod, SendDiceMethod|MessageType|
67-
|set|SetChatDescriptionMethod, SetChatPhotoMethod, SetChatStickerSetMethod, SetChatTitleMethod, SetGameScoreMethod, SetStickerPositionInSetMethod, SetWebhookMethod, SetPassportDataErrorsMethod, SetChatPermissionsMethod, SetChatAdministratorCustomTitleMethod, SetMyCommandMethod, SetStickerSetThumbMethod|bool|
68-
|stop|StopMessageLiveLocationMethod|bool|
69-
|stopPoll|StopPollMethod|Poll|
70-
|unban|UnbanChatMemberMethod|bool|
71-
|unpin|UnpinChatMessageMethod|bool|
72-
|upload|UploadStickerFileMethod|FileType|
73-
|exportChatInviteLink|ExportChatInviteLinkMethod|string|
74-
|sendChatAction|SendChatActionMethod|bool|
75-
|getUpdates|GetUpdatesMethod|UpdateType[]|
76-
|getMe|GetMeMethod|UserType|
77-
|getMyCommands|GetMyCommandsMethod|BotCommandType|
78-
|getUserProfilePhotos|GetUserProfilePhotosMethod|UserProfilePhotosType|
79-
|getWebhookInfo|GetWebhookInfoMethod|WebhookInfoType|
80-
|getChatMembersCount|GetChatMembersCountMethod|int|
81-
|getChat|GetChatMethod|ChatType|
82-
|getChatAdministrators|GetChatAdministratorsMethod|ChatMemberType[]|
83-
|getChatMember|GetChatMemberMethod|ChatMemberType|
84-
|getGameHighScores|GetGameHighScoresMethod|GameHighScoreType[]|
85-
|getStickerSet|GetStickerSetMethod|StickerSetType|
86-
|getFile|GetFileMethod|FileType|
87-
|sendMediaGroup|SendMediaGroupMethod|MessageType[]|
88-
|getAbsoluteFilePath|FileType|string|
89-
|call($method, [string $type])|any method class, [optional expected type]|array or excepted type object|
61+
|`add`|AddStickerToSetMethod|bool|
62+
|`answer`|AnswerCallbackQueryMethod, AnswerInlineQueryMethod, AnswerPreCheckoutQueryMethod, AnswerShippingQueryMethod|bool|
63+
|`create`|CreateNewStickerSetMethod|bool|
64+
|`delete`|DeleteChatPhotoMethod, DeleteChatStickerSetMethod, DeleteMessageMethod, DeleteStickerFromSetMethod, DeleteWebhookMethod|bool|
65+
|`edit`|EditMessageCaptionMethod, EditMessageLiveLocationMethod, EditMessageMediaMethod, EditMessageReplyMarkupMethod, EditMessageTextMethod|bool|
66+
|`forward`|ForwardMessageMethod|MessageType|
67+
|`kick`|KickChatMemberMethod|bool|
68+
|`leave`|LeaveChatMethod|bool|
69+
|`pin`|PinChatMessageMethod|bool|
70+
|`promote`|PromoteChatMemberMethod|bool|
71+
|`restrict`|RestrictChatMemberMethod|bool|
72+
|`send`|SendPhotoMethod, SendAudioMethod, SendDocumentMethod, SendVideoMethod, SendAnimationMethod, SendVoiceMethod, SendVideoNoteMethod, SendGameMethod, SendInvoiceMethod, SendLocationMethod, SendVenueMethod, SendContactMethod, SendStickerMethod, SendMessageMethod, SendPollMethod, SendDiceMethod|MessageType|
73+
|`set`|SetChatDescriptionMethod, SetChatPhotoMethod, SetChatStickerSetMethod, SetChatTitleMethod, SetGameScoreMethod, SetStickerPositionInSetMethod, SetWebhookMethod, SetPassportDataErrorsMethod, SetChatPermissionsMethod, SetChatAdministratorCustomTitleMethod, SetMyCommandMethod, SetStickerSetThumbMethod|bool|
74+
|`stop`|StopMessageLiveLocationMethod|bool|
75+
|`stopPoll`|StopPollMethod|Poll|
76+
|`unban`|UnbanChatMemberMethod|bool|
77+
|`unpin`|UnpinChatMessageMethod, UnpinAllChatMessagesMethod|bool|
78+
|`upload`|UploadStickerFileMethod|FileType|
79+
|`exportChatInviteLink`|ExportChatInviteLinkMethod|string|
80+
|`sendChatAction`|SendChatActionMethod|bool|
81+
|`getUpdates`|GetUpdatesMethod|UpdateType[]|
82+
|`getMe`|GetMeMethod|UserType|
83+
|`getMyCommands`|GetMyCommandsMethod|BotCommandType|
84+
|`getUserProfilePhotos`|GetUserProfilePhotosMethod|UserProfilePhotosType|
85+
|`getWebhookInfo`|GetWebhookInfoMethod|WebhookInfoType|
86+
|`getChatMembersCount`|GetChatMembersCountMethod|int|
87+
|`getChat`|GetChatMethod|ChatType|
88+
|`getChatAdministrators`|GetChatAdministratorsMethod|ChatMemberType[]|
89+
|`getChatMember`|GetChatMemberMethod|ChatMemberType|
90+
|`getGameHighScores`|GetGameHighScoresMethod|GameHighScoreType[]|
91+
|`getStickerSet`|GetStickerSetMethod|StickerSetType|
92+
|`getFile`|GetFileMethod|FileType|
93+
|`sendMediaGroup`|SendMediaGroupMethod|MessageType[]|
94+
|`getAbsoluteFilePath`|FileType|string|
95+
|`logOut`|LogOutMethod|bool|
96+
|`close`|CloseMethod|bool|
97+
|`copyMessage`|CopyMessageMethod|MessageIdType|
98+
|`call($method, [string $type])`|any method class, [optional expected type]|array or excepted type object|
9099

91100
Implemented all methods and types referenced by [official Api](https://core.telegram.org/bots/api)
92101

@@ -146,7 +155,7 @@ If you discover any security related issues, please email [email protected] inst
146155
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
147156

148157
[ico-php-v]: https://img.shields.io/travis/php-v/tg-bot-api/bot-api-base.svg?style=flat-square
149-
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.9-blue.svg?style=flat-square
158+
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-5.0-blue.svg?style=flat-square
150159
[ico-version]: https://img.shields.io/packagist/v/tg-bot-api/bot-api-base.svg?style=flat-square
151160
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
152161
[ico-travis]: https://img.shields.io/travis/tg-bot-api/bot-api-base/master.svg?style=flat-square

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"phpstan/phpstan": "^0.10.6",
4141
"phpunit/phpunit": "^7.5.2",
4242
"povils/phpmnd": "^2.0",
43-
"sebastian/phpcpd": "^4.1",
43+
"sebastian/phpcpd": "^5.0",
4444
"squizlabs/php_codesniffer": "^3.4"
4545
},
4646
"autoload": {

0 commit comments

Comments
 (0)