@@ -38,79 +38,79 @@ |
||
38 | 38 | public messageOrigin $origin; |
39 | 39 | |
40 | 40 | /** Optional. Chat the original message belongs to. Available only if the chat is a supergroup or a channel. */ |
41 | - public null|chat $chat = null; |
|
41 | + public null | chat $chat = null; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Optional. Unique message identifier inside the original chat. Available only if the original chat is a |
45 | 45 | * supergroup or a channel. |
46 | 46 | */ |
47 | - public null|int $message_id = null; |
|
47 | + public null | int $message_id = null; |
|
48 | 48 | |
49 | 49 | /** Optional. Options used for link preview generation for the original message, if it is a text message */ |
50 | - public null|linkPreviewOptions $link_preview_options = null; |
|
50 | + public null | linkPreviewOptions $link_preview_options = null; |
|
51 | 51 | |
52 | 52 | /** Optional. Message is an animation, information about the animation */ |
53 | - public null|animation $animation = null; |
|
53 | + public null | animation $animation = null; |
|
54 | 54 | |
55 | 55 | /** Optional. Message is an audio file, information about the file */ |
56 | - public null|audio $audio = null; |
|
56 | + public null | audio $audio = null; |
|
57 | 57 | |
58 | 58 | /** Optional. Message is a general file, information about the file */ |
59 | - public null|document $document = null; |
|
59 | + public null | document $document = null; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Optional. Message is a photo, available sizes of the photo |
63 | 63 | * @var photoSize[] |
64 | 64 | */ |
65 | - public null|array $photo = null; |
|
65 | + public null | array $photo = null; |
|
66 | 66 | |
67 | 67 | /** Optional. Message is a sticker, information about the sticker */ |
68 | - public null|sticker $sticker = null; |
|
68 | + public null | sticker $sticker = null; |
|
69 | 69 | |
70 | 70 | /** Optional. Message is a forwarded story */ |
71 | - public null|story $story = null; |
|
71 | + public null | story $story = null; |
|
72 | 72 | |
73 | 73 | /** Optional. Message is a video, information about the video */ |
74 | - public null|video $video = null; |
|
74 | + public null | video $video = null; |
|
75 | 75 | |
76 | 76 | /** Optional. Message is a video note, information about the video message */ |
77 | - public null|videoNote $video_note = null; |
|
77 | + public null | videoNote $video_note = null; |
|
78 | 78 | |
79 | 79 | /** Optional. Message is a voice message, information about the file */ |
80 | - public null|voice $voice = null; |
|
80 | + public null | voice $voice = null; |
|
81 | 81 | |
82 | 82 | /** Optional. True, if the message media is covered by a spoiler animation */ |
83 | - public null|bool $has_media_spoiler = null; |
|
83 | + public null | bool $has_media_spoiler = null; |
|
84 | 84 | |
85 | 85 | /** Optional. Message is a shared contact, information about the contact */ |
86 | - public null|contact $contact = null; |
|
86 | + public null | contact $contact = null; |
|
87 | 87 | |
88 | 88 | /** Optional. Message is a dice with random value */ |
89 | - public null|dice $dice = null; |
|
89 | + public null | dice $dice = null; |
|
90 | 90 | |
91 | 91 | /** Optional. Message is a game, information about the game. More about games » */ |
92 | - public null|game $game = null; |
|
92 | + public null | game $game = null; |
|
93 | 93 | |
94 | 94 | /** Optional. Message is a scheduled giveaway, information about the giveaway */ |
95 | - public null|giveaway $giveaway = null; |
|
95 | + public null | giveaway $giveaway = null; |
|
96 | 96 | |
97 | 97 | /** Optional. A giveaway with public winners was completed */ |
98 | - public null|giveawayWinners $giveaway_winners = null; |
|
98 | + public null | giveawayWinners $giveaway_winners = null; |
|
99 | 99 | |
100 | 100 | /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */ |
101 | - public null|invoice $invoice = null; |
|
101 | + public null | invoice $invoice = null; |
|
102 | 102 | |
103 | 103 | /** Optional. Message is a shared location, information about the location */ |
104 | - public null|location $location = null; |
|
104 | + public null | location $location = null; |
|
105 | 105 | |
106 | 106 | /** Optional. Message is a native poll, information about the poll */ |
107 | - public null|poll $poll = null; |
|
107 | + public null | poll $poll = null; |
|
108 | 108 | |
109 | 109 | /** Optional. Message is a venue, information about the venue */ |
110 | - public null|venue $venue = null; |
|
110 | + public null | venue $venue = null; |
|
111 | 111 | |
112 | 112 | |
113 | - public function __construct(stdClass|null $object = null) { |
|
113 | + public function __construct(stdClass | null $object = null) { |
|
114 | 114 | if ($object != null) { |
115 | 115 | parent::__construct($object, self::subs); |
116 | 116 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public string $custom_emoji; |
29 | 29 | |
30 | 30 | |
31 | - public function __construct(stdClass|null $object = null) { |
|
31 | + public function __construct(stdClass | null $object = null) { |
|
32 | 32 | if ($object != null) { |
33 | 33 | parent::__construct($object, self::subs); |
34 | 34 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public int $total_count; |
19 | 19 | |
20 | 20 | |
21 | - public function __construct(stdClass|null $object = null) { |
|
21 | + public function __construct(stdClass | null $object = null) { |
|
22 | 22 | if ($object != null) { |
23 | 23 | parent::__construct($object, self::subs); |
24 | 24 | } |
@@ -18,28 +18,28 @@ |
||
18 | 18 | public int $date; |
19 | 19 | |
20 | 20 | /** `user` only. User that sent the message originally */ |
21 | - public null|user $sender_user = null; |
|
21 | + public null | user $sender_user = null; |
|
22 | 22 | |
23 | 23 | /** `hidden_user` only. Name of the user that sent the message originally */ |
24 | - public null|string $sender_user_name = null; |
|
24 | + public null | string $sender_user_name = null; |
|
25 | 25 | |
26 | 26 | /** `chat` only. Chat that sent the message originally */ |
27 | - public null|chat $sender_chat = null; |
|
27 | + public null | chat $sender_chat = null; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * `chat` and `channel` only. Signature of the original post author, For messages originally sent by an anonymous |
31 | 31 | * chat administrator, original message author signature |
32 | 32 | */ |
33 | - public null|string $author_signature = null; |
|
33 | + public null | string $author_signature = null; |
|
34 | 34 | |
35 | 35 | /** `channel` only. Channel chat to which the message was originally sent */ |
36 | - public null|chat $chat = null; |
|
36 | + public null | chat $chat = null; |
|
37 | 37 | |
38 | 38 | /** `channel` only. Unique message identifier inside the chat */ |
39 | - public null|int $message_id = null; |
|
39 | + public null | int $message_id = null; |
|
40 | 40 | |
41 | 41 | |
42 | - public function __construct(stdClass|null $object = null) { |
|
42 | + public function __construct(stdClass | null $object = null) { |
|
43 | 43 | if ($object != null) { |
44 | 44 | parent::__construct($object, self::subs); |
45 | 45 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @internal Only for BPT self usage , Don't use it in your source! |
104 | 104 | */ |
105 | - public static function init (string $bot_name, array $global = [], array $user = [], array $group_user = [], array $group = [], array $supergroup = [], array $channel = []): void { |
|
106 | - self::$folder = $bot_name . 'database'; |
|
105 | + public static function init(string $bot_name, array $global = [], array $user = [], array $group_user = [], array $group = [], array $supergroup = [], array $channel = []): void { |
|
106 | + self::$folder = $bot_name.'database'; |
|
107 | 107 | self::$global_default_data = $global ?? self::$global_default_data; |
108 | 108 | self::setUserDefaultData($user); |
109 | 109 | self::setGroupUserDefaultData($group_user); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | self::load(); |
115 | 115 | } |
116 | 116 | |
117 | - private static function setUserDefaultData (array $user = []): void { |
|
117 | + private static function setUserDefaultData(array $user = []): void { |
|
118 | 118 | self::$user_default_data = $user ?? self::$user_default_data; |
119 | 119 | if (!isset(self::$user_default_data['step'])) { |
120 | 120 | self::$user_default_data['step'] = 'none'; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - private static function setGroupUserDefaultData (array $group_user = []): void { |
|
136 | + private static function setGroupUserDefaultData(array $group_user = []): void { |
|
137 | 137 | self::$group_user_default_data = $group_user ?? self::$group_user_default_data; |
138 | 138 | if (!isset(self::$group_user_default_data['step'])) { |
139 | 139 | self::$group_user_default_data['step'] = 'none'; |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | if (!file_exists(realpath(self::$folder.'/global.json'))) { |
164 | - file_put_contents(self::$folder.'/global.json',self::$global_default_data); |
|
164 | + file_put_contents(self::$folder.'/global.json', self::$global_default_data); |
|
165 | 165 | } |
166 | 166 | if (!file_exists(realpath(self::$folder.'/ids.json'))) { |
167 | - file_put_contents(self::$folder.'/ids.json',json_encode([ |
|
167 | + file_put_contents(self::$folder.'/ids.json', json_encode([ |
|
168 | 168 | 'privates' => [], |
169 | 169 | 'groups' => [], |
170 | 170 | 'supergroups' => [], |
@@ -173,25 +173,25 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - private static function load (): void { |
|
176 | + private static function load(): void { |
|
177 | 177 | self::$global = json_decode(file_get_contents(self::$folder.'/global.json')); |
178 | 178 | self::$old_global = clone self::$global; |
179 | - self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'),true); |
|
179 | + self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'), true); |
|
180 | 180 | self::$old_ids = clone self::$ids; |
181 | 181 | } |
182 | 182 | |
183 | - private static function read (string $address) { |
|
183 | + private static function read(string $address) { |
|
184 | 184 | return file_exists(realpath(self::$folder.'/'.$address.'.json')) ? json_decode(file_get_contents(self::$folder.'/'.$address.'.json'), false) : null; |
185 | 185 | } |
186 | 186 | |
187 | - private static function write (string $address,string $data): void { |
|
188 | - file_put_contents(self::$folder.'/'.$address.'.json',$data); |
|
187 | + private static function write(string $address, string $data): void { |
|
188 | + file_put_contents(self::$folder.'/'.$address.'.json', $data); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | 192 | * @internal Only for BPT self usage , Don't use it in your source! |
193 | 193 | */ |
194 | - public static function process (): void { |
|
194 | + public static function process(): void { |
|
195 | 195 | if (isset(BPT::$update->message)) { |
196 | 196 | self::processMessage(BPT::$update->message); |
197 | 197 | } |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public static function save(): void { |
216 | 216 | if (self::$user !== self::$old_user && !empty(self::$user_id)) { |
217 | - self::write('privates/' . self::$user_id,json_encode(self::$user)); |
|
217 | + self::write('privates/'.self::$user_id, json_encode(self::$user)); |
|
218 | 218 | } |
219 | 219 | if (self::$group !== self::$old_group && !empty(self::$group_id)) { |
220 | - self::write('groups/' . self::$group_id,json_encode(self::$group)); |
|
220 | + self::write('groups/'.self::$group_id, json_encode(self::$group)); |
|
221 | 221 | } |
222 | 222 | if (self::$supergroup !== self::$old_supergroup && !empty(self::$supergroup_id)) { |
223 | - self::write('supergroups/' . self::$supergroup_id,json_encode(self::$supergroup)); |
|
223 | + self::write('supergroups/'.self::$supergroup_id, json_encode(self::$supergroup)); |
|
224 | 224 | } |
225 | 225 | if (self::$channel !== self::$old_channel && !empty(self::$channel_id)) { |
226 | - self::write('channels/' . self::$channel_id,json_encode(self::$channel)); |
|
226 | + self::write('channels/'.self::$channel_id, json_encode(self::$channel)); |
|
227 | 227 | } |
228 | 228 | if (self::$group_user !== self::$old_group_user && !empty(self::$group_user_id)) { |
229 | 229 | if (empty(self::$group)) { |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | $category = 'groups'; |
235 | 235 | $group_id = self::$group_id; |
236 | 236 | } |
237 | - self::write($category . '/' . $group_id . '/' . self::$group_user_id,json_encode(self::$group_user)); |
|
237 | + self::write($category.'/'.$group_id.'/'.self::$group_user_id, json_encode(self::$group_user)); |
|
238 | 238 | } |
239 | 239 | if (self::$ids !== self::$old_ids) { |
240 | - self::write('ids',json_encode(self::$ids)); |
|
240 | + self::write('ids', json_encode(self::$ids)); |
|
241 | 241 | } |
242 | 242 | if (self::$global !== self::$old_global) { |
243 | - self::write('global',json_encode(self::$global)); |
|
243 | + self::write('global', json_encode(self::$global)); |
|
244 | 244 | } |
245 | 245 | if (self::$group_ids !== self::$old_group_ids) { |
246 | 246 | if (empty(self::$group)) { |
@@ -251,17 +251,17 @@ discard block |
||
251 | 251 | $category = 'groups'; |
252 | 252 | $group_id = self::$group_id; |
253 | 253 | } |
254 | - self::write($category . '/' . $group_id . '/users',json_encode(self::$group_user)); |
|
254 | + self::write($category.'/'.$group_id.'/users', json_encode(self::$group_user)); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | 258 | private static function processMessage(message $update): void { |
259 | 259 | $type = $update->chat->type; |
260 | - $category = $type . 's'; |
|
260 | + $category = $type.'s'; |
|
261 | 261 | if ($type === chatType::PRIVATE) { |
262 | 262 | self::$user_id = $update->from->id; |
263 | - if (in_array(self::$user_id,self::$ids[$category])) { |
|
264 | - self::$user = self::read($category . '/' . self::$user_id); |
|
263 | + if (in_array(self::$user_id, self::$ids[$category])) { |
|
264 | + self::$user = self::read($category.'/'.self::$user_id); |
|
265 | 265 | self::$old_user = clone self::$user; |
266 | 266 | self::$user->last_active = time(); |
267 | 267 | } |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | self::$ids[$category][] = self::$user_id; |
270 | 270 | self::$user = (object) self::$user_default_data; |
271 | 271 | self::$user->first_active = self::$user->last_active = time(); |
272 | - if (isset($update->command) && isset($update->command_payload) && $update->command === 'start' && str_starts_with($update->command_payload,'ref_')) { |
|
273 | - if (tools::isShorted(substr($update->command_payload,4))) { |
|
274 | - $referral = tools::shortDecode(substr($update->command_payload,4)); |
|
275 | - if (in_array($referral,self::$ids[$category])) { |
|
272 | + if (isset($update->command) && isset($update->command_payload) && $update->command === 'start' && str_starts_with($update->command_payload, 'ref_')) { |
|
273 | + if (tools::isShorted(substr($update->command_payload, 4))) { |
|
274 | + $referral = tools::shortDecode(substr($update->command_payload, 4)); |
|
275 | + if (in_array($referral, self::$ids[$category])) { |
|
276 | 276 | self::$user->referral = $referral; |
277 | 277 | } |
278 | 278 | } |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | } |
282 | 282 | elseif ($type === chatType::CHANNEL) { |
283 | 283 | self::$channel_id = $update->chat->id; |
284 | - if (in_array(self::$channel_id,self::$ids[$category])) { |
|
285 | - self::$channel = self::read($category . '/' . self::$channel_id); |
|
284 | + if (in_array(self::$channel_id, self::$ids[$category])) { |
|
285 | + self::$channel = self::read($category.'/'.self::$channel_id); |
|
286 | 286 | self::$old_channel = clone self::$channel; |
287 | 287 | } |
288 | 288 | else { |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | $chat_id = $update->chat->id; |
297 | 297 | if ($type === chatType::SUPERGROUP) { |
298 | 298 | self::$supergroup_id = $update->chat->id; |
299 | - if (in_array($chat_id,self::$ids[$category])) { |
|
300 | - self::$supergroup = self::read($category . '/' . $chat_id); |
|
299 | + if (in_array($chat_id, self::$ids[$category])) { |
|
300 | + self::$supergroup = self::read($category.'/'.$chat_id); |
|
301 | 301 | self::$old_supergroup = clone self::$supergroup; |
302 | - self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
|
302 | + self::$group_ids = self::read($category.'/'.$chat_id.'/users'); |
|
303 | 303 | self::$old_group_ids = clone self::$group_ids; |
304 | 304 | } |
305 | 305 | else { |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | } |
311 | 311 | else { |
312 | 312 | self::$group_id = $update->chat->id; |
313 | - if (in_array($chat_id,self::$ids[$category])) { |
|
314 | - self::$group = self::read($category . '/' . $chat_id); |
|
313 | + if (in_array($chat_id, self::$ids[$category])) { |
|
314 | + self::$group = self::read($category.'/'.$chat_id); |
|
315 | 315 | self::$old_group = clone self::$group; |
316 | - self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
|
316 | + self::$group_ids = self::read($category.'/'.$chat_id.'/users'); |
|
317 | 317 | self::$old_group_ids = clone self::$group_ids; |
318 | 318 | } |
319 | 319 | else { |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
326 | - if (in_array(self::$user_id,self::$group_ids)) { |
|
327 | - self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id); |
|
326 | + if (in_array(self::$user_id, self::$group_ids)) { |
|
327 | + self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id); |
|
328 | 328 | self::$old_group_user = clone self::$group_user; |
329 | 329 | } |
330 | 330 | else { |
@@ -340,42 +340,42 @@ discard block |
||
340 | 340 | |
341 | 341 | private static function processCallbackQuery(callbackQuery $update): void { |
342 | 342 | $type = $update->message->chat->type; |
343 | - $category = $type . 's'; |
|
343 | + $category = $type.'s'; |
|
344 | 344 | if ($type === chatType::PRIVATE) { |
345 | 345 | self::$user_id = $update->from->id; |
346 | - if (in_array(self::$user_id,self::$ids[$category])) { |
|
347 | - self::$user = self::read($category . '/' . self::$user_id); |
|
346 | + if (in_array(self::$user_id, self::$ids[$category])) { |
|
347 | + self::$user = self::read($category.'/'.self::$user_id); |
|
348 | 348 | self::$old_user = clone self::$user; |
349 | 349 | self::$user->last_active = time(); |
350 | 350 | } |
351 | 351 | } |
352 | 352 | elseif ($type === chatType::CHANNEL) { |
353 | 353 | self::$channel_id = $update->message->chat->id; |
354 | - if (in_array(self::$channel_id,self::$ids[$category])) { |
|
355 | - self::$channel = self::read($category . '/' . self::$channel_id); |
|
354 | + if (in_array(self::$channel_id, self::$ids[$category])) { |
|
355 | + self::$channel = self::read($category.'/'.self::$channel_id); |
|
356 | 356 | self::$old_channel = clone self::$channel; |
357 | 357 | } |
358 | 358 | } |
359 | 359 | else { |
360 | 360 | self::$user_id = $update->from->id; |
361 | 361 | $chat_id = $update->message->chat->id; |
362 | - if (in_array($chat_id,self::$ids[$category])) { |
|
362 | + if (in_array($chat_id, self::$ids[$category])) { |
|
363 | 363 | if ($type === chatType::SUPERGROUP) { |
364 | 364 | self::$supergroup_id = $update->message->chat->id; |
365 | - self::$supergroup = self::read($category . '/' . $chat_id); |
|
365 | + self::$supergroup = self::read($category.'/'.$chat_id); |
|
366 | 366 | self::$old_supergroup = clone self::$supergroup; |
367 | 367 | } |
368 | 368 | else { |
369 | 369 | self::$group_id = $update->message->chat->id; |
370 | - self::$group = self::read($category . '/' . $chat_id); |
|
370 | + self::$group = self::read($category.'/'.$chat_id); |
|
371 | 371 | self::$old_group = clone self::$group; |
372 | 372 | } |
373 | - self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
|
373 | + self::$group_ids = self::read($category.'/'.$chat_id.'/users'); |
|
374 | 374 | self::$old_group_ids = clone self::$group_ids; |
375 | 375 | } |
376 | 376 | |
377 | - if (in_array(self::$user_id,self::$group_ids)) { |
|
378 | - self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id); |
|
377 | + if (in_array(self::$user_id, self::$group_ids)) { |
|
378 | + self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id); |
|
379 | 379 | self::$group_user_id = self::$user_id; |
380 | 380 | self::$old_group_user = clone self::$group_user; |
381 | 381 | } |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | private static function processInlineQuery(inlineQuery $update): void { |
390 | 390 | $type = $update->chat_type; |
391 | 391 | if ($type === chatType::PRIVATE || $type === chatType::SENDER) { |
392 | - $category = chatType::PRIVATE . 's'; |
|
392 | + $category = chatType::PRIVATE.'s'; |
|
393 | 393 | self::$user_id = $update->from->id; |
394 | - if (in_array(self::$user_id,self::$ids[$category])) { |
|
395 | - self::$user = self::read($category . '/' . self::$user_id); |
|
394 | + if (in_array(self::$user_id, self::$ids[$category])) { |
|
395 | + self::$user = self::read($category.'/'.self::$user_id); |
|
396 | 396 | self::$old_user = clone self::$user; |
397 | 397 | self::$user->last_active = time(); |
398 | 398 | } |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | private static function processChatMember(chatMemberUpdated $update): void { |
403 | 403 | $type = $update->chat->type; |
404 | 404 | |
405 | - $category = $type . 's'; |
|
405 | + $category = $type.'s'; |
|
406 | 406 | if ($type === chatType::CHANNEL) { |
407 | 407 | self::$channel_id = $update->chat->id; |
408 | - if (in_array(self::$channel_id,self::$ids[$category])) { |
|
409 | - self::$channel = self::read($category . '/' . self::$channel_id); |
|
408 | + if (in_array(self::$channel_id, self::$ids[$category])) { |
|
409 | + self::$channel = self::read($category.'/'.self::$channel_id); |
|
410 | 410 | self::$old_channel = clone self::$channel; |
411 | 411 | } |
412 | 412 | else { |
@@ -425,10 +425,10 @@ discard block |
||
425 | 425 | |
426 | 426 | if ($type === chatType::SUPERGROUP) { |
427 | 427 | self::$supergroup_id = $chat_id; |
428 | - if (in_array($chat_id,self::$ids[$category])) { |
|
429 | - self::$supergroup = self::read($category . '/' . $chat_id); |
|
428 | + if (in_array($chat_id, self::$ids[$category])) { |
|
429 | + self::$supergroup = self::read($category.'/'.$chat_id); |
|
430 | 430 | self::$old_supergroup = clone self::$supergroup; |
431 | - self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
|
431 | + self::$group_ids = self::read($category.'/'.$chat_id.'/users'); |
|
432 | 432 | self::$old_group_ids = clone self::$group_ids; |
433 | 433 | } |
434 | 434 | else { |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | } |
440 | 440 | elseif ($type === chatType::GROUP) { |
441 | 441 | self::$group_id = $chat_id; |
442 | - if (in_array($chat_id,self::$ids[$category])) { |
|
443 | - self::$group = self::read($category . '/' . $chat_id); |
|
442 | + if (in_array($chat_id, self::$ids[$category])) { |
|
443 | + self::$group = self::read($category.'/'.$chat_id); |
|
444 | 444 | self::$old_group = clone self::$group; |
445 | - self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
|
445 | + self::$group_ids = self::read($category.'/'.$chat_id.'/users'); |
|
446 | 446 | self::$old_group_ids = clone self::$group_ids; |
447 | 447 | } |
448 | 448 | else { |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | - if (!in_array($user_id,self::$group_ids)) { |
|
455 | + if (!in_array($user_id, self::$group_ids)) { |
|
456 | 456 | self::$group_ids[] = $user_id; |
457 | 457 | self::$group_user = (object) self::$group_user_default_data; |
458 | 458 | } |
459 | 459 | else { |
460 | 460 | self::$group_user_id = $by_id == $user_id ? $user_id : $by_id; |
461 | - self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id); |
|
461 | + self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$group_user_id); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | if ($new_user->status === chatMemberStatus::LEFT || $new_user->status === chatMemberStatus::KICKED) { |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | * @return bool |
498 | 498 | * @throws bptException |
499 | 499 | */ |
500 | - public static function deleteUser (int $user_id = null): bool { |
|
500 | + public static function deleteUser(int $user_id = null): bool { |
|
501 | 501 | if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID); |
502 | - if (!file_exists(realpath(self::$folder . '/privates/' . $user_id . '.json'))) { |
|
502 | + if (!file_exists(realpath(self::$folder.'/privates/'.$user_id.'.json'))) { |
|
503 | 503 | return false; |
504 | 504 | } |
505 | 505 | unset(self::$ids['privates'][array_search($user_id, self::$ids['privates'])]); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | if ($user_id === self::$user_id) { |
508 | 508 | self::$user = self::$old_user = null; |
509 | 509 | } |
510 | - return tools::delete(self::$folder . '/privates/' . $user_id . '.json'); |
|
510 | + return tools::delete(self::$folder.'/privates/'.$user_id.'.json'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -518,18 +518,18 @@ discard block |
||
518 | 518 | * @return bool |
519 | 519 | * @throws bptException |
520 | 520 | */ |
521 | - public static function deleteGroup (int $group_id = null): bool { |
|
521 | + public static function deleteGroup(int $group_id = null): bool { |
|
522 | 522 | if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID); |
523 | - if (!file_exists(realpath(self::$folder . '/groups/' . $group_id . '.json'))) { |
|
523 | + if (!file_exists(realpath(self::$folder.'/groups/'.$group_id.'.json'))) { |
|
524 | 524 | return false; |
525 | 525 | } |
526 | 526 | unset(self::$ids['groups'][array_search($group_id, self::$ids['groups'])]); |
527 | 527 | sort(self::$ids['groups']); |
528 | - tools::delete(self::$folder . '/groups/' . $group_id); |
|
528 | + tools::delete(self::$folder.'/groups/'.$group_id); |
|
529 | 529 | if ($group_id === self::$group_id) { |
530 | 530 | self::$group = self::$old_group = null; |
531 | 531 | } |
532 | - return tools::delete(self::$folder . '/groups/' . $group_id . '.json'); |
|
532 | + return tools::delete(self::$folder.'/groups/'.$group_id.'.json'); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
@@ -540,18 +540,18 @@ discard block |
||
540 | 540 | * @return bool |
541 | 541 | * @throws bptException |
542 | 542 | */ |
543 | - public static function deleteSuperGroup (int $group_id = null): bool { |
|
543 | + public static function deleteSuperGroup(int $group_id = null): bool { |
|
544 | 544 | if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID); |
545 | - if (!file_exists(realpath(self::$folder . '/supergroups/' . $group_id . '.json'))) { |
|
545 | + if (!file_exists(realpath(self::$folder.'/supergroups/'.$group_id.'.json'))) { |
|
546 | 546 | return false; |
547 | 547 | } |
548 | 548 | unset(self::$ids['supergroups'][array_search($group_id, self::$ids['supergroups'])]); |
549 | 549 | sort(self::$ids['supergroups']); |
550 | - tools::delete(self::$folder . '/supergroups/' . $group_id); |
|
550 | + tools::delete(self::$folder.'/supergroups/'.$group_id); |
|
551 | 551 | if ($group_id === self::$supergroup_id) { |
552 | 552 | self::$supergroup = self::$old_supergroup = null; |
553 | 553 | } |
554 | - return tools::delete(self::$folder . '/supergroups/' . $group_id . '.json'); |
|
554 | + return tools::delete(self::$folder.'/supergroups/'.$group_id.'.json'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | * @return bool |
563 | 563 | * @throws bptException |
564 | 564 | */ |
565 | - public static function deleteChannel (int $channel_id = null): bool { |
|
565 | + public static function deleteChannel(int $channel_id = null): bool { |
|
566 | 566 | if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID); |
567 | - if (!file_exists(realpath(self::$folder . '/channels/' . $channel_id . '.json'))) { |
|
567 | + if (!file_exists(realpath(self::$folder.'/channels/'.$channel_id.'.json'))) { |
|
568 | 568 | return false; |
569 | 569 | } |
570 | 570 | unset(self::$ids['channels'][array_search($channel_id, self::$ids['channels'])]); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | if ($channel_id === self::$channel_id) { |
573 | 573 | self::$channel = self::$old_channel = null; |
574 | 574 | } |
575 | - return tools::delete(self::$folder . '/channels/' . $channel_id . '.json'); |
|
575 | + return tools::delete(self::$folder.'/channels/'.$channel_id.'.json'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return int[] |
582 | 582 | */ |
583 | - public static function getUsers (): array { |
|
583 | + public static function getUsers(): array { |
|
584 | 584 | return self::$ids['privates'] ?? []; |
585 | 585 | } |
586 | 586 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @return int[] |
591 | 591 | */ |
592 | - public static function getGroups (): array { |
|
592 | + public static function getGroups(): array { |
|
593 | 593 | return self::$ids['groups'] ?? []; |
594 | 594 | } |
595 | 595 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return int[] |
600 | 600 | */ |
601 | - public static function getSuperGroups (): array { |
|
601 | + public static function getSuperGroups(): array { |
|
602 | 602 | return self::$ids['supergroups'] ?? []; |
603 | 603 | } |
604 | 604 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * |
608 | 608 | * @return int[] |
609 | 609 | */ |
610 | - public static function getChannels (): array { |
|
610 | + public static function getChannels(): array { |
|
611 | 611 | return self::$ids['channels'] ?? []; |
612 | 612 | } |
613 | 613 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public chatBoostSource $source; |
28 | 28 | |
29 | 29 | |
30 | - public function __construct(stdClass|null $object = null) { |
|
30 | + public function __construct(stdClass | null $object = null) { |
|
31 | 31 | if ($object != null) { |
32 | 32 | parent::__construct($object, self::subs); |
33 | 33 | } |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | public int $duration; |
30 | 30 | |
31 | 31 | /** Optional. Video thumbnail */ |
32 | - public null|photoSize $thumbnail = null; |
|
32 | + public null | photoSize $thumbnail = null; |
|
33 | 33 | |
34 | 34 | /** Optional. File size in bytes */ |
35 | - public null|int $file_size = null; |
|
35 | + public null | int $file_size = null; |
|
36 | 36 | |
37 | 37 | |
38 | - public function __construct(stdClass|null $object = null) { |
|
38 | + public function __construct(stdClass | null $object = null) { |
|
39 | 39 | if ($object != null) { |
40 | 40 | parent::__construct($object, self::subs); |
41 | 41 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return bool|string string will be returned when destination doesn't set |
58 | 58 | */ |
59 | - public function download(string|null $destination = null): bool|string { |
|
60 | - return telegram::downloadFile($destination ?? 'unknown.mp4',$this->file_id); |
|
59 | + public function download(string | null $destination = null): bool | string { |
|
60 | + return telegram::downloadFile($destination ?? 'unknown.mp4', $this->file_id); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return telegram::fileLink($this->file_id); |
72 | 72 | } |
73 | 73 | |
74 | - public function typedSize (int $precision = 2, bool $space_between = true): string { |
|
74 | + public function typedSize(int $precision = 2, bool $space_between = true): string { |
|
75 | 75 | return tools::byteFormat($this->file_id, $precision, $space_between); |
76 | 76 | } |
77 | 77 | } |
@@ -32,23 +32,23 @@ discard block |
||
32 | 32 | public int $duration; |
33 | 33 | |
34 | 34 | /** Optional. Animation thumbnail as defined by sender */ |
35 | - public null|photoSize $thumbnail = null; |
|
35 | + public null | photoSize $thumbnail = null; |
|
36 | 36 | |
37 | 37 | /** Optional. Original animation filename as defined by sender */ |
38 | - public null|string $file_name = null; |
|
38 | + public null | string $file_name = null; |
|
39 | 39 | |
40 | 40 | /** Optional. MIME type of the file as defined by sender */ |
41 | - public null|string $mime_type = null; |
|
41 | + public null | string $mime_type = null; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
45 | 45 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
46 | 46 | * integer or double-precision float type are safe for storing this value. |
47 | 47 | */ |
48 | - public null|int $file_size = null; |
|
48 | + public null | int $file_size = null; |
|
49 | 49 | |
50 | 50 | |
51 | - public function __construct(stdClass|null $object = null) { |
|
51 | + public function __construct(stdClass | null $object = null) { |
|
52 | 52 | if ($object != null) { |
53 | 53 | parent::__construct($object, self::subs); |
54 | 54 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return bool|string string will be returned when destination doesn't set |
71 | 71 | */ |
72 | - public function download(string|null $destination = null): bool|string { |
|
73 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.gif',$this->file_id); |
|
72 | + public function download(string | null $destination = null): bool | string { |
|
73 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.gif', $this->file_id); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return telegram::fileLink($this->file_id); |
85 | 85 | } |
86 | 86 | |
87 | - public function typedSize (int $precision = 2, bool $space_between = true): string { |
|
87 | + public function typedSize(int $precision = 2, bool $space_between = true): string { |
|
88 | 88 | return tools::byteFormat($this->file_id, $precision, $space_between); |
89 | 89 | } |
90 | 90 | } |
@@ -15,10 +15,10 @@ |
||
15 | 15 | public string $address; |
16 | 16 | |
17 | 17 | /** Optional. Location of the business */ |
18 | - public null|location $location = null; |
|
18 | + public null | location $location = null; |
|
19 | 19 | |
20 | 20 | |
21 | - public function __construct(stdClass|null $object = null) { |
|
21 | + public function __construct(stdClass | null $object = null) { |
|
22 | 22 | if ($object != null) { |
23 | 23 | parent::__construct($object, self::subs); |
24 | 24 | } |