|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Greenplugin\TelegramBot\Method; |
|
6
|
|
|
|
|
7
|
|
|
use Greenplugin\TelegramBot\Method\Traits\ChatIdVariableTrait; |
|
8
|
|
|
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait; |
|
9
|
|
|
use Greenplugin\TelegramBot\Method\Traits\UserIdVariableTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class RestrictChatMemberMethod. |
|
13
|
|
|
* |
|
14
|
|
|
* @see https://core.telegram.org/bots/api#restrictchatmember |
|
15
|
|
|
*/ |
|
16
|
|
|
class RestrictChatMemberMethod |
|
17
|
|
|
{ |
|
18
|
|
|
use FillFromArrayTrait; |
|
19
|
|
|
use ChatIdVariableTrait; |
|
20
|
|
|
use UserIdVariableTrait; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Optional. Date when the user will be unbanned, DateTimeInterface. |
|
24
|
|
|
* If user is banned for more than 366 days or less than 30 seconds |
|
25
|
|
|
* from the current time they are considered to be banned forever. |
|
26
|
|
|
* |
|
27
|
|
|
* @var \DateTimeInterface|null |
|
28
|
|
|
*/ |
|
29
|
|
|
public $untilDate; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Optional. Pass True, if the user can send text messages, contacts, locations and venues. |
|
33
|
|
|
* |
|
34
|
|
|
* @var bool|null |
|
35
|
|
|
*/ |
|
36
|
|
|
public $canSendMessages; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Optional. Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, |
|
40
|
|
|
* implies can_send_messages. |
|
41
|
|
|
* |
|
42
|
|
|
* @var bool|null |
|
43
|
|
|
*/ |
|
44
|
|
|
public $canSendMediaMessages; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Optional. Pass True, if the user can send animations, games, stickers and use inline bots, |
|
48
|
|
|
* implies can_send_media_messages. |
|
49
|
|
|
* |
|
50
|
|
|
* @var bool|null |
|
51
|
|
|
*/ |
|
52
|
|
|
public $canSendOtherMessages; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Optional. Pass True, if the user may add web page previews to their messages, implies can_send_media_messages. |
|
56
|
|
|
* |
|
57
|
|
|
* @var bool|null |
|
58
|
|
|
*/ |
|
59
|
|
|
public $canAddWebPagePreview; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param $chatId |
|
63
|
|
|
* @param int $userId |
|
64
|
|
|
* @param array|null $data |
|
65
|
|
|
* |
|
66
|
|
|
* @throws \Greenplugin\TelegramBot\Exception\BadArgumentException |
|
67
|
|
|
* |
|
68
|
|
|
* @return RestrictChatMemberMethod |
|
69
|
|
|
*/ |
|
70
|
|
|
public static function create($chatId, int $userId, array $data = null): RestrictChatMemberMethod |
|
71
|
|
|
{ |
|
72
|
|
|
$instance = new static(); |
|
73
|
|
|
$instance->chatId = $chatId; |
|
74
|
|
|
$instance->userId = $userId; |
|
75
|
|
|
if ($data) { |
|
76
|
|
|
$instance->fill($data); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
return $instance; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|