1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace unreal4u\TelegramAPI\Telegram\Methods; |
6
|
|
|
|
7
|
|
|
use Psr\Log\LoggerInterface; |
8
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramMethods; |
9
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramTypes; |
10
|
|
|
use unreal4u\TelegramAPI\InternalFunctionality\TelegramRawData; |
11
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the |
15
|
|
|
* chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a |
16
|
|
|
* user. Returns True on success. |
17
|
|
|
* |
18
|
|
|
* Objects defined as-is july 2017 |
19
|
|
|
* |
20
|
|
|
* @see https://core.telegram.org/bots/api#promotechatmember |
21
|
|
|
*/ |
22
|
|
|
class PromoteChatMember extends TelegramMethods |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Unique identifier for the target chat or username of the target supergroup or channel (in the format |
26
|
|
|
* @channelusername) |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
public $chat_id = ''; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Unique identifier of the target user |
33
|
|
|
* @var int |
34
|
|
|
*/ |
35
|
|
|
public $user_id = 0; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Pass True, if the administrator can change chat title, photo and other settings |
39
|
|
|
* @var bool |
40
|
|
|
*/ |
41
|
|
|
public $can_change_info = false; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Pass True, if the administrator can create channel posts, channels only |
45
|
|
|
* @var bool |
46
|
|
|
*/ |
47
|
|
|
public $can_post_messages = false; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Pass True, if the administrator can edit messages of other users, channels only |
51
|
|
|
* @var bool |
52
|
|
|
*/ |
53
|
|
|
public $can_edit_messages = false; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Pass True, if the administrator can delete messages of other users |
57
|
|
|
* @var bool |
58
|
|
|
*/ |
59
|
|
|
public $can_delete_messages = false; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Pass True, if the administrator can invite new users to the chat |
63
|
|
|
* @var bool |
64
|
|
|
*/ |
65
|
|
|
public $can_invite_users = false; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Pass True, if the administrator can restrict, ban or unban chat members |
69
|
|
|
* @var bool |
70
|
|
|
*/ |
71
|
|
|
public $can_restrict_members = false; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Pass True, if the administrator can pin messages, supergroups only |
75
|
|
|
* @var bool |
76
|
|
|
*/ |
77
|
|
|
public $can_pin_messages = false; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Pass True, if the administrator can add new administrators with a subset of his own privileges or demote |
81
|
|
|
* administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by |
82
|
|
|
* him) |
83
|
|
|
* @var bool |
84
|
|
|
*/ |
85
|
|
|
public $can_promote_members = false; |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes |
89
|
|
|
{ |
90
|
|
|
return new ResultBoolean($data->getResultBoolean(), $logger); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getMandatoryFields(): array |
94
|
|
|
{ |
95
|
|
|
return [ |
96
|
|
|
'chat_id', |
97
|
|
|
'user_id', |
98
|
|
|
]; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|