@@ -195,17 +195,13 @@ discard block |
||
| 195 | 195 | public static function process (): void { |
| 196 | 196 | if (isset(BPT::$update->message)) { |
| 197 | 197 | self::processMessage(BPT::$update->message); |
| 198 | - } |
|
| 199 | - elseif (isset(BPT::$update->edited_message)) { |
|
| 198 | + } elseif (isset(BPT::$update->edited_message)) { |
|
| 200 | 199 | self::processMessage(BPT::$update->edited_message); |
| 201 | - } |
|
| 202 | - elseif (isset(BPT::$update->callback_query)) { |
|
| 200 | + } elseif (isset(BPT::$update->callback_query)) { |
|
| 203 | 201 | self::processCallbackQuery(BPT::$update->callback_query); |
| 204 | - } |
|
| 205 | - elseif (isset(BPT::$update->inline_query)) { |
|
| 202 | + } elseif (isset(BPT::$update->inline_query)) { |
|
| 206 | 203 | self::processInlineQuery(BPT::$update->inline_query); |
| 207 | - } |
|
| 208 | - elseif (isset(BPT::$update->chat_member)) { |
|
| 204 | + } elseif (isset(BPT::$update->chat_member)) { |
|
| 209 | 205 | self::processChatMember(BPT::$update->chat_member); |
| 210 | 206 | } |
| 211 | 207 | } |
@@ -230,8 +226,7 @@ discard block |
||
| 230 | 226 | if (empty(self::$group)) { |
| 231 | 227 | $category = 'supergroups'; |
| 232 | 228 | $group_id = self::$supergroup_id; |
| 233 | - } |
|
| 234 | - else { |
|
| 229 | + } else { |
|
| 235 | 230 | $category = 'groups'; |
| 236 | 231 | $group_id = self::$group_id; |
| 237 | 232 | } |
@@ -247,8 +242,7 @@ discard block |
||
| 247 | 242 | if (empty(self::$group)) { |
| 248 | 243 | $category = 'supergroups'; |
| 249 | 244 | $group_id = self::$supergroup_id; |
| 250 | - } |
|
| 251 | - else { |
|
| 245 | + } else { |
|
| 252 | 246 | $category = 'groups'; |
| 253 | 247 | $group_id = self::$group_id; |
| 254 | 248 | } |
@@ -265,8 +259,7 @@ discard block |
||
| 265 | 259 | self::$user = self::read($category . '/' . self::$user_id); |
| 266 | 260 | self::$old_user = clone self::$user; |
| 267 | 261 | self::$user->last_active = time(); |
| 268 | - } |
|
| 269 | - else { |
|
| 262 | + } else { |
|
| 270 | 263 | self::$ids[$category][] = self::$user_id; |
| 271 | 264 | self::$user = (object) self::$user_default_data; |
| 272 | 265 | self::$user->first_active = self::$user->last_active = time(); |
@@ -279,19 +272,16 @@ discard block |
||
| 279 | 272 | } |
| 280 | 273 | } |
| 281 | 274 | } |
| 282 | - } |
|
| 283 | - elseif ($type === chatType::CHANNEL) { |
|
| 275 | + } elseif ($type === chatType::CHANNEL) { |
|
| 284 | 276 | self::$channel_id = $update->chat->id; |
| 285 | 277 | if (in_array(self::$channel_id,self::$ids[$category])) { |
| 286 | 278 | self::$channel = self::read($category . '/' . self::$channel_id); |
| 287 | 279 | self::$old_channel = clone self::$channel; |
| 288 | - } |
|
| 289 | - else { |
|
| 280 | + } else { |
|
| 290 | 281 | self::$ids[$category][] = self::$channel_id; |
| 291 | 282 | self::$channel = (object) self::$channel_default_data; |
| 292 | 283 | } |
| 293 | - } |
|
| 294 | - else { |
|
| 284 | + } else { |
|
| 295 | 285 | self::$user_id = $update->from->id; |
| 296 | 286 | self::$group_user_id = self::$user_id; |
| 297 | 287 | $chat_id = $update->chat->id; |
@@ -302,22 +292,19 @@ discard block |
||
| 302 | 292 | self::$old_supergroup = clone self::$supergroup; |
| 303 | 293 | self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
| 304 | 294 | self::$old_group_ids = clone self::$group_ids; |
| 305 | - } |
|
| 306 | - else { |
|
| 295 | + } else { |
|
| 307 | 296 | self::$ids[$category][] = $chat_id; |
| 308 | 297 | self::$supergroup = (object) self::$supergroup_default_data; |
| 309 | 298 | self::$group_ids = []; |
| 310 | 299 | } |
| 311 | - } |
|
| 312 | - else { |
|
| 300 | + } else { |
|
| 313 | 301 | self::$group_id = $update->chat->id; |
| 314 | 302 | if (in_array($chat_id,self::$ids[$category])) { |
| 315 | 303 | self::$group = self::read($category . '/' . $chat_id); |
| 316 | 304 | self::$old_group = clone self::$group; |
| 317 | 305 | self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
| 318 | 306 | self::$old_group_ids = clone self::$group_ids; |
| 319 | - } |
|
| 320 | - else { |
|
| 307 | + } else { |
|
| 321 | 308 | self::$ids[$category][] = $chat_id; |
| 322 | 309 | self::$group = (object) self::$group_default_data; |
| 323 | 310 | self::$group_ids = []; |
@@ -327,15 +314,16 @@ discard block |
||
| 327 | 314 | if (in_array(self::$user_id,self::$group_ids)) { |
| 328 | 315 | self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id); |
| 329 | 316 | self::$old_group_user = clone self::$group_user; |
| 330 | - } |
|
| 331 | - else { |
|
| 317 | + } else { |
|
| 332 | 318 | self::$group_ids[] = self::$user_id; |
| 333 | 319 | self::$group_user = (object) self::$group_user_default_data; |
| 334 | 320 | } |
| 335 | 321 | |
| 336 | 322 | self::$user = self::read($category.'/'.self::$user_id); |
| 337 | 323 | self::$old_user = clone self::$user; |
| 338 | - if (!empty(self::$user)) self::$user->last_active = time(); |
|
| 324 | + if (!empty(self::$user)) { |
|
| 325 | + self::$user->last_active = time(); |
|
| 326 | + } |
|
| 339 | 327 | } |
| 340 | 328 | } |
| 341 | 329 | |
@@ -349,15 +337,13 @@ discard block |
||
| 349 | 337 | self::$old_user = clone self::$user; |
| 350 | 338 | self::$user->last_active = time(); |
| 351 | 339 | } |
| 352 | - } |
|
| 353 | - elseif ($type === chatType::CHANNEL) { |
|
| 340 | + } elseif ($type === chatType::CHANNEL) { |
|
| 354 | 341 | self::$channel_id = $update->message->chat->id; |
| 355 | 342 | if (in_array(self::$channel_id,self::$ids[$category])) { |
| 356 | 343 | self::$channel = self::read($category . '/' . self::$channel_id); |
| 357 | 344 | self::$old_channel = clone self::$channel; |
| 358 | 345 | } |
| 359 | - } |
|
| 360 | - else { |
|
| 346 | + } else { |
|
| 361 | 347 | self::$user_id = $update->from->id; |
| 362 | 348 | $chat_id = $update->message->chat->id; |
| 363 | 349 | if (in_array($chat_id,self::$ids[$category])) { |
@@ -365,8 +351,7 @@ discard block |
||
| 365 | 351 | self::$supergroup_id = $update->message->chat->id; |
| 366 | 352 | self::$supergroup = self::read($category . '/' . $chat_id); |
| 367 | 353 | self::$old_supergroup = clone self::$supergroup; |
| 368 | - } |
|
| 369 | - else { |
|
| 354 | + } else { |
|
| 370 | 355 | self::$group_id = $update->message->chat->id; |
| 371 | 356 | self::$group = self::read($category . '/' . $chat_id); |
| 372 | 357 | self::$old_group = clone self::$group; |
@@ -383,7 +368,9 @@ discard block |
||
| 383 | 368 | |
| 384 | 369 | self::$user = self::read($category.'/'.self::$user_id); |
| 385 | 370 | self::$old_user = clone self::$user; |
| 386 | - if (!empty(self::$user)) self::$user->last_active = time(); |
|
| 371 | + if (!empty(self::$user)) { |
|
| 372 | + self::$user->last_active = time(); |
|
| 373 | + } |
|
| 387 | 374 | } |
| 388 | 375 | } |
| 389 | 376 | |
@@ -409,13 +396,11 @@ discard block |
||
| 409 | 396 | if (in_array(self::$channel_id,self::$ids[$category])) { |
| 410 | 397 | self::$channel = self::read($category . '/' . self::$channel_id); |
| 411 | 398 | self::$old_channel = clone self::$channel; |
| 412 | - } |
|
| 413 | - else { |
|
| 399 | + } else { |
|
| 414 | 400 | self::$ids[$category][] = self::$channel_id; |
| 415 | 401 | self::$channel = (object) self::$channel_default_data; |
| 416 | 402 | } |
| 417 | - } |
|
| 418 | - else { |
|
| 403 | + } else { |
|
| 419 | 404 | $chat_id = $update->chat->id; |
| 420 | 405 | $by_id = $update->from->id; |
| 421 | 406 | $old_user = $update->old_chat_member; |
@@ -431,22 +416,19 @@ discard block |
||
| 431 | 416 | self::$old_supergroup = clone self::$supergroup; |
| 432 | 417 | self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
| 433 | 418 | self::$old_group_ids = clone self::$group_ids; |
| 434 | - } |
|
| 435 | - else { |
|
| 419 | + } else { |
|
| 436 | 420 | self::$ids[$category][] = $chat_id; |
| 437 | 421 | self::$supergroup = (object) self::$supergroup_default_data; |
| 438 | 422 | self::$group_ids = []; |
| 439 | 423 | } |
| 440 | - } |
|
| 441 | - elseif ($type === chatType::GROUP) { |
|
| 424 | + } elseif ($type === chatType::GROUP) { |
|
| 442 | 425 | self::$group_id = $chat_id; |
| 443 | 426 | if (in_array($chat_id,self::$ids[$category])) { |
| 444 | 427 | self::$group = self::read($category . '/' . $chat_id); |
| 445 | 428 | self::$old_group = clone self::$group; |
| 446 | 429 | self::$group_ids = self::read($category . '/' . $chat_id . '/users'); |
| 447 | 430 | self::$old_group_ids = clone self::$group_ids; |
| 448 | - } |
|
| 449 | - else { |
|
| 431 | + } else { |
|
| 450 | 432 | self::$ids[$category][] = $chat_id; |
| 451 | 433 | self::$group = (object) self::$group_default_data; |
| 452 | 434 | self::$group_ids = []; |
@@ -456,8 +438,7 @@ discard block |
||
| 456 | 438 | if (!in_array($user_id,self::$group_ids)) { |
| 457 | 439 | self::$group_ids[] = $user_id; |
| 458 | 440 | self::$group_user = (object) self::$group_user_default_data; |
| 459 | - } |
|
| 460 | - else { |
|
| 441 | + } else { |
|
| 461 | 442 | self::$group_user_id = $by_id == $user_id ? $user_id : $by_id; |
| 462 | 443 | self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id); |
| 463 | 444 | } |
@@ -470,8 +451,7 @@ discard block |
||
| 470 | 451 | self::$group_user->removed_by = $by_id; |
| 471 | 452 | } |
| 472 | 453 | } |
| 473 | - } |
|
| 474 | - elseif ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) { |
|
| 454 | + } elseif ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) { |
|
| 475 | 455 | self::$group_user->presence = true; |
| 476 | 456 | self::$group_user->removed = false; |
| 477 | 457 | self::$group_user->removed_by = null; |
@@ -480,8 +460,7 @@ discard block |
||
| 480 | 460 | if (!empty($invite_link)) { |
| 481 | 461 | self::$group_user->accepted_by = $by_id; |
| 482 | 462 | self::$group_user->invited_by = null; |
| 483 | - } |
|
| 484 | - else { |
|
| 463 | + } else { |
|
| 485 | 464 | self::$group_user->invited_by = $by_id; |
| 486 | 465 | self::$group_user->accepted_by = null; |
| 487 | 466 | } |
@@ -499,7 +478,9 @@ discard block |
||
| 499 | 478 | * @throws bptException |
| 500 | 479 | */ |
| 501 | 480 | public static function deleteUser (int $user_id = null): bool { |
| 502 | - if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID); |
|
| 481 | + if (empty($user_id)) { |
|
| 482 | + $user_id = telegram::catchFields(fields::USER_ID); |
|
| 483 | + } |
|
| 503 | 484 | if (!file_exists(realpath(self::$folder . '/privates/' . $user_id . '.json'))) { |
| 504 | 485 | return false; |
| 505 | 486 | } |
@@ -520,7 +501,9 @@ discard block |
||
| 520 | 501 | * @throws bptException |
| 521 | 502 | */ |
| 522 | 503 | public static function deleteGroup (int $group_id = null): bool { |
| 523 | - if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID); |
|
| 504 | + if (empty($group_id)) { |
|
| 505 | + $group_id = telegram::catchFields(fields::CHAT_ID); |
|
| 506 | + } |
|
| 524 | 507 | if (!file_exists(realpath(self::$folder . '/groups/' . $group_id . '.json'))) { |
| 525 | 508 | return false; |
| 526 | 509 | } |
@@ -542,7 +525,9 @@ discard block |
||
| 542 | 525 | * @throws bptException |
| 543 | 526 | */ |
| 544 | 527 | public static function deleteSuperGroup (int $group_id = null): bool { |
| 545 | - if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID); |
|
| 528 | + if (empty($group_id)) { |
|
| 529 | + $group_id = telegram::catchFields(fields::CHAT_ID); |
|
| 530 | + } |
|
| 546 | 531 | if (!file_exists(realpath(self::$folder . '/supergroups/' . $group_id . '.json'))) { |
| 547 | 532 | return false; |
| 548 | 533 | } |
@@ -564,7 +549,9 @@ discard block |
||
| 564 | 549 | * @throws bptException |
| 565 | 550 | */ |
| 566 | 551 | public static function deleteChannel (int $channel_id = null): bool { |
| 567 | - if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID); |
|
| 552 | + if (empty($channel_id)) { |
|
| 553 | + $channel_id = telegram::catchFields(fields::CHAT_ID); |
|
| 554 | + } |
|
| 568 | 555 | if (!file_exists(realpath(self::$folder . '/channels/' . $channel_id . '.json'))) { |
| 569 | 556 | return false; |
| 570 | 557 | } |
@@ -22,23 +22,19 @@ discard block |
||
| 22 | 22 | foreach ($object as $key=>$value) { |
| 23 | 23 | if (isset($subs[$key])) { |
| 24 | 24 | $this->{$key} = new ($subs[$key]) ($value); |
| 25 | - } |
|
| 26 | - elseif (is_array($value) && isset($subs['array'])) { |
|
| 25 | + } elseif (is_array($value) && isset($subs['array'])) { |
|
| 27 | 26 | foreach ($value as $sub_key => $sub_value) { |
| 28 | 27 | if (is_array($sub_value) && isset($subs['array']['array'])) { |
| 29 | 28 | foreach ($sub_value as $sub2_value) { |
| 30 | 29 | $this->{$key}[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
| 31 | 30 | } |
| 32 | - } |
|
| 33 | - elseif (isset($subs['array'][$key])) { |
|
| 31 | + } elseif (isset($subs['array'][$key])) { |
|
| 34 | 32 | $this->{$key}[] = new ($subs['array'][$key]) ($sub_value); |
| 35 | - } |
|
| 36 | - else { |
|
| 33 | + } else { |
|
| 37 | 34 | $this->{$key}[] = $sub_value; |
| 38 | 35 | } |
| 39 | 36 | } |
| 40 | - } |
|
| 41 | - else { |
|
| 37 | + } else { |
|
| 42 | 38 | $this->{$key} = $value; |
| 43 | 39 | if (ucfirst($key) === basename(get_class($this)) . '_id') { |
| 44 | 40 | $this->{'id'} = $value; |
@@ -53,8 +49,7 @@ discard block |
||
| 53 | 49 | $name = substr($name,3); |
| 54 | 50 | if (isset($arguments[0])) { |
| 55 | 51 | $this->{$name} = $arguments[0]; |
| 56 | - } |
|
| 57 | - elseif (isset($arguments['value'])) { |
|
| 52 | + } elseif (isset($arguments['value'])) { |
|
| 58 | 53 | $this->{$name} = $arguments['value']; |
| 59 | 54 | } |
| 60 | 55 | } |
@@ -219,8 +219,9 @@ discard block |
||
| 219 | 219 | if (telegram::$status) { |
| 220 | 220 | $check = $check->status; |
| 221 | 221 | $result[$id] = $check !== chatMemberStatus::LEFT && $check !== chatMemberStatus::KICKED; |
| 222 | + } else { |
|
| 223 | + $result[$id] = null; |
|
| 222 | 224 | } |
| 223 | - else $result[$id] = null; |
|
| 224 | 225 | } |
| 225 | 226 | return $result; |
| 226 | 227 | } |
@@ -262,8 +263,7 @@ discard block |
||
| 262 | 263 | curl_exec($ch); |
| 263 | 264 | $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); |
| 264 | 265 | curl_close($ch); |
| 265 | - } |
|
| 266 | - else { |
|
| 266 | + } else { |
|
| 267 | 267 | $path = realpath($path); |
| 268 | 268 | $size = file_exists($path) ? filesize($path) : false; |
| 269 | 269 | } |
@@ -353,9 +353,13 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public static function downloadFile (string $url, string $path, int $chunk_size = 512): bool { |
| 355 | 355 | $file = fopen($url, 'rb'); |
| 356 | - if (!$file) return false; |
|
| 356 | + if (!$file) { |
|
| 357 | + return false; |
|
| 358 | + } |
|
| 357 | 359 | $path = fopen($path, 'wb'); |
| 358 | - if (!$path) return false; |
|
| 360 | + if (!$path) { |
|
| 361 | + return false; |
|
| 362 | + } |
|
| 359 | 363 | |
| 360 | 364 | $length = $chunk_size * 1024; |
| 361 | 365 | while (!feof($file)){ |
@@ -462,8 +466,9 @@ discard block |
||
| 462 | 466 | foreach ($string as $k => &$v) { |
| 463 | 467 | if ($diff->{$v}) { |
| 464 | 468 | $v = $diff->{$v}; |
| 469 | + } else { |
|
| 470 | + unset($string[$k]); |
|
| 465 | 471 | } |
| 466 | - else unset($string[$k]); |
|
| 467 | 472 | } |
| 468 | 473 | $string['status'] = $base_time < $target_time ? 'later' : 'ago'; |
| 469 | 474 | |
@@ -529,8 +534,7 @@ discard block |
||
| 529 | 534 | if ($last === "\0") { |
| 530 | 535 | $new .= str_repeat($last, ord($char)); |
| 531 | 536 | $last = ''; |
| 532 | - } |
|
| 533 | - else { |
|
| 537 | + } else { |
|
| 534 | 538 | $new .= $last; |
| 535 | 539 | $last = $char; |
| 536 | 540 | } |
@@ -614,7 +618,9 @@ discard block |
||
| 614 | 618 | } |
| 615 | 619 | $rows = []; |
| 616 | 620 | foreach ($keyboard as $row) { |
| 617 | - if (!is_array($row)) continue; |
|
| 621 | + if (!is_array($row)) { |
|
| 622 | + continue; |
|
| 623 | + } |
|
| 618 | 624 | $buttons = []; |
| 619 | 625 | foreach ($row as $base_button) { |
| 620 | 626 | $button_info = explode('||', $base_button); |
@@ -623,15 +629,12 @@ discard block |
||
| 623 | 629 | if (count($button_info) > 1) { |
| 624 | 630 | if ($button_info[1] === 'con') { |
| 625 | 631 | $button->setRequest_contact(true); |
| 626 | - } |
|
| 627 | - elseif ($button_info[1] === 'loc') { |
|
| 632 | + } elseif ($button_info[1] === 'loc') { |
|
| 628 | 633 | $button->setRequest_location(true); |
| 629 | - } |
|
| 630 | - elseif ($button_info[1] === 'poll') { |
|
| 634 | + } elseif ($button_info[1] === 'poll') { |
|
| 631 | 635 | $type = $button_info[2] === pollType::QUIZ ? pollType::QUIZ : pollType::REGULAR; |
| 632 | 636 | $button->setRequest_poll((new keyboardButtonPollType())->setType($type)); |
| 633 | - } |
|
| 634 | - elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
| 637 | + } elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
| 635 | 638 | $url = $button_info[2]; |
| 636 | 639 | $button->setWeb_app((new webAppInfo())->setUrl($url)); |
| 637 | 640 | } |
@@ -654,12 +657,10 @@ discard block |
||
| 654 | 657 | if (isset($button_info[1])) { |
| 655 | 658 | if (filter_var($button_info[1], FILTER_VALIDATE_URL) && str_starts_with($button_info[1], 'http')) { |
| 656 | 659 | $button->setUrl($button_info[1]); |
| 657 | - } |
|
| 658 | - else { |
|
| 660 | + } else { |
|
| 659 | 661 | $button->setCallback_data($button_info[1]); |
| 660 | 662 | } |
| 661 | - } |
|
| 662 | - else { |
|
| 663 | + } else { |
|
| 663 | 664 | $button->setUrl('https://t.me/BPT_CH'); |
| 664 | 665 | } |
| 665 | 666 | $buttons[] = $button; |
@@ -686,8 +687,12 @@ discard block |
||
| 686 | 687 | * @return string |
| 687 | 688 | */ |
| 688 | 689 | public static function inviteLink (int $user_id = null, string $bot_username = null): string { |
| 689 | - if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID); |
|
| 690 | - if (empty($bot_username)) $bot_username = telegram::getMe()->username; |
|
| 690 | + if (empty($user_id)) { |
|
| 691 | + $user_id = telegram::catchFields(fields::USER_ID); |
|
| 692 | + } |
|
| 693 | + if (empty($bot_username)) { |
|
| 694 | + $bot_username = telegram::getMe()->username; |
|
| 695 | + } |
|
| 691 | 696 | return 'https://t.me/' . str_replace('@', '', $bot_username) . '?start=ref_' . tools::shortEncode($user_id); |
| 692 | 697 | } |
| 693 | 698 | |
@@ -756,7 +761,9 @@ discard block |
||
| 756 | 761 | $array[] = $num % 62; |
| 757 | 762 | $num = floor($num / 62); |
| 758 | 763 | } |
| 759 | - if (count($array) < 1) $array = [0]; |
|
| 764 | + if (count($array) < 1) { |
|
| 765 | + $array = [0]; |
|
| 766 | + } |
|
| 760 | 767 | foreach ($array as &$value) { |
| 761 | 768 | $value = $codes[$value]; |
| 762 | 769 | } |
@@ -881,20 +881,17 @@ discard block |
||
| 881 | 881 | foreach ($arguments['media'] as $key => $media) { |
| 882 | 882 | if ($media['media'] instanceof CURLFile) { |
| 883 | 883 | $remove_answer = true; |
| 884 | - } |
|
| 885 | - elseif (is_string($media['media']) && file_exists(realpath($media['media']))) { |
|
| 884 | + } elseif (is_string($media['media']) && file_exists(realpath($media['media']))) { |
|
| 886 | 885 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
| 887 | 886 | $remove_answer = true; |
| 888 | 887 | } |
| 889 | 888 | } |
| 890 | - } |
|
| 891 | - elseif ($file_params = self::methodFile($name)) { |
|
| 889 | + } elseif ($file_params = self::methodFile($name)) { |
|
| 892 | 890 | foreach ($file_params as $param) { |
| 893 | 891 | if (isset($arguments[$param])) { |
| 894 | 892 | if ($arguments[$param] instanceof CURLFile) { |
| 895 | 893 | $remove_answer = true; |
| 896 | - } |
|
| 897 | - elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) { |
|
| 894 | + } elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) { |
|
| 898 | 895 | $arguments[$param] = new CURLFile($arguments[$param]); |
| 899 | 896 | $remove_answer = true; |
| 900 | 897 | } |
@@ -937,8 +934,7 @@ discard block |
||
| 937 | 934 | if (!isset($arguments[$default])){ |
| 938 | 935 | $arguments[$default] = self::catchFields($default); |
| 939 | 936 | } |
| 940 | - } |
|
| 941 | - elseif (isset(BPT::$update->{$key}) || $key === 'other') { |
|
| 937 | + } elseif (isset(BPT::$update->{$key}) || $key === 'other') { |
|
| 942 | 938 | foreach ($default as $def) { |
| 943 | 939 | if (!isset($arguments[$def])){ |
| 944 | 940 | $arguments[$def] = self::catchFields($def); |
@@ -1010,9 +1006,13 @@ discard block |
||
| 1010 | 1006 | default => false |
| 1011 | 1007 | }; |
| 1012 | 1008 | case fields::FILE_ID : |
| 1013 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
| 1014 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
| 1015 | - else return false; |
|
| 1009 | + if (isset(BPT::$update->message)) { |
|
| 1010 | + $type = 'message'; |
|
| 1011 | + } elseif (isset(BPT::$update->edited_message)) { |
|
| 1012 | + $type = 'edited_message'; |
|
| 1013 | + } else { |
|
| 1014 | + return false; |
|
| 1015 | + } |
|
| 1016 | 1016 | |
| 1017 | 1017 | return match(true) { |
| 1018 | 1018 | isset(BPT::$update->{$type}->animation) => BPT::$update->{$type}->animation->file_id, |