|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This phpFile is auto-generated. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
declare(strict_types=1); |
|
8
|
|
|
|
|
9
|
|
|
namespace PHPTdGram\Schema; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers. |
|
13
|
|
|
*/ |
|
14
|
|
|
class Supergroup extends TdObject |
|
15
|
|
|
{ |
|
16
|
|
|
public const TYPE_NAME = 'supergroup'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Supergroup or channel identifier. |
|
20
|
|
|
*/ |
|
21
|
|
|
protected int $id; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Username of the supergroup or channel; empty for private supergroups or channels. |
|
25
|
|
|
*/ |
|
26
|
|
|
protected string $username; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected int $date; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Status of the current user in the supergroup or channel; custom title will be always empty. |
|
35
|
|
|
*/ |
|
36
|
|
|
protected ChatMemberStatus $status; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats. |
|
40
|
|
|
*/ |
|
41
|
|
|
protected int $memberCount; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel. |
|
45
|
|
|
*/ |
|
46
|
|
|
protected bool $hasLinkedChat; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup. |
|
50
|
|
|
*/ |
|
51
|
|
|
protected bool $hasLocation; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels. |
|
55
|
|
|
*/ |
|
56
|
|
|
protected bool $signMessages; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* True, if the slow mode is enabled in the supergroup. |
|
60
|
|
|
*/ |
|
61
|
|
|
protected bool $isSlowModeEnabled; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* True, if the supergroup is a channel. |
|
65
|
|
|
*/ |
|
66
|
|
|
protected bool $isChannel; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* True, if the supergroup or channel is verified. |
|
70
|
|
|
*/ |
|
71
|
|
|
protected bool $isVerified; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted. |
|
75
|
|
|
*/ |
|
76
|
|
|
protected string $restrictionReason; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* True, if many users reported this supergroup as a scam. |
|
80
|
|
|
*/ |
|
81
|
|
|
protected bool $isScam; |
|
82
|
|
|
|
|
83
|
|
|
public function __construct( |
|
84
|
|
|
int $id, |
|
85
|
|
|
string $username, |
|
86
|
|
|
int $date, |
|
87
|
|
|
ChatMemberStatus $status, |
|
88
|
|
|
int $memberCount, |
|
89
|
|
|
bool $hasLinkedChat, |
|
90
|
|
|
bool $hasLocation, |
|
91
|
|
|
bool $signMessages, |
|
92
|
|
|
bool $isSlowModeEnabled, |
|
93
|
|
|
bool $isChannel, |
|
94
|
|
|
bool $isVerified, |
|
95
|
|
|
string $restrictionReason, |
|
96
|
|
|
bool $isScam |
|
97
|
|
|
) { |
|
98
|
|
|
$this->id = $id; |
|
99
|
|
|
$this->username = $username; |
|
100
|
|
|
$this->date = $date; |
|
101
|
|
|
$this->status = $status; |
|
102
|
|
|
$this->memberCount = $memberCount; |
|
103
|
|
|
$this->hasLinkedChat = $hasLinkedChat; |
|
104
|
|
|
$this->hasLocation = $hasLocation; |
|
105
|
|
|
$this->signMessages = $signMessages; |
|
106
|
|
|
$this->isSlowModeEnabled = $isSlowModeEnabled; |
|
107
|
|
|
$this->isChannel = $isChannel; |
|
108
|
|
|
$this->isVerified = $isVerified; |
|
109
|
|
|
$this->restrictionReason = $restrictionReason; |
|
110
|
|
|
$this->isScam = $isScam; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public static function fromArray(array $array): Supergroup |
|
114
|
|
|
{ |
|
115
|
|
|
return new static( |
|
116
|
|
|
$array['id'], |
|
117
|
|
|
$array['username'], |
|
118
|
|
|
$array['date'], |
|
119
|
|
|
TdSchemaRegistry::fromArray($array['status']), |
|
120
|
|
|
$array['member_count'], |
|
121
|
|
|
$array['has_linked_chat'], |
|
122
|
|
|
$array['has_location'], |
|
123
|
|
|
$array['sign_messages'], |
|
124
|
|
|
$array['is_slow_mode_enabled'], |
|
125
|
|
|
$array['is_channel'], |
|
126
|
|
|
$array['is_verified'], |
|
127
|
|
|
$array['restriction_reason'], |
|
128
|
|
|
$array['is_scam'], |
|
129
|
|
|
); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
public function typeSerialize(): array |
|
133
|
|
|
{ |
|
134
|
|
|
return [ |
|
135
|
|
|
'@type' => static::TYPE_NAME, |
|
136
|
|
|
'id' => $this->id, |
|
137
|
|
|
'username' => $this->username, |
|
138
|
|
|
'date' => $this->date, |
|
139
|
|
|
'status' => $this->status->typeSerialize(), |
|
140
|
|
|
'member_count' => $this->memberCount, |
|
141
|
|
|
'has_linked_chat' => $this->hasLinkedChat, |
|
142
|
|
|
'has_location' => $this->hasLocation, |
|
143
|
|
|
'sign_messages' => $this->signMessages, |
|
144
|
|
|
'is_slow_mode_enabled' => $this->isSlowModeEnabled, |
|
145
|
|
|
'is_channel' => $this->isChannel, |
|
146
|
|
|
'is_verified' => $this->isVerified, |
|
147
|
|
|
'restriction_reason' => $this->restrictionReason, |
|
148
|
|
|
'is_scam' => $this->isScam, |
|
149
|
|
|
]; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function getId(): int |
|
153
|
|
|
{ |
|
154
|
|
|
return $this->id; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
public function getUsername(): string |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->username; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function getDate(): int |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->date; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function getStatus(): ChatMemberStatus |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->status; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
public function getMemberCount(): int |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->memberCount; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
public function getHasLinkedChat(): bool |
|
178
|
|
|
{ |
|
179
|
|
|
return $this->hasLinkedChat; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
public function getHasLocation(): bool |
|
183
|
|
|
{ |
|
184
|
|
|
return $this->hasLocation; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
public function getSignMessages(): bool |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->signMessages; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
public function getIsSlowModeEnabled(): bool |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->isSlowModeEnabled; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
public function getIsChannel(): bool |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->isChannel; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
public function getIsVerified(): bool |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->isVerified; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
public function getRestrictionReason(): string |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->restrictionReason; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getIsScam(): bool |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->isScam; |
|
215
|
|
|
} |
|
216
|
|
|
} |
|
217
|
|
|
|