Passed
Push — main ( 2690c9...b16527 )
by Alireza
02:55 queued 01:27
created
types/message.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -139,13 +139,13 @@
 block discarded – undo
139 139
     public string $text;
140 140
 
141 141
     /** Optional. If user message was a commend , this parameter will be the commend */
142
-    public string|null $commend;
142
+    public string | null $commend;
143 143
 
144 144
     /** Optional. If user message was a commend , this parameter will be the commend username(if exist) */
145
-    public string|null $commend_username;
145
+    public string | null $commend_username;
146 146
 
147 147
     /** Optional. If user message was a commend , this parameter will be the commend payload(if exist) */
148
-    public string|null $commend_payload;
148
+    public string | null $commend_payload;
149 149
 
150 150
     /**
151 151
      * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
Please login to merge, or discard this patch.
receiver/multi/curl.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 use BPT\settings;
11 11
 
12 12
 class curl extends webhook {
13
-    public static function init (): string|null {
13
+    public static function init(): string | null {
14 14
         if (self::checkIP()) {
15 15
             return self::getUpdate();
16 16
         }
17 17
         else {
18
-            logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
18
+            logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING);
19 19
             BPT::exit();
20 20
         }
21 21
     }
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR'];
25 25
     }
26 26
 
27
-    private static function getUpdate (): string {
27
+    private static function getUpdate(): string {
28 28
         $input = json_decode(file_get_contents("php://input"), true);
29 29
         webhook::telegramVerify($input['ip']);
30 30
         return $input['update'];
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
         $urls = self::setURLS();
35 35
         $file = $urls['file'];
36 36
         $timeout = self::getTimeout($file);
37
-        self::create($file,$timeout);
37
+        self::create($file, $timeout);
38 38
         self::setWebhook($urls['url']);
39 39
         lock::set('BPT-MULTI-CURL');
40 40
     }
41 41
 
42
-    private static function getTimeout($url): float|int {
42
+    private static function getTimeout($url): float | int {
43 43
         $times = [];
44
-        for ($i = 0; $i < 10; $i ++) {
44
+        for ($i = 0; $i < 10; $i++) {
45 45
             $ch = curl_init($url);
46 46
             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']]);
47 47
             $start = microtime(true);
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
         return $timeout > 50 ? $timeout + 10 : 50;
53 53
     }
54 54
 
55
-    private static function create($file,$timeout) {
56
-        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);?>');
55
+    private static function create($file, $timeout) {
56
+        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);?>');
57 57
     }
58 58
 
59 59
     private static function setURLS(): array {
60
-        $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
60
+        $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
61 61
         $file = basename($_SERVER['REQUEST_URI']);
62 62
         return [
63 63
             'url'=>str_replace($file, 'receiver.php', $base_url),
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
     public static function init (): string|null {
14 14
         if (self::checkIP()) {
15 15
             return self::getUpdate();
16
-        }
17
-        else {
16
+        } else {
18 17
             logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
19 18
             BPT::exit();
20 19
         }
Please login to merge, or discard this patch.
receiver/multi/exec.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 use BPT\settings;
11 11
 
12 12
 class exec extends webhook {
13
-    public static function init(): string|null {
13
+    public static function init(): string | null {
14 14
         return self::getUpdate();
15 15
     }
16 16
 
17
-    private static function getUpdate (): string|null {
17
+    private static function getUpdate(): string | null {
18 18
         $up = glob('*.update');
19 19
         if (isset($up[0])) {
20 20
             $up = end($up);
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             return $update;
26 26
         }
27 27
         else {
28
-            logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
28
+            logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING);
29 29
             BPT::exit();
30 30
         }
31 31
     }
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     private static function create($file) {
48
-        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 &");');
48
+        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 &");');
49 49
     }
50 50
 
51 51
     private static function setURLS(): array {
52
-        $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
52
+        $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
53 53
         return [
54 54
             'url'=>str_replace(basename($_SERVER['REQUEST_URI']), 'receiver.php', $base_url),
55 55
             'file'=>basename($_SERVER['SCRIPT_NAME'])
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
             $update = file_get_contents($up);
24 24
             unlink($up);
25 25
             return $update;
26
-        }
27
-        else {
26
+        } else {
28 27
             logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
29 28
             BPT::exit();
30 29
         }
Please login to merge, or discard this patch.
tools.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param string $username Your text to be check is username or not e.g. : 'BPT_CH' | '@BPT_CH'
23 23
      * @return bool
24 24
      */
25
-    public static function isUsername (string $username): bool {
25
+    public static function isUsername(string $username): bool {
26 26
         $length = strlen($username);
27 27
         return strpos($username, '__') === false && $length >= 5 && $length <= 33 && preg_match('/^@?([a-zA-Z])(\w{4,31})$/', $username);
28 28
     }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param string $range Your range ip for check , if you didn't specify the block , it will be 32
39 39
      * @return bool
40 40
      */
41
-    public static function ipInRange (string $ip, string $range): bool {
41
+    public static function ipInRange(string $ip, string $range): bool {
42 42
         if (!str_contains($range, '/')) {
43 43
             $range .= '/32';
44 44
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param string $ip     Your ip to be check is telegram or not e.g. '192.168.1.1'
58 58
      * @return bool
59 59
      */
60
-    public static function isTelegram (string $ip): bool {
60
+    public static function isTelegram(string $ip): bool {
61 61
         return self::ipInRange($ip, '149.154.160.0/20') || self::ipInRange($ip, '91.108.4.0/22');
62 62
     }
63 63
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
      * @param string $ip Your ip to be check is CloudFlare or not e.g. '192.168.1.1'
72 72
      * @return bool
73 73
      */
74
-    public static function isCloudFlare (string $ip): bool {
74
+    public static function isCloudFlare(string $ip): bool {
75 75
         $cf_ips = ['173.245.48.0/20', '103.21.244.0/22', '103.22.200.0/22', '103.31.4.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20', '188.114.96.0/20', '197.234.240.0/22', '198.41.128.0/17', '162.158.0.0/15', '104.16.0.0/12', '172.64.0.0/13', '131.0.72.0/22'];
76 76
         foreach ($cf_ips as $cf_ip) {
77
-            if (self::ipInRange($ip,$cf_ip)) {
77
+            if (self::ipInRange($ip, $cf_ip)) {
78 78
                 return true;
79 79
             }
80 80
         }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      * @param bool $verify check token with telegram or not
96 96
      * @return bool|array return array when verify is active and token is true array of telegram getMe result
97 97
      */
98
-    public static function isToken (string $token, bool $verify = false): bool|array {
98
+    public static function isToken(string $token, bool $verify = false): bool | array {
99 99
         if (preg_match('/^(\d{8,10}):[\w\-]{35}$/', $token)) {
100
-            if ($verify){
100
+            if ($verify) {
101 101
                 $res = telegram::me($token);
102 102
                 if ($res['ok']) {
103 103
                     return $res['result'];
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
      * @param int|null $user_id e.g. => '442109602'
131 131
      * @return bool
132 132
      */
133
-    public static function isJoined (array|string|int $ids , int|null $user_id = null): bool {
133
+    public static function isJoined(array | string | int $ids, int | null $user_id = null): bool {
134 134
         if (!is_array($ids)) {
135 135
             $ids = [$ids];
136 136
         }
137 137
         //$user_id = $user_id ?? $this->catchFields(['field' => 'user_id']);
138 138
 
139 139
         foreach ($ids as $id) {
140
-            $check = telegram::getChatMember($id,$user_id);
140
+            $check = telegram::getChatMember($id, $user_id);
141 141
             if (isset($check['result'])) {
142 142
                 $check = $check['result']['status'];
143 143
                 return !($check === chatMemberStatus::LEFT || $check === chatMemberStatus::KICKED);
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
      * @param string $characters e.g. => 'abcdefg'
166 166
      * @return string
167 167
      */
168
-    public static function randomString (int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
168
+    public static function randomString(int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
169 169
         $rand_string = '';
170 170
         $char_len = strlen($characters) - 1;
171
-        for ($i = 0; $i < $length; $i ++) {
171
+        for ($i = 0; $i < $length; $i++) {
172 172
             $rand_string .= $characters[rand(0, $char_len)];
173 173
         }
174 174
         return $rand_string;
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
      * @param string $mode Your selected mode e.g. => `parseMode::HTML` | `HTML`
188 188
      * @return string|false return false when mode is incorrect
189 189
      */
190
-    public static function modeEscape (string $text, string $mode = parseMode::HTML): string|false {
190
+    public static function modeEscape(string $text, string $mode = parseMode::HTML): string | false {
191 191
         return match ($mode) {
192
-            parseMode::HTML => str_replace(['&', '<', '>',], ["&amp;", "&lt;", "&gt;",], $text),
193
-            parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[',], $text),
192
+            parseMode::HTML => str_replace(['&', '<', '>', ], ["&amp;", "&lt;", "&gt;", ], $text),
193
+            parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[', ], $text),
194 194
             parseMode::MARKDOWNV2 => str_replace(
195 195
                 ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!', '\\'],
196 196
                 ['\_', '\*', '\[', '\]', '\(', '\)', '\~', '\`', '\>', '\#', '\+', '\-', '\=', '\|', '\{', '\}', '\.', '\!', '\\\\'],
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
      * @param int $precision e.g. => 2
217 217
      * @return string
218 218
      */
219
-    public static function byteFormat (int $byte, int $precision = 2): string {
219
+    public static function byteFormat(int $byte, int $precision = 2): string {
220 220
         $rate_counter = 0;
221 221
 
222
-        while ($byte > 1024){
222
+        while ($byte > 1024) {
223 223
             $byte /= 1024;
224 224
             $rate_counter++;
225 225
         }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $byte = round($byte, $precision);
229 229
         }
230 230
 
231
-        return $byte . ' ' . ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter];
231
+        return $byte.' '.['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter];
232 232
     }
233 233
 
234 234
     /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param bool $format if you set this true , you will receive symbolic string like 2.76MB
249 249
      * @return string|int|false string for formatted data , int for normal data , false when size can not be found(file not found or ...)
250 250
      */
251
-    public static function size (string $path, bool $format = true): string|int|false {
251
+    public static function size(string $path, bool $format = true): string | int | false {
252 252
         if (filter_var($path, FILTER_VALIDATE_URL)) {
253 253
             $ch = curl_init($path);
254 254
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * @param array $array e.g. => ['path'=>'xfolder/yfolder','sub'=>true]
284 284
      * @return bool
285 285
      */
286
-    public static function delete (string $path, bool $sub = true): bool {
286
+    public static function delete(string $path, bool $sub = true): bool {
287 287
         if (is_dir($path)) {
288 288
             if (count(scandir($path)) > 2) {
289 289
                 if ($sub) {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                     rmdir($path);
296 296
                 }
297 297
                 else {
298
-                    logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::WARNING);
298
+                    logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value", loggerTypes::WARNING);
299 299
                     return false;
300 300
                 }
301 301
             }
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
      * @return array
319 319
      * @throws Exception
320 320
      */
321
-    public static function time2string (int $datetime): array {
321
+    public static function time2string(int $datetime): array {
322 322
         $now = new DateTime;
323
-        $input = new DateTime('@' . $datetime);
323
+        $input = new DateTime('@'.$datetime);
324 324
         $status = $now < $input ? 'later' : 'ago';
325 325
         $diff = $now->diff($input);
326 326
         $diff->w = floor($diff->d / 7);
Please login to merge, or discard this patch.
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
             curl_exec($ch);
258 258
             $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
259 259
             curl_close($ch);
260
-        }
261
-        else {
260
+        } else {
262 261
             $size = file_exists($path) ? filesize($path) : false;
263 262
         }
264 263
 
265 264
         if (isset($size) && is_numeric($size)) {
266 265
             return $format ? tools::byteFormat($size) : $size;
267
-        }
268
-        else return false;
266
+        } else {
267
+            return false;
268
+        }
269 269
     }
270 270
 
271 271
     //fix methods after here comments
@@ -293,15 +293,16 @@  discard block
 block discarded – undo
293 293
                         $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());
294 294
                     }
295 295
                     rmdir($path);
296
-                }
297
-                else {
296
+                } else {
298 297
                     logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::WARNING);
299 298
                     return false;
300 299
                 }
301
-            }
302
-            else rmdir($path);
303
-        }
304
-        else unlink($path);
300
+            } else {
301
+                rmdir($path);
302
+            }
303
+        } else {
304
+            unlink($path);
305
+        }
305 306
 
306 307
         return true;
307 308
     }
@@ -328,8 +329,9 @@  discard block
 block discarded – undo
328 329
         foreach ($string as $k => &$v) {
329 330
             if ($diff->$v) {
330 331
                 $v = $diff->$v;
331
-            }
332
-            else unset($string[$k]);
332
+            } else {
333
+                unset($string[$k]);
334
+            }
333 335
         }
334 336
         $string['status'] = $status;
335 337
         return count($string) > 1 ? $string : ['status' => 'now'];
Please login to merge, or discard this patch.
api/request/answer.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,32 +12,32 @@  discard block
 block discarded – undo
12 12
 class answer {
13 13
     private static bool $is_answered = false;
14 14
 
15
-    public static function init(string $method,array $data) {
15
+    public static function init(string $method, array $data) {
16 16
         self::checkAnswered();
17 17
         self::checkWebhook();
18 18
         self::deleteAdditionalData($data);
19 19
         self::$is_answered = true;
20 20
         $data['method'] = $method;
21 21
         $payload = json_encode($data);
22
-        header('Content-Type: application/json;Content-Length: ' . strlen($payload));
22
+        header('Content-Type: application/json;Content-Length: '.strlen($payload));
23 23
         echo $payload;
24 24
         return true;
25 25
     }
26 26
 
27 27
     private static function checkAnswered() {
28 28
         if (self::$is_answered) {
29
-            logger::write('You can use answer mode only once for each webhook update , You already did it!',loggerTypes::ERROR);
29
+            logger::write('You can use answer mode only once for each webhook update , You already did it!', loggerTypes::ERROR);
30 30
             throw new bptException('ANSWER_MODE_USED');
31 31
         }
32 32
     }
33 33
 
34 34
     private static function checkWebhook() {
35
-        if(settings::$receiver === receiver::GETUPDATES) {
36
-            logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR);
35
+        if (settings::$receiver === receiver::GETUPDATES) {
36
+            logger::write('Answer mode only work when receiver is webhook', loggerTypes::ERROR);
37 37
             throw new bptException('ANSWER_MODE_GETUPDATES');
38 38
         }
39
-        elseif(settings::$multi) {
40
-            logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR);
39
+        elseif (settings::$multi) {
40
+            logger::write('You can not use answer mode when multi setting is on', loggerTypes::ERROR);
41 41
             throw new bptException('ANSWER_MODE_MULTI');
42 42
         }
43 43
     }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
         if (isset($data['return_array'])) {
53 53
             unset($data['return_array']);
54 54
         }
55
-        foreach ($data as $key=>&$value){
56
-            if (!isset($value)){
55
+        foreach ($data as $key=>&$value) {
56
+            if (!isset($value)) {
57 57
                 unset($data[$key]);
58 58
             }
59
-            elseif (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){
59
+            elseif (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) {
60 60
                 $value = json_encode($value);
61 61
             }
62 62
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
         if(settings::$receiver === receiver::GETUPDATES) {
36 36
             logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR);
37 37
             throw new bptException('ANSWER_MODE_GETUPDATES');
38
-        }
39
-        elseif(settings::$multi) {
38
+        } elseif(settings::$multi) {
40 39
             logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR);
41 40
             throw new bptException('ANSWER_MODE_MULTI');
42 41
         }
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
         foreach ($data as $key=>&$value){
56 55
             if (!isset($value)){
57 56
                 unset($data[$key]);
58
-            }
59
-            elseif (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){
57
+            } elseif (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){
60 58
                 $value = json_encode($value);
61 59
             }
62 60
         }
Please login to merge, or discard this patch.
api/telegram.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 namespace BPT\api;
4 4
 
5 5
 class telegram extends request {
6
-    public function __call (string $name, array $arguments) {
6
+    public function __call(string $name, array $arguments) {
7 7
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
8 8
             return request::$name(...$arguments[0]);
9 9
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@
 block discarded – undo
233 233
     public function __call (string $name, array $arguments) {
234 234
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
235 235
             return request::$name(...$arguments[0]);
236
-        }
237
-        else {
236
+        } else {
238 237
             return request::$name(...$arguments);
239 238
         }
240 239
     }
Please login to merge, or discard this patch.
api/request.php 2 patches
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -449,94 +449,94 @@  discard block
 block discarded – undo
449 449
     ];
450 450
 
451 451
     private const METHODS_KEYS = [
452
-        'getUpdates'                      => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'],
453
-        'setWebhook'                      => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'],
454
-        'deleteWebhook'                   => ['drop_pending_updates','token','return_array','forgot','answer'],
455
-        'getWebhookInfo'                  => ['token','return_array','forgot','answer'],
456
-        'getMe'                           => ['token','return_array','forgot','answer'],
457
-        'logOut'                          => ['token','return_array','forgot','answer'],
458
-        'close'                           => ['token','return_array','forgot','answer'],
459
-        'sendMessage'                     => ['text','chat_id','parse_mode','entities','disable_web_page_preview','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
460
-        'forwardMessage'                  => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'],
461
-        'copyMessage'                     => ['chat_id','from_chat_id','message_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
462
-        'sendPhoto'                       => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
463
-        'sendAudio'                       => ['audio','chat_id','caption','parse_mode','caption_entities','duration','performer','title','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
464
-        'sendDocument'                    => ['document','chat_id','thumb','caption','parse_mode','caption_entities','disable_content_type_detection','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
465
-        'sendVideo'                       => ['video','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','supports_streaming','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
466
-        'sendAnimation'                   => ['animation','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
467
-        'sendVoice'                       => ['voice','chat_id','caption','parse_mode','caption_entities','duration','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
468
-        'sendVideoNote'                   => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
469
-        'sendMediaGroup'                  => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'],
470
-        'sendLocation'                    => ['latitude','longitude','chat_id','horizontal_accuracy','live_period','heading','proximity_alert_radius','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
471
-        'editMessageLiveLocation'         => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'],
472
-        'stopMessageLiveLocation'         => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
473
-        'sendVenue'                       => ['chat_id','latitude','longitude','title','address','foursquare_id','foursquare_type','google_place_id','google_place_type','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
474
-        'sendContact'                     => ['phone_number','first_name','chat_id','last_name','vcard','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
475
-        'sendPoll'                        => ['question','options','chat_id','is_anonymous','type','allows_multiple_answers','correct_option_id','explanation','explanation_parse_mode','explanation_entities','open_period','close_date','is_closed','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
476
-        'sendDice'                        => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
477
-        'sendChatAction'                  => ['chat_id','action','token','return_array','forgot','answer'],
478
-        'getUserProfilePhotos'            => ['user_id','offset','limit','token','return_array','forgot','answer'],
479
-        'getFile'                         => ['file_id','token','return_array','forgot','answer'],
480
-        'banChatMember'                   => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'],
481
-        'unbanChatMember'                 => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'],
482
-        'restrictChatMember'              => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'],
483
-        'promoteChatMember'               => ['chat_id','user_id','is_anonymous','can_manage_chat','can_post_messages','can_edit_messages','can_delete_messages','can_manage_video_chats','can_restrict_members','can_promote_members','can_change_info','can_invite_users','can_pin_messages','token','return_array','forgot','answer'],
484
-        'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'],
485
-        'banChatSenderChat'               => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
486
-        'unbanChatSenderChat'             => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
487
-        'setChatPermissions'              => ['permissions','chat_id','token','return_array','forgot','answer'],
488
-        'exportChatInviteLink'            => ['chat_id','token','return_array','forgot','answer'],
489
-        'createChatInviteLink'            => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
490
-        'editChatInviteLink'              => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
491
-        'revokeChatInviteLink'            => ['invite_link','chat_id','token','return_array','forgot','answer'],
492
-        'approveChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
493
-        'declineChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
494
-        'setChatPhoto'                    => ['photo','chat_id','token','return_array','forgot','answer'],
495
-        'deleteChatPhoto'                 => ['chat_id','token','return_array','forgot','answer'],
496
-        'setChatTitle'                    => ['title','chat_id','token','return_array','forgot','answer'],
497
-        'setChatDescription'              => ['chat_id','description','token','return_array','forgot','answer'],
498
-        'pinChatMessage'                  => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'],
499
-        'unpinChatMessage'                => ['chat_id','message_id','token','return_array','forgot','answer'],
500
-        'unpinAllChatMessages'            => ['chat_id','token','return_array','forgot','answer'],
501
-        'leaveChat'                       => ['chat_id','token','return_array','forgot','answer'],
502
-        'getChat'                         => ['chat_id','token','return_array','forgot','answer'],
503
-        'getChatAdministrators'           => ['chat_id','token','return_array','forgot','answer'],
504
-        'getChatMemberCount'              => ['chat_id','token','return_array','forgot','answer'],
505
-        'getChatMember'                   => ['chat_id','user_id','token','return_array','forgot','answer'],
506
-        'setChatStickerSet'               => ['sticker_set_name','chat_id','token','return_array','forgot','answer'],
507
-        'deleteChatStickerSet'            => ['chat_id','token','return_array','forgot','answer'],
508
-        'answerCallbackQuery'             => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'],
509
-        'setMyCommands'                   => ['commands','scope','language_code','token','return_array','forgot','answer'],
510
-        'deleteMyCommands'                => ['scope','language_code','token','return_array','forgot','answer'],
511
-        'getMyCommands'                   => ['scope','language_code','token','return_array','forgot','answer'],
512
-        'setChatMenuButton'               => ['chat_id','menu_button','token','return_array','forgot','answer'],
513
-        'getChatMenuButton'               => ['chat_id','token','return_array','forgot','answer'],
514
-        'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'],
515
-        'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'],
516
-        'editMessageText'                 => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'],
517
-        'editMessageCaption'              => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'],
518
-        'editMessageMedia'                => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
519
-        'editMessageReplyMarkup'          => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
520
-        'stopPoll'                        => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'],
521
-        'deleteMessage'                   => ['chat_id','message_id','token','return_array','forgot','answer'],
522
-        'sendSticker'                     => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
523
-        'getStickerSet'                   => ['name','token','return_array','forgot','answer'],
524
-        'uploadStickerFile'               => ['png_sticker','user_id','token','return_array','forgot','answer'],
525
-        'createNewStickerSet'             => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'],
526
-        'addStickerToSet'                 => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'],
527
-        'setStickerPositionInSet'         => ['sticker','position','token','return_array','forgot','answer'],
528
-        'deleteStickerFromSet'            => ['sticker','token','return_array','forgot','answer'],
529
-        'setStickerSetThumb'              => ['name','user_id','thumb','token','return_array','forgot','answer'],
530
-        'answerInlineQuery'               => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'],
531
-        'answerWebAppQuery'               => ['web_app_query_id','result','token','return_array','forgot','answer'],
532
-        'sendInvoice'                     => ['title','description','payload','provider_token','currency','prices','chat_id','max_tip_amount','suggested_tip_amounts','start_parameter','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
533
-        'createInvoiceLink'               => ['title','description','payload','provider_token','currency','prices','max_tip_amount','suggested_tip_amounts','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','token','return_array','forgot','answer'],
534
-        'answerShippingQuery'             => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'],
535
-        'answerPreCheckoutQuery'          => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'],
536
-        'setPassportDataErrors'           => ['errors','user_id','token','return_array','forgot','answer'],
537
-        'sendGame'                        => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
538
-        'setGameScore'                    => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
539
-        'getGameHighScores'               => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
452
+        'getUpdates'                      => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'],
453
+        'setWebhook'                      => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'],
454
+        'deleteWebhook'                   => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'],
455
+        'getWebhookInfo'                  => ['token', 'return_array', 'forgot', 'answer'],
456
+        'getMe'                           => ['token', 'return_array', 'forgot', 'answer'],
457
+        'logOut'                          => ['token', 'return_array', 'forgot', 'answer'],
458
+        'close'                           => ['token', 'return_array', 'forgot', 'answer'],
459
+        'sendMessage'                     => ['text', 'chat_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
460
+        'forwardMessage'                  => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
461
+        'copyMessage'                     => ['chat_id', 'from_chat_id', 'message_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
462
+        'sendPhoto'                       => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
463
+        'sendAudio'                       => ['audio', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'performer', 'title', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
464
+        'sendDocument'                    => ['document', 'chat_id', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_content_type_detection', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
465
+        'sendVideo'                       => ['video', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'supports_streaming', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
466
+        'sendAnimation'                   => ['animation', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
467
+        'sendVoice'                       => ['voice', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
468
+        'sendVideoNote'                   => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
469
+        'sendMediaGroup'                  => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'],
470
+        'sendLocation'                    => ['latitude', 'longitude', 'chat_id', 'horizontal_accuracy', 'live_period', 'heading', 'proximity_alert_radius', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
471
+        'editMessageLiveLocation'         => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
472
+        'stopMessageLiveLocation'         => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
473
+        'sendVenue'                       => ['chat_id', 'latitude', 'longitude', 'title', 'address', 'foursquare_id', 'foursquare_type', 'google_place_id', 'google_place_type', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
474
+        'sendContact'                     => ['phone_number', 'first_name', 'chat_id', 'last_name', 'vcard', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
475
+        'sendPoll'                        => ['question', 'options', 'chat_id', 'is_anonymous', 'type', 'allows_multiple_answers', 'correct_option_id', 'explanation', 'explanation_parse_mode', 'explanation_entities', 'open_period', 'close_date', 'is_closed', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
476
+        'sendDice'                        => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
477
+        'sendChatAction'                  => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'],
478
+        'getUserProfilePhotos'            => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'],
479
+        'getFile'                         => ['file_id', 'token', 'return_array', 'forgot', 'answer'],
480
+        'banChatMember'                   => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'],
481
+        'unbanChatMember'                 => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'],
482
+        'restrictChatMember'              => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'],
483
+        'promoteChatMember'               => ['chat_id', 'user_id', 'is_anonymous', 'can_manage_chat', 'can_post_messages', 'can_edit_messages', 'can_delete_messages', 'can_manage_video_chats', 'can_restrict_members', 'can_promote_members', 'can_change_info', 'can_invite_users', 'can_pin_messages', 'token', 'return_array', 'forgot', 'answer'],
484
+        'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
485
+        'banChatSenderChat'               => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
486
+        'unbanChatSenderChat'             => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
487
+        'setChatPermissions'              => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
488
+        'exportChatInviteLink'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
489
+        'createChatInviteLink'            => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
490
+        'editChatInviteLink'              => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
491
+        'revokeChatInviteLink'            => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
492
+        'approveChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
493
+        'declineChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
494
+        'setChatPhoto'                    => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
495
+        'deleteChatPhoto'                 => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
496
+        'setChatTitle'                    => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
497
+        'setChatDescription'              => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'],
498
+        'pinChatMessage'                  => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'],
499
+        'unpinChatMessage'                => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
500
+        'unpinAllChatMessages'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
501
+        'leaveChat'                       => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
502
+        'getChat'                         => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
503
+        'getChatAdministrators'           => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
504
+        'getChatMemberCount'              => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
505
+        'getChatMember'                   => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
506
+        'setChatStickerSet'               => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
507
+        'deleteChatStickerSet'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
508
+        'answerCallbackQuery'             => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'],
509
+        'setMyCommands'                   => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
510
+        'deleteMyCommands'                => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
511
+        'getMyCommands'                   => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
512
+        'setChatMenuButton'               => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'],
513
+        'getChatMenuButton'               => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
514
+        'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'],
515
+        'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'],
516
+        'editMessageText'                 => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
517
+        'editMessageCaption'              => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
518
+        'editMessageMedia'                => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
519
+        'editMessageReplyMarkup'          => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
520
+        'stopPoll'                        => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
521
+        'deleteMessage'                   => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
522
+        'sendSticker'                     => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
523
+        'getStickerSet'                   => ['name', 'token', 'return_array', 'forgot', 'answer'],
524
+        'uploadStickerFile'               => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
525
+        'createNewStickerSet'             => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
526
+        'addStickerToSet'                 => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
527
+        'setStickerPositionInSet'         => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'],
528
+        'deleteStickerFromSet'            => ['sticker', 'token', 'return_array', 'forgot', 'answer'],
529
+        'setStickerSetThumb'              => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'],
530
+        'answerInlineQuery'               => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'],
531
+        'answerWebAppQuery'               => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'],
532
+        'sendInvoice'                     => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'chat_id', 'max_tip_amount', 'suggested_tip_amounts', 'start_parameter', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
533
+        'createInvoiceLink'               => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'max_tip_amount', 'suggested_tip_amounts', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'token', 'return_array', 'forgot', 'answer'],
534
+        'answerShippingQuery'             => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
535
+        'answerPreCheckoutQuery'          => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
536
+        'setPassportDataErrors'           => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
537
+        'sendGame'                        => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
538
+        'setGameScore'                    => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
539
+        'getGameHighScores'               => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
540 540
     ];
541 541
 
542 542
     private const METHODS_WITH_FILE = [
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
         'logOut'                          => [],
566 566
         'close'                           => [],
567 567
         'sendMessage'                     => ['chat_id'],
568
-        'forwardMessage'                  => ['from_chat_id','message_id'],
569
-        'copyMessage'                     => ['from_chat_id','message_id'],
568
+        'forwardMessage'                  => ['from_chat_id', 'message_id'],
569
+        'copyMessage'                     => ['from_chat_id', 'message_id'],
570 570
         'sendPhoto'                       => ['chat_id'],
571 571
         'sendAudio'                       => ['chat_id'],
572 572
         'sendDocument'                    => ['chat_id'],
@@ -582,15 +582,15 @@  discard block
 block discarded – undo
582 582
         'sendContact'                     => ['chat_id'],
583 583
         'sendPoll'                        => ['chat_id'],
584 584
         'sendDice'                        => ['chat_id'],
585
-        'sendChatAction'                  => ['chat_id','action'],
585
+        'sendChatAction'                  => ['chat_id', 'action'],
586 586
         'getUserProfilePhotos'            => ['user_id'],
587 587
         'getFile'                         => ['file_id'],
588
-        'banChatMember'                   => ['chat_id','user_id'],
589
-        'kickChatMember'                  => ['chat_id','user_id'],
590
-        'unbanChatMember'                 => ['chat_id','user_id'],
591
-        'restrictChatMember'              => ['chat_id','user_id'],
592
-        'promoteChatMember'               => ['chat_id','user_id'],
593
-        'setChatAdministratorCustomTitle' => ['chat_id','user_id'],
588
+        'banChatMember'                   => ['chat_id', 'user_id'],
589
+        'kickChatMember'                  => ['chat_id', 'user_id'],
590
+        'unbanChatMember'                 => ['chat_id', 'user_id'],
591
+        'restrictChatMember'              => ['chat_id', 'user_id'],
592
+        'promoteChatMember'               => ['chat_id', 'user_id'],
593
+        'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'],
594 594
         'banChatSenderChat'               => ['chat_id'],
595 595
         'unbanChatSenderChat'             => ['chat_id'],
596 596
         'setChatPermissions'              => ['chat_id'],
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
         'createChatInviteLink'            => ['chat_id'],
599 599
         'editChatInviteLink'              => ['chat_id'],
600 600
         'revokeChatInviteLink'            => ['chat_id'],
601
-        'approveChatJoinRequest'          => ['chat_id','user_id'],
602
-        'declineChatJoinRequest'          => ['chat_id','user_id'],
601
+        'approveChatJoinRequest'          => ['chat_id', 'user_id'],
602
+        'declineChatJoinRequest'          => ['chat_id', 'user_id'],
603 603
         'setChatPhoto'                    => ['chat_id'],
604 604
         'deleteChatPhoto'                 => ['chat_id'],
605 605
         'setChatTitle'                    => ['chat_id'],
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
         'getChat'                         => ['chat_id'],
612 612
         'getChatAdministrators'           => ['chat_id'],
613 613
         'getChatMembersCount'             => ['chat_id'],
614
-        'getChatMember'                   => ['chat_id','user_id'],
614
+        'getChatMember'                   => ['chat_id', 'user_id'],
615 615
         'setChatStickerSet'               => ['chat_id'],
616 616
         'deleteChatStickerSet'            => ['chat_id'],
617 617
         'answerCallbackQuery'             => ['callback_query_id'],
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
         'getChatMenuButton'               => [],
623 623
         'setMyDefaultAdministratorRights' => [],
624 624
         'getMyDefaultAdministratorRights' => [],
625
-        'editMessageText'                 => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
626
-        'editMessageCaption'              => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
627
-        'editMessageMedia'                => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
628
-        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
629
-        'stopPoll'                        => ['chat_id','message_id'],
630
-        'deleteMessage'                   => ['chat_id','message_id'],
625
+        'editMessageText'                 => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
626
+        'editMessageCaption'              => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
627
+        'editMessageMedia'                => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
628
+        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
629
+        'stopPoll'                        => ['chat_id', 'message_id'],
630
+        'deleteMessage'                   => ['chat_id', 'message_id'],
631 631
         'sendSticker'                     => ['chat_id'],
632 632
         'getStickerSet'                   => [],
633 633
         'uploadStickerFile'               => ['user_id'],
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
         'answerPreCheckoutQuery'          => ['pre_checkout_query_id'],
644 644
         'setPassportDataErrors'           => ['user_id'],
645 645
         'sendGame'                        => ['chat_id'],
646
-        'setGameScore'                    => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
647
-        'getGameHighScores'               => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']]
646
+        'setGameScore'                    => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
647
+        'getGameHighScores'               => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']]
648 648
     ];
649 649
     
650 650
     private const METHODS_RETURN = [
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
     ];
697 697
 
698 698
 
699
-    public static function __callStatic (string $name, array $arguments) {
699
+    public static function __callStatic(string $name, array $arguments) {
700 700
         if ($action = self::methodAction($name)) {
701
-            self::keysName($action,$arguments);
702
-            self::readyFile($action,$arguments);
703
-            self::setDefaults($action,$arguments);
701
+            self::keysName($action, $arguments);
702
+            self::readyFile($action, $arguments);
703
+            self::setDefaults($action, $arguments);
704 704
             if (isset($arguments['answer'])) {
705
-                return answer::init($action,$arguments);
705
+                return answer::init($action, $arguments);
706 706
             }
707 707
             else {
708
-                return self::processResponse($action,curl::init($action,$arguments));
708
+                return self::processResponse($action, curl::init($action, $arguments));
709 709
             }
710 710
         }
711 711
         else {
712
-            logger::write("$name method is not supported",loggerTypes::ERROR);
712
+            logger::write("$name method is not supported", loggerTypes::ERROR);
713 713
             throw new bptException('METHOD_NOT_FOUND');
714 714
         }
715 715
     }
716 716
 
717
-    private static function keysName (string $name, array &$arguments) {
717
+    private static function keysName(string $name, array &$arguments) {
718 718
         foreach ($arguments as $key => $argument) {
719 719
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
720 720
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         }
724 724
     }
725 725
 
726
-    private static function methodAction(string $name): string|false {
726
+    private static function methodAction(string $name): string | false {
727 727
         return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
728 728
     }
729 729
 
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
         }
745 745
     }
746 746
 
747
-    private static function methodFile(string $name): array|false {
747
+    private static function methodFile(string $name): array | false {
748 748
         return self::METHODS_WITH_FILE[$name] ?? false;
749 749
     }
750 750
 
751
-    private static function methodReturn(string $name,stdClass $response) {
751
+    private static function methodReturn(string $name, stdClass $response) {
752 752
         if (isset(self::METHODS_RETURN[$name])) {
753 753
             $return = self::METHODS_RETURN[$name];
754 754
             if (is_array($return)) {
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
         $defaults = self::METHODS_EXTRA_DEFAULTS[$name];
772 772
         foreach ($defaults as $key => $default) {
773 773
             if (is_numeric($key)) {
774
-                if (!isset($arguments[$default])){
774
+                if (!isset($arguments[$default])) {
775 775
                     $arguments[$default] = self::catchFields($default);
776 776
                 }
777 777
             }
778 778
             elseif (isset(BPT::$update->$key) || $key === 'other') {
779 779
                 foreach ($default as $def) {
780
-                    if (!isset($arguments[$def])){
780
+                    if (!isset($arguments[$def])) {
781 781
                         $arguments[$def] = self::catchFields($def);
782 782
                     }
783 783
                 }
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
     private static function processResponse(string $name, stdClass $response) {
790 790
         if ($response->ok) {
791 791
             self::$status = true;
792
-            return self::methodReturn($name,$response);
792
+            return self::methodReturn($name, $response);
793 793
         }
794 794
         else {
795 795
             self::$status = false;
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         }
798 798
     }
799 799
 
800
-    public static function catchFields (string $field): int|string|bool {
800
+    public static function catchFields(string $field): int | string | bool {
801 801
         switch ($field) {
802 802
             case 'chat_id' :
803 803
             case 'from_chat_id' :
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
                     default => false
934 934
                 };
935 935
             case 'url' :
936
-                return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
936
+                return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
937 937
             default:
938 938
                 return false;
939 939
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -17 removed lines patch added patch discarded remove patch
@@ -703,12 +703,10 @@  discard block
 block discarded – undo
703 703
             self::setDefaults($action,$arguments);
704 704
             if (isset($arguments['answer'])) {
705 705
                 return answer::init($action,$arguments);
706
-            }
707
-            else {
706
+            } else {
708 707
                 return self::processResponse($action,curl::init($action,$arguments));
709 708
             }
710
-        }
711
-        else {
709
+        } else {
712 710
             logger::write("$name method is not supported",loggerTypes::ERROR);
713 711
             throw new bptException('METHOD_NOT_FOUND');
714 712
         }
@@ -734,8 +732,7 @@  discard block
 block discarded – undo
734 732
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
735 733
                 }
736 734
             }
737
-        }
738
-        elseif ($file_params = self::methodFile($name)) {
735
+        } elseif ($file_params = self::methodFile($name)) {
739 736
             foreach ($file_params as $param) {
740 737
                 if (isset($arguments[$param]) && file_exists($arguments[$param])) {
741 738
                     $arguments[$param] = new CURLFile($arguments[$param]);
@@ -757,12 +754,10 @@  discard block
 block discarded – undo
757 754
                     $value = new ($return[0]) ($value);
758 755
                 }
759 756
                 return $response;
760
-            }
761
-            else {
757
+            } else {
762 758
                 return new ($return) ($response->result);
763 759
             }
764
-        }
765
-        else {
760
+        } else {
766 761
             return $response->result;
767 762
         }
768 763
     }
@@ -774,8 +769,7 @@  discard block
 block discarded – undo
774 769
                 if (!isset($arguments[$default])){
775 770
                     $arguments[$default] = self::catchFields($default);
776 771
                 }
777
-            }
778
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
772
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
779 773
                 foreach ($default as $def) {
780 774
                     if (!isset($arguments[$def])){
781 775
                         $arguments[$def] = self::catchFields($def);
@@ -790,8 +784,7 @@  discard block
 block discarded – undo
790 784
         if ($response->ok) {
791 785
             self::$status = true;
792 786
             return self::methodReturn($name,$response);
793
-        }
794
-        else {
787
+        } else {
795 788
             self::$status = false;
796 789
             return new responseError($response);
797 790
         }
@@ -826,9 +819,13 @@  discard block
 block discarded – undo
826 819
                     default => false
827 820
                 };
828 821
             case 'file_id' :
829
-                if (isset(BPT::$update->message)) $type = 'message';
830
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
831
-                else return false;
822
+                if (isset(BPT::$update->message)) {
823
+                    $type = 'message';
824
+                } elseif (isset(BPT::$update->edited_message)) {
825
+                    $type = 'edited_message';
826
+                } else {
827
+                    return false;
828
+                }
832 829
 
833 830
                 return match(true) {
834 831
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.
BPT.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -241,18 +241,18 @@
 block discarded – undo
241 241
  * @method gameHighScore[]|responseError getGameHighScores (int|null|array $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
242 242
  * @method gameHighScore[]|responseError getGameHigh (int|null|array $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
243 243
  */
244
-class BPT extends telegram{
244
+class BPT extends telegram {
245 245
     public static update $update;
246 246
 
247 247
     public static BPT $handler;
248 248
 
249 249
 
250
-    public function __construct (array|stdClass $settings) {
250
+    public function __construct(array | stdClass $settings) {
251 251
         static::$handler = &$this;
252 252
         settings::init($settings);
253 253
     }
254 254
 
255
-    public static function exit (string|null $message = null) {
255
+    public static function exit (string | null $message = null) {
256 256
         die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>");
257 257
     }
258 258
 }
Please login to merge, or discard this patch.
exception/bptException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
 
5 5
 use Exception;
6 6
 
7
-class bptException extends Exception{}
8 7
\ No newline at end of file
8
+class bptException extends Exception {}
9 9
\ No newline at end of file
Please login to merge, or discard this patch.