Skip to content

Commit

Permalink
Implements new Bot API v3.1 changes. Close #40
Browse files Browse the repository at this point in the history
  • Loading branch information
Camilo Sperberg committed Jun 30, 2017
1 parent bb3ad1f commit 838e786
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/InternalFunctionality/TelegramRawData.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public function getResult(): array
}

/**
* Hack: for some requests Telegram sends back an array, integer, string or a boolean value, convert it to boolean here
* Hack: for some requests Telegram sends back an array, integer, string or a boolean value, convert it to boolean
* here
* @return bool
*/
public function getResultBoolean(): bool
Expand All @@ -77,7 +78,8 @@ public function getResultInt(): int
}

/**
* Hack: for some requests Telegram send back an array, integer, string or a boolean value, convert it to string here
* Hack: for some requests Telegram send back an array, integer, string or a boolean value, convert it to string
* here
* @return string
*/
public function getResultString(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/Methods/DeleteChatPhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator
* in the chat for this to work and must have the appropriate admin rights. Returns True on success
*
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off
* in the target group
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is
* off in the target group
*
* Objects defined as-is july 2017
*
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/Methods/SetChatPhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be
* an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success
*
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off
* in the target group
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is
* off in the target group
*
* Objects defined as-is july 2017
*
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/Methods/SetChatTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an
* administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success
*
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off
* in the target group
* Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is
* off in the target group
*
* Objects defined as-is july 2017
*
Expand Down
93 changes: 91 additions & 2 deletions src/Telegram/Types/ChatMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* This object contains information about one member of the chat
*
* Objects defined as-is july 2016
* Objects defined as-is july 2017
*
* @see https://core.telegram.org/bots/api#chatmember
*/
Expand All @@ -22,11 +22,100 @@ class ChatMember extends TelegramTypes
public $user;

/**
* The member's status in the chat. Can be "creator", "administrator", "member", "left" or "kicked"
* The member's status in the chat. Can be "creator", "administrator", "member", "restricted", "left" or "kicked"
* @var string
*/
public $status = '';

/**
* Optional. Restricted and kicked only. Date when restrictions will be lifted for this user, unix time
* @var int
*/
public $until_date = 0;

/**
* Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user
* @var bool
*/
public $can_be_edited = false;

/**
* Optional. Administrators only. True, if the administrator can change the chat title, photo and other settings
* @var bool
*/
public $can_change_info = false;

/**
* Optional. Administrators only. True, if the administrator can post in the channel, channels only
* @var bool
*/
public $can_post_messages = false;

/**
* Optional. Administrators only. True, if the administrator can edit messages of other users, channels only
* @var bool
*/
public $can_edit_messages = false;

/**
* Optional. Administrators only. True, if the administrator can delete messages of other users
* @var bool
*/
public $can_delete_messages = false;

/**
* Optional. Administrators only. True, if the administrator can invite new users to the chat
* @var bool
*/
public $can_invite_users = false;

/**
* Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
* @var bool
*/
public $can_restrict_members = false;

/**
* Optional. Administrators only. True, if the administrator can pin messages, supergroups only
* @var bool
*/
public $can_pin_messages = false;

/**
* 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)
* @var bool
*/
public $can_promote_members = false;

/**
* Optional. Restricted only. True, if the user can send text messages, contacts, locations and venues
* @var bool
*/
public $can_send_messages = false;

/**
* Optional. Restricted only. True, if the user can send audios, documents, photos, videos, video notes and voice
* notes, implies can_send_messages
* @var bool
*/
public $can_send_media_messages = false;

/**
* Optional. Restricted only. True, if the user can send animations, games, stickers and use inline bots, implies
* can_send_media_messages
* @var bool
*/
public $can_send_other_messages = false;

/**
* Optional. Restricted only. True, if user may add web page previews to his messages, implies
* can_send_media_messages
* @var bool
*/
public $can_add_web_page_previews = false;

public function mapSubObjects(string $key, array $data): TelegramTypes
{
switch ($key) {
Expand Down

0 comments on commit 838e786

Please sign in to comment.