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 restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to |
15
|
|
|
* work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a |
16
|
|
|
* user. Returns True on success |
17
|
|
|
* |
18
|
|
|
* Objects defined as-is july 2017 |
19
|
|
|
* |
20
|
|
|
* @see https://core.telegram.org/bots/api#restrictchatmember |
21
|
|
|
*/ |
22
|
|
|
class RestrictChatMember 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
|
|
|
* Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or |
39
|
|
|
* less than 30 seconds from the current time, they are considered to be restricted forever |
40
|
|
|
* @var int |
41
|
|
|
*/ |
42
|
|
|
public $until_date = 0; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Pass True, if the user can send text messages, contacts, locations and venues |
46
|
|
|
* @var bool |
47
|
|
|
*/ |
48
|
|
|
public $can_send_messages = false; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies |
52
|
|
|
* can_send_messages |
53
|
|
|
* @var bool |
54
|
|
|
*/ |
55
|
|
|
public $can_send_media_messages = false; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages |
59
|
|
|
* @var bool |
60
|
|
|
*/ |
61
|
|
|
public $can_send_other_messages = false; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Pass True, if the user may add web page previews to their messages, implies can_send_media_messages |
65
|
|
|
* @var bool |
66
|
|
|
*/ |
67
|
|
|
public $can_add_web_page_previews = false; |
68
|
|
|
|
69
|
|
|
public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes |
70
|
|
|
{ |
71
|
|
|
return new ResultBoolean($data->getResultBoolean(), $logger); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getMandatoryFields(): array |
75
|
|
|
{ |
76
|
|
|
return [ |
77
|
|
|
'chat_id', |
78
|
|
|
'user_id', |
79
|
|
|
]; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|