Skip to content

Commit 99b8118

Browse files
committed
Added Chat Member subclasses
1 parent 39288d8 commit 99b8118

File tree

8 files changed

+216
-53
lines changed

8 files changed

+216
-53
lines changed

src/Entities/ChatMember.php

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
interface ChatMember
8+
{
9+
10+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberAdministrator
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmemberadministrator
14+
*
15+
* @method string getStatus() The member's status in the chat, always “administrator”
16+
* @method User getUser() Information about the user
17+
* @method bool getCanBeEdited() True, if the bot is allowed to edit administrator privileges of that user
18+
* @method string getCustomTitle() Custom title for this user
19+
* @method bool getIsAnonymous() True, if the user's presence in the chat is hidden
20+
* @method bool getCanManageChat() True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
21+
* @method bool getCanPostMessages() True, if the administrator can post in the channel; channels only
22+
* @method bool getCanEditMessages() True, if the administrator can edit messages of other users and can pin messages; channels only
23+
* @method bool getCanDeleteMessages() True, if the administrator can delete messages of other users
24+
* @method bool getCanManageVoiceChats() True, if the administrator can manage voice chats
25+
* @method bool getCanRestrictMembers() True, if the administrator can restrict, ban or unban chat members
26+
* @method bool getCanPromoteMembers() True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
27+
* @method bool getCanChangeInfo() True, if the user is allowed to change the chat title, photo and other settings
28+
* @method bool getCanInviteUsers() True, if the user is allowed to invite new users to the chat
29+
* @method bool getCanPinMessages() True, if the user is allowed to pin messages; groups and supergroups only
30+
*/
31+
class ChatMemberAdministrator extends Entity implements ChatMember
32+
{
33+
/**
34+
* @inheritDoc
35+
*/
36+
protected function subEntities(): array
37+
{
38+
return [
39+
'user' => User::class,
40+
];
41+
}
42+
43+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberBanned
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmemberbanned
14+
*
15+
* @method string getStatus() The member's status in the chat, always “kicked”
16+
* @method User getUser() Information about the user
17+
* @method int getUntilDate() Date when restrictions will be lifted for this user; unix time
18+
*/
19+
class ChatMemberBanned extends Entity implements ChatMember
20+
{
21+
/**
22+
* @inheritDoc
23+
*/
24+
protected function subEntities(): array
25+
{
26+
return [
27+
'user' => User::class
28+
];
29+
}
30+
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberLeft
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmemberleft
14+
*
15+
* @method string getStatus() The member's status in the chat, always “left”
16+
* @method User getUser() Information about the user
17+
*/
18+
class ChatMemberLeft extends Entity implements ChatMember
19+
{
20+
/**
21+
* @inheritDoc
22+
*/
23+
protected function subEntities(): array
24+
{
25+
return [
26+
'user' => User::class
27+
];
28+
}
29+
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberMember
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmembermember
14+
*
15+
* @method string getStatus() The member's status in the chat, always “member”
16+
* @method User getUser() Information about the user
17+
*/
18+
class ChatMemberMember extends Entity implements ChatMember
19+
{
20+
/**
21+
* @inheritDoc
22+
*/
23+
protected function subEntities(): array
24+
{
25+
return [
26+
'user' => User::class
27+
];
28+
}
29+
30+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberOwner
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmemberowner
14+
*
15+
* @method string getStatus() The member's status in the chat, always “creator”
16+
* @method User getUser() Information about the user
17+
* @method string getCustomTitle() Custom title for this user
18+
* @method bool getIsAnonymous() True, if the user's presence in the chat is hidden
19+
*/
20+
class ChatMemberOwner extends Entity implements ChatMember
21+
{
22+
/**
23+
* {@inheritdoc}
24+
*/
25+
protected function subEntities(): array
26+
{
27+
return [
28+
'user' => User::class,
29+
];
30+
}
31+
32+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
4+
namespace Longman\TelegramBot\Entities\ChatMember;
5+
6+
7+
use Longman\TelegramBot\Entities\Entity;
8+
use Longman\TelegramBot\Entities\User;
9+
10+
/**
11+
* Class ChatMemberRestricted
12+
*
13+
* @link https://core.telegram.org/bots/api#chatmemberrestricted
14+
*
15+
* @method string getStatus() The member's status in the chat, always “restricted”
16+
* @method User getUser() Information about the user
17+
* @method bool getIsMember() True, if the user is a member of the chat at the moment of the request
18+
* @method bool getCanChangeInfo() True, if the user is allowed to change the chat title, photo and other settings
19+
* @method bool getCanInviteUsers() True, if the user is allowed to invite new users to the chat
20+
* @method bool getCanPinMessages() True, if the user is allowed to pin messages; groups and supergroups only
21+
* @method bool getCanSendMessages() True, if the user is allowed to send text messages, contacts, locations and venues
22+
* @method bool getCanSendMediaMessages() True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes
23+
* @method bool getCanSendPolls() True, if the user is allowed to send polls
24+
* @method bool getCanSendOtherMessages() True, if the user is allowed to send animations, games, stickers and use inline bots
25+
* @method bool getCanAddWebPagePreviews() True, if the user is allowed to add web page previews to their messages
26+
* @method int getUntilDate() Date when restrictions will be lifted for this user; unix time
27+
*/
28+
class ChatMemberRestricted extends Entity implements ChatMember
29+
{
30+
/**
31+
* @inheritDoc
32+
*/
33+
protected function subEntities(): array
34+
{
35+
return [
36+
'user' => User::class
37+
];
38+
}
39+
40+
}

0 commit comments

Comments
 (0)