Skip to content

Commit 0d59d04

Browse files
authored
Merge pull request #551 from noplanman/bot_api_3.1
Bot API 3.1
2 parents 13ffcc1 + cce002b commit 0d59d04

File tree

6 files changed

+206
-598
lines changed

6 files changed

+206
-598
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
66
## [Unreleased]
77
### Added
88
- Callbacks can be added to be executed when callback queries are called.
9+
- New Bot API 3.1 changes (#550).
910
### Changed
11+
- [:exclamation:][unreleased-bc-request-class-refactor] Big refactor of the `Request` class, removing most custom method implementations.
1012
### Deprecated
1113
### Removed
1214
### Fixed
@@ -122,6 +124,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
122124
### Deprecated
123125
- Move `hideKeyboard` to `removeKeyboard`.
124126

127+
[unreleased-bc-request-class-refactor]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#request-class-refactor
125128
[0.45.0-bc-remove-deprecated-methods]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#remove-deprecated-methods
126129
[0.45.0-bc-chats-params-array]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#chats-params-array
127130
[0.45.0-bc-up-download-directory]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#up-download-directory

src/Entities/Chat.php

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,39 @@
1515
*
1616
* @link https://core.telegram.org/bots/api#chat
1717
*
18-
* @property int $id Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
19-
* @property string $type Type of chat, can be either "private", "group", "supergroup" or "channel"
20-
* @property string $title Optional. Title, for channels and group chats
21-
* @property string $username Optional. Username, for private chats, supergroups and channels if available
22-
* @property string $first_name Optional. First name of the other party in a private chat
23-
* @property string $last_name Optional. Last name of the other party in a private chat
24-
* @property bool $all_members_are_administrators Optional. True if a group has ‘All Members Are Admins’ enabled.
25-
* @method int getId() Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
26-
* @method string getType() Type of chat, can be either "private ", "group", "supergroup" or "channel"
27-
* @method string getTitle() Optional. Title, for channels and group chats
28-
* @method string getUsername() Optional. Username, for private chats, supergroups and channels if available
29-
* @method string getFirstName() Optional. First name of the other party in a private chat
30-
* @method string getLastName() Optional. Last name of the other party in a private chat
31-
* @method bool getAllMembersAreAdministrators() Optional. True if a group has ‘All Members Are Admins’ enabled.
18+
* @property int $id Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
19+
* @property string $type Type of chat, can be either "private", "group", "supergroup" or "channel"
20+
* @property string $title Optional. Title, for channels and group chats
21+
* @property string $username Optional. Username, for private chats, supergroups and channels if available
22+
* @property string $first_name Optional. First name of the other party in a private chat
23+
* @property string $last_name Optional. Last name of the other party in a private chat
24+
* @property bool $all_members_are_administrators Optional. True if a group has ‘All Members Are Admins’ enabled.
25+
* @property ChatPhoto $photo Optional. Chat photo. Returned only in getChat.
26+
* @property string $description Optional. Description, for supergroups and channel chats. Returned only in getChat.
27+
* @property string $invite_link Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
28+
* @method int getId() Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
29+
* @method string getType() Type of chat, can be either "private ", "group", "supergroup" or "channel"
30+
* @method string getTitle() Optional. Title, for channels and group chats
31+
* @method string getUsername() Optional. Username, for private chats, supergroups and channels if available
32+
* @method string getFirstName() Optional. First name of the other party in a private chat
33+
* @method string getLastName() Optional. Last name of the other party in a private chat
34+
* @method bool getAllMembersAreAdministrators() Optional. True if a group has ‘All Members Are Admins’ enabled.
35+
* @method ChatPhoto getPhoto() Optional. Chat photo. Returned only in getChat.
36+
* @method string getDescription() Optional. Description, for supergroups and channel chats. Returned only in getChat.
37+
* @method string getInviteLink() Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
3238
*/
3339
class Chat extends Entity
3440
{
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
public function subEntities()
45+
{
46+
return [
47+
'photo' => ChatPhoto::class,
48+
];
49+
}
50+
3551
public function __construct($data)
3652
{
3753
parent::__construct($data);

src/Entities/ChatMember.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,22 @@
1515
*
1616
* @link https://core.telegram.org/bots/api#chatmember
1717
*
18-
* @method User getUser() Information about the user.
19-
* @method string getStatus() The member's status in the chat. Can be "creator", "administrator", "member", "left" or "kicked"
18+
* @method User getUser() Information about the user
19+
* @method string getStatus() The member's status in the chat. Can be “creator”, “administrator”, “member”, “restricted”, “left” or “kicked”
20+
* @method int getUntilDate() Optional. Restricted and kicked only. Date when restrictions will be lifted for this user, unix time
21+
* @method bool getCanBeEdited() Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user
22+
* @method bool getCanChangeInfo() Optional. Administrators only. True, if the administrator can change the chat title, photo and other settings
23+
* @method bool getCanPostMessages() Optional. Administrators only. True, if the administrator can post in the channel, channels only
24+
* @method bool getCanEditMessages() Optional. Administrators only. True, if the administrator can edit messages of other users, channels only
25+
* @method bool getCanDeleteMessages() Optional. Administrators only. True, if the administrator can delete messages of other users
26+
* @method bool getCanInviteUsers() Optional. Administrators only. True, if the administrator can invite new users to the chat
27+
* @method bool getCanRestrictMembers() Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
28+
* @method bool getCanPinMessages() Optional. Administrators only. True, if the administrator can pin messages, supergroups only
29+
* @method bool getCanPromoteMembers() Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
30+
* @method bool getCanSendMessages() Optional. Restricted only. True, if the user can send text messages, contacts, locations and venues
31+
* @method bool getCanSendMediaMessages() Optional. Restricted only. True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
32+
* @method bool getCanSendOtherMessages() Optional. Restricted only. True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages
33+
* @method bool getCanAddWebPagePreviews() Optional. Restricted only. True, if user may add web page previews to his messages, implies can_send_media_messages
2034
*/
2135
class ChatMember extends Entity
2236
{

src/Entities/ChatPhoto.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Entities;
12+
13+
/**
14+
* Class ChatPhoto
15+
*
16+
* @link https://core.telegram.org/bots/api#chatphoto
17+
*
18+
* @method string getSmallFileId() Unique file identifier of small(160x160) chat photo. This file_id can be used only for photo download.
19+
* @method string getBigFileId() Unique file identifier of big(640x640) chat photo. This file_id can be used only for photo download.
20+
*/
21+
class ChatPhoto extends Entity
22+
{
23+
24+
}

0 commit comments

Comments
 (0)