@@ -25,29 +25,29 @@ discard block |
||
| 25 | 25 | public int $duration; |
| 26 | 26 | |
| 27 | 27 | /** Optional. Performer of the audio as defined by sender or by audio tags */ |
| 28 | - public null|string $performer = null; |
|
| 28 | + public null | string $performer = null; |
|
| 29 | 29 | |
| 30 | 30 | /** Optional. Title of the audio as defined by sender or by audio tags */ |
| 31 | - public null|string $title = null; |
|
| 31 | + public null | string $title = null; |
|
| 32 | 32 | |
| 33 | 33 | /** Optional. Original filename as defined by sender */ |
| 34 | - public null|string $file_name = null; |
|
| 34 | + public null | string $file_name = null; |
|
| 35 | 35 | |
| 36 | 36 | /** Optional. MIME type of the file as defined by sender */ |
| 37 | - public null|string $mime_type = null; |
|
| 37 | + public null | string $mime_type = null; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
| 41 | 41 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
| 42 | 42 | * integer or double-precision float type are safe for storing this value. |
| 43 | 43 | */ |
| 44 | - public null|int $file_size = null; |
|
| 44 | + public null | int $file_size = null; |
|
| 45 | 45 | |
| 46 | 46 | /** Optional. Thumbnail of the album cover to which the music file belongs */ |
| 47 | - public null|photoSize $thumbnail = null; |
|
| 47 | + public null | photoSize $thumbnail = null; |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - public function __construct(stdClass|null $object = null) { |
|
| 50 | + public function __construct(stdClass | null $object = null) { |
|
| 51 | 51 | if ($object != null) { |
| 52 | 52 | parent::__construct($object, self::subs); |
| 53 | 53 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool|string string will be returned when destination doesn't set |
| 70 | 70 | */ |
| 71 | - public function download(string|null $destination = null): bool|string { |
|
| 72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3',$this->file_id); |
|
| 71 | + public function download(string | null $destination = null): bool | string { |
|
| 72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3', $this->file_id); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function link(): string { |
@@ -31,23 +31,23 @@ discard block |
||
| 31 | 31 | public int $duration; |
| 32 | 32 | |
| 33 | 33 | /** Optional. Video thumbnail */ |
| 34 | - public null|photoSize $thumbnail = null; |
|
| 34 | + public null | photoSize $thumbnail = null; |
|
| 35 | 35 | |
| 36 | 36 | /** Optional. Original filename as defined by sender */ |
| 37 | - public null|string $file_name = null; |
|
| 37 | + public null | string $file_name = null; |
|
| 38 | 38 | |
| 39 | 39 | /** Optional. MIME type of the file as defined by sender */ |
| 40 | - public null|string $mime_type = null; |
|
| 40 | + public null | string $mime_type = null; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
| 44 | 44 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
| 45 | 45 | * integer or double-precision float type are safe for storing this value. |
| 46 | 46 | */ |
| 47 | - public null|int $file_size = null; |
|
| 47 | + public null | int $file_size = null; |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - public function __construct(stdClass|null $object = null) { |
|
| 50 | + public function __construct(stdClass | null $object = null) { |
|
| 51 | 51 | if ($object != null) { |
| 52 | 52 | parent::__construct($object, self::subs); |
| 53 | 53 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool|string string will be returned when destination doesn't set |
| 70 | 70 | */ |
| 71 | - public function download(string|null $destination = null): bool|string { |
|
| 72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$this->file_id); |
|
| 71 | + public function download(string | null $destination = null): bool | string { |
|
| 72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $this->file_id); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function link(): string { |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | public string $sticker_type; |
| 22 | 22 | |
| 23 | 23 | /** True, if the sticker set contains animated stickers */ |
| 24 | - public null|bool $is_animated = null; |
|
| 24 | + public null | bool $is_animated = null; |
|
| 25 | 25 | |
| 26 | 26 | /** True, if the sticker set contains video stickers */ |
| 27 | - public null|bool $is_video = null; |
|
| 27 | + public null | bool $is_video = null; |
|
| 28 | 28 | |
| 29 | 29 | /** Deprecated use sticker_type instead, True, if the sticker set contains masks */ |
| 30 | - public null|bool $contains_masks = null; |
|
| 30 | + public null | bool $contains_masks = null; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * List of all set stickers |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | public array $stickers; |
| 37 | 37 | |
| 38 | 38 | /** Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */ |
| 39 | - public null|photoSize $thumbnail = null; |
|
| 39 | + public null | photoSize $thumbnail = 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 | } |
@@ -22,23 +22,23 @@ discard block |
||
| 22 | 22 | public string $file_unique_id; |
| 23 | 23 | |
| 24 | 24 | /** Optional. Document thumbnail as defined by sender */ |
| 25 | - public null|photoSize $thumbnail = null; |
|
| 25 | + public null | photoSize $thumbnail = null; |
|
| 26 | 26 | |
| 27 | 27 | /** Optional. Original filename as defined by sender */ |
| 28 | - public null|string $file_name = null; |
|
| 28 | + public null | string $file_name = null; |
|
| 29 | 29 | |
| 30 | 30 | /** Optional. MIME type of the file as defined by sender */ |
| 31 | - public null|string $mime_type = null; |
|
| 31 | + public null | string $mime_type = null; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
| 35 | 35 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
| 36 | 36 | * integer or double-precision float type are safe for storing this value. |
| 37 | 37 | */ |
| 38 | - public null|int $file_size = null; |
|
| 38 | + public null | int $file_size = null; |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - public function __construct(stdClass|null $object = null) { |
|
| 41 | + public function __construct(stdClass | null $object = null) { |
|
| 42 | 42 | if ($object != null) { |
| 43 | 43 | parent::__construct($object, self::subs); |
| 44 | 44 | } |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return bool|string string will be returned when destination doesn't set |
| 61 | 61 | */ |
| 62 | - public function download(string|null $destination = null): bool|string { |
|
| 63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt',$this->file_id); |
|
| 62 | + public function download(string | null $destination = null): bool | string { |
|
| 63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt', $this->file_id); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function link(): string { |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public string $description; |
| 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 | } |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
| 19 | 19 | */ |
| 20 | - public static function init(): string|null { |
|
| 20 | + public static function init(): string | null { |
|
| 21 | 21 | return self::getUpdate(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - private static function getUpdate (): string|null { |
|
| 24 | + private static function getUpdate(): string | null { |
|
| 25 | 25 | $up = glob('*.update'); |
| 26 | 26 | if (!isset($up[0])) { |
| 27 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
| 27 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
| 28 | 28 | BPT::exit(); |
| 29 | 29 | } |
| 30 | 30 | $up = end($up); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private static function create($file) { |
| 57 | - file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php ' . $file . ' > /dev/null &");'); |
|
| 57 | + file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php '.$file.' > /dev/null &");'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | #[ArrayShape(['url' => "array|string|string[]", 'file' => "string"])] |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | * curl class , for multiprocessing with curl tricks |
| 15 | 15 | */ |
| 16 | 16 | class curl extends webhook { |
| 17 | - public static function init (): string|null { |
|
| 17 | + public static function init(): string | null { |
|
| 18 | 18 | if (!self::checkIP()) { |
| 19 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
| 19 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
| 20 | 20 | BPT::exit(); |
| 21 | 21 | } |
| 22 | 22 | return self::getUpdate(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - private static function getUpdate (): string { |
|
| 29 | + private static function getUpdate(): string { |
|
| 30 | 30 | $input = json_decode(file_get_contents("php://input"), true); |
| 31 | 31 | webhook::telegramVerify($input['ip']); |
| 32 | 32 | return $input['update']; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | lock::set('BPT-MULTI-CURL'); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - private static function getTimeout($url): float|int { |
|
| 46 | + private static function getTimeout($url): float | int { |
|
| 47 | 47 | $times = []; |
| 48 | - for ($i = 0; $i < 10; $i ++) { |
|
| 48 | + for ($i = 0; $i < 10; $i++) { |
|
| 49 | 49 | $ch = curl_init($url); |
| 50 | 50 | curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_TIMEOUT_MS => 100, CURLOPT_NOBODY => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => 100, CURLOPT_HTTPHEADER => ['accept: application/json', 'content-type: application/json']]); |
| 51 | 51 | $start = microtime(true); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | return $timeout > 50 ? $timeout + 10 : 50; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - private static function create($file,$timeout) { |
|
| 60 | - file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\'' . $file . '\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => ' . $timeout . ', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => ' . $timeout . ', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
| 59 | + private static function create($file, $timeout) { |
|
| 60 | + file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\''.$file.'\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => '.$timeout.', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => '.$timeout.', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | #[ArrayShape(['url' => "array|string|string[]", 'file' => "array|string|string[]"])] |
@@ -862,20 +862,17 @@ discard block |
||
| 862 | 862 | foreach ($arguments['media'] as $key => $media) { |
| 863 | 863 | if ($media['media'] instanceof CURLFile) { |
| 864 | 864 | $remove_answer = true; |
| 865 | - } |
|
| 866 | - elseif (is_string($media['media']) && file_exists(realpath($media['media']))) { |
|
| 865 | + } elseif (is_string($media['media']) && file_exists(realpath($media['media']))) { |
|
| 867 | 866 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
| 868 | 867 | $remove_answer = true; |
| 869 | 868 | } |
| 870 | 869 | } |
| 871 | - } |
|
| 872 | - elseif ($file_params = self::methodFile($name)) { |
|
| 870 | + } elseif ($file_params = self::methodFile($name)) { |
|
| 873 | 871 | foreach ($file_params as $param) { |
| 874 | 872 | if (isset($arguments[$param])) { |
| 875 | 873 | if ($arguments[$param] instanceof CURLFile) { |
| 876 | 874 | $remove_answer = true; |
| 877 | - } |
|
| 878 | - elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) { |
|
| 875 | + } elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) { |
|
| 879 | 876 | $arguments[$param] = new CURLFile($arguments[$param]); |
| 880 | 877 | $remove_answer = true; |
| 881 | 878 | } |
@@ -915,8 +912,7 @@ discard block |
||
| 915 | 912 | if (!isset($arguments[$default])){ |
| 916 | 913 | $arguments[$default] = self::catchFields($default); |
| 917 | 914 | } |
| 918 | - } |
|
| 919 | - elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
| 915 | + } elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
| 920 | 916 | foreach ($default as $def) { |
| 921 | 917 | if (!isset($arguments[$def])){ |
| 922 | 918 | $arguments[$def] = self::catchFields($def); |
@@ -987,9 +983,13 @@ discard block |
||
| 987 | 983 | default => false |
| 988 | 984 | }; |
| 989 | 985 | case fields::FILE_ID : |
| 990 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
| 991 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
| 992 | - else return false; |
|
| 986 | + if (isset(BPT::$update->message)) { |
|
| 987 | + $type = 'message'; |
|
| 988 | + } elseif (isset(BPT::$update->edited_message)) { |
|
| 989 | + $type = 'edited_message'; |
|
| 990 | + } else { |
|
| 991 | + return false; |
|
| 992 | + } |
|
| 993 | 993 | |
| 994 | 994 | return match(true) { |
| 995 | 995 | isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id, |
@@ -825,30 +825,30 @@ discard block |
||
| 825 | 825 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
| 826 | 826 | ]; |
| 827 | 827 | |
| 828 | - public static function __callStatic (string $name, array $arguments) { |
|
| 828 | + public static function __callStatic(string $name, array $arguments) { |
|
| 829 | 829 | if (!$action = self::methodAction($name)) { |
| 830 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
| 830 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
| 831 | 831 | throw new bptException('METHOD_NOT_FOUND'); |
| 832 | 832 | } |
| 833 | 833 | self::checkArguments($arguments); |
| 834 | - self::keysName($action,$arguments); |
|
| 835 | - self::readyFile($action,$arguments); |
|
| 834 | + self::keysName($action, $arguments); |
|
| 835 | + self::readyFile($action, $arguments); |
|
| 836 | 836 | self::cleanArguments($arguments); |
| 837 | - self::setDefaults($action,$arguments); |
|
| 837 | + self::setDefaults($action, $arguments); |
|
| 838 | 838 | |
| 839 | 839 | if (isset($arguments['answer']) && $arguments['answer'] === true) { |
| 840 | 840 | unset($arguments['answer']); |
| 841 | 841 | if (!answer::isAnswered()) { |
| 842 | - return answer::init($action,$arguments); |
|
| 842 | + return answer::init($action, $arguments); |
|
| 843 | 843 | } |
| 844 | - logger::write('you can use answer mode only once for each webhook update, Others will be called like normal',loggerTypes::WARNING); |
|
| 844 | + logger::write('you can use answer mode only once for each webhook update, Others will be called like normal', loggerTypes::WARNING); |
|
| 845 | 845 | } |
| 846 | - $result = curl::init($action,$arguments); |
|
| 846 | + $result = curl::init($action, $arguments); |
|
| 847 | 847 | if (!is_object($result)) { |
| 848 | - logger::write("Telegram $action method failed : " . $result, loggerTypes::WARNING); |
|
| 848 | + logger::write("Telegram $action method failed : ".$result, loggerTypes::WARNING); |
|
| 849 | 849 | return false; |
| 850 | 850 | } |
| 851 | - return self::processResponse($action,$result); |
|
| 851 | + return self::processResponse($action, $result); |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | private static function checkArguments(array &$arguments): void { |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - private static function keysName (string $name, array &$arguments): void { |
|
| 860 | + private static function keysName(string $name, array &$arguments): void { |
|
| 861 | 861 | foreach ($arguments as $key => $argument) { |
| 862 | 862 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
| 863 | 863 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - private static function methodAction(string $name): string|false { |
|
| 869 | + private static function methodAction(string $name): string | false { |
|
| 870 | 870 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
| 871 | 871 | } |
| 872 | 872 | |
@@ -902,11 +902,11 @@ discard block |
||
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - private static function methodFile(string $name): array|false { |
|
| 905 | + private static function methodFile(string $name): array | false { |
|
| 906 | 906 | return self::METHODS_WITH_FILE[$name] ?? false; |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | - private static function methodReturn(string $name,stdClass $response) { |
|
| 909 | + private static function methodReturn(string $name, stdClass $response) { |
|
| 910 | 910 | if (!settings::$use_types_classes) { |
| 911 | 911 | return $response; |
| 912 | 912 | } |
@@ -928,13 +928,13 @@ discard block |
||
| 928 | 928 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name] ?? []; |
| 929 | 929 | foreach ($defaults as $key => $default) { |
| 930 | 930 | if (is_numeric($key)) { |
| 931 | - if (!isset($arguments[$default])){ |
|
| 931 | + if (!isset($arguments[$default])) { |
|
| 932 | 932 | $arguments[$default] = self::catchFields($default); |
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
| 936 | 936 | foreach ($default as $def) { |
| 937 | - if (!isset($arguments[$def])){ |
|
| 937 | + if (!isset($arguments[$def])) { |
|
| 938 | 938 | $arguments[$def] = self::catchFields($def); |
| 939 | 939 | } |
| 940 | 940 | } |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | self::$status = $response->ok; |
| 954 | 954 | self::$pure_response = $response; |
| 955 | 955 | if (!$response->ok) { |
| 956 | - logger::write("Telegram $name method failed : " . json_encode($response), loggerTypes::WARNING); |
|
| 956 | + logger::write("Telegram $name method failed : ".json_encode($response), loggerTypes::WARNING); |
|
| 957 | 957 | return new responseError($response); |
| 958 | 958 | } |
| 959 | - return self::methodReturn($name,$response); |
|
| 959 | + return self::methodReturn($name, $response); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | - private static function cleanArguments (array &$arguments): void { |
|
| 962 | + private static function cleanArguments(array &$arguments): void { |
|
| 963 | 963 | foreach ($arguments as $key => $argument) { |
| 964 | 964 | if ($argument == [] || $argument === null) { |
| 965 | 965 | unset($arguments[$key]); |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | * |
| 975 | 975 | * @return int|string|bool |
| 976 | 976 | */ |
| 977 | - public static function catchFields (string $field): int|string|bool { |
|
| 977 | + public static function catchFields(string $field): int | string | bool { |
|
| 978 | 978 | switch ($field) { |
| 979 | 979 | case fields::CHAT_ID : |
| 980 | 980 | case fields::FROM_CHAT_ID : |
@@ -1121,13 +1121,13 @@ discard block |
||
| 1121 | 1121 | default => false |
| 1122 | 1122 | }; |
| 1123 | 1123 | case fields::URL : |
| 1124 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
| 1124 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
| 1125 | 1125 | default: |
| 1126 | 1126 | return false; |
| 1127 | 1127 | } |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | - public static function fileLink (string|null $file_id = null): bool|string { |
|
| 1130 | + public static function fileLink(string | null $file_id = null): bool | string { |
|
| 1131 | 1131 | $file = request::getFile($file_id); |
| 1132 | 1132 | if (!isset($file->file_path)) { |
| 1133 | 1133 | return false; |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | * |
| 1150 | 1150 | * @return bool |
| 1151 | 1151 | */ |
| 1152 | - public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool { |
|
| 1152 | + public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool { |
|
| 1153 | 1153 | return tools::downloadFile(self::fileLink($file_id), $destination); |
| 1154 | 1154 | } |
| 1155 | 1155 | |
@@ -1167,10 +1167,10 @@ discard block |
||
| 1167 | 1167 | * |
| 1168 | 1168 | * @return message|bool|responseError |
| 1169 | 1169 | */ |
| 1170 | - public static function sendFile (string $file_id, int|string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup|replyKeyboardMarkup|replyKeyboardRemove|forceReply|stdClass|array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message|bool|responseError { |
|
| 1170 | + public static function sendFile(string $file_id, int | string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup | replyKeyboardMarkup | replyKeyboardRemove | forceReply | stdClass | array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message | bool | responseError { |
|
| 1171 | 1171 | $type = tools::fileType($file_id); |
| 1172 | 1172 | return match ($type) { |
| 1173 | - fileTypes::VIDEO => request::sendVideo($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false,null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer), |
|
| 1173 | + fileTypes::VIDEO => request::sendVideo($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer), |
|
| 1174 | 1174 | fileTypes::VIDEO_NOTE => request::sendVideoNote($file_id, $chat_id, $message_thread_id, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer), |
| 1175 | 1175 | fileTypes::ANIMATION => request::sendAnimation($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, false, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer), |
| 1176 | 1176 | fileTypes::AUDIO => request::sendAudio($file_id, $chat_id, $message_thread_id, $caption, $parse_mode, $caption_entities, null, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer), |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | public bool $allow_channel_chats; |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function __construct(stdClass|null $object = null) { |
|
| 34 | + public function __construct(stdClass | null $object = null) { |
|
| 35 | 35 | if ($object != null) { |
| 36 | 36 | parent::__construct($object, self::subs); |
| 37 | 37 | } |