@@ -84,7 +84,7 @@ |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | try { |
| 87 | - $sth = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '` |
|
| 87 | + $sth = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '` |
|
| 88 | 88 | ( |
| 89 | 89 | `status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at` |
| 90 | 90 | ) |
@@ -262,7 +262,7 @@ |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | //Convert each Entity item into an object based on its JSON reflection |
| 265 | - $json_entities = array_map(function ($entity) { |
|
| 265 | + $json_entities = array_map(function($entity) { |
|
| 266 | 266 | return json_decode($entity, true); |
| 267 | 267 | }, $entities); |
| 268 | 268 | |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | { |
| 43 | 43 | return is_array($data) && |
| 44 | 44 | array_key_exists('text', $data) && ( |
| 45 | - array_key_exists('url', $data) || |
|
| 45 | + array_key_exists('url', $data) || |
|
| 46 | 46 | array_key_exists('callback_data', $data) || |
| 47 | 47 | array_key_exists('switch_inline_query', $data) || |
| 48 | 48 | array_key_exists('switch_inline_query_current_chat', $data) |
| 49 | - ); |
|
| 49 | + ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -100,11 +100,11 @@ |
||
| 100 | 100 | |
| 101 | 101 | $result_object_types = [ |
| 102 | 102 | 'total_count' => 'UserProfilePhotos', //Response from getUserProfilePhotos |
| 103 | - 'file_id' => 'File', //Response from getFile |
|
| 104 | - 'title' => 'Chat', //Response from getChat |
|
| 105 | - 'username' => 'User', //Response from getMe |
|
| 106 | - 'user' => 'ChatMember', //Response from getChatMember |
|
| 107 | - 'url' => 'WebhookInfo', //Response from getWebhookInfo |
|
| 103 | + 'file_id' => 'File', //Response from getFile |
|
| 104 | + 'title' => 'Chat', //Response from getChat |
|
| 105 | + 'username' => 'User', //Response from getMe |
|
| 106 | + 'user' => 'ChatMember', //Response from getChatMember |
|
| 107 | + 'url' => 'WebhookInfo', //Response from getWebhookInfo |
|
| 108 | 108 | ]; |
| 109 | 109 | foreach ($result_object_types as $type => $object_class) { |
| 110 | 110 | if (isset($result[$type])) { |
@@ -199,8 +199,8 @@ |
||
| 199 | 199 | public function escapeMarkdown($string) |
| 200 | 200 | { |
| 201 | 201 | return str_replace( |
| 202 | - ['[', '`', '*', '_',], |
|
| 203 | - ['\[', '\`', '\*', '\_',], |
|
| 202 | + ['[', '`', '*', '_', ], |
|
| 203 | + ['\[', '\`', '\*', '\_', ], |
|
| 204 | 204 | $string |
| 205 | 205 | ); |
| 206 | 206 | } |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | $this->run_commands = true; |
| 919 | - $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands! |
|
| 919 | + $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands! |
|
| 920 | 920 | |
| 921 | 921 | $result = Request::getMe()->getResult(); |
| 922 | 922 | |
@@ -928,8 +928,8 @@ discard block |
||
| 928 | 928 | $bot_name = $result->getFirstName(); |
| 929 | 929 | $bot_username = $result->getUsername(); |
| 930 | 930 | |
| 931 | - $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
| 932 | - $this->getCommandsList(); // Load full commands list |
|
| 931 | + $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
| 932 | + $this->getCommandsList(); // Load full commands list |
|
| 933 | 933 | |
| 934 | 934 | foreach ($commands as $command) { |
| 935 | 935 | $this->update = new Update( |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | 'first_name' => 'botname', |
| 189 | 189 | 'username' => 'namebot', |
| 190 | 190 | ]; |
| 191 | - $data['chat'] = ['id' => $data['chat_id']]; |
|
| 191 | + $data['chat'] = ['id' => $data['chat_id']]; |
|
| 192 | 192 | |
| 193 | 193 | $fake_response['result'] = $data; |
| 194 | 194 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $multipart = []; |
| 213 | 213 | |
| 214 | 214 | // Convert any nested arrays into JSON strings. |
| 215 | - array_walk($data, function (&$item) { |
|
| 215 | + array_walk($data, function(&$item) { |
|
| 216 | 216 | is_array($item) && $item = json_encode($item); |
| 217 | 217 | }); |
| 218 | 218 | |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | */ |
| 850 | 850 | public static function setWebhook($url = '', array $data = []) |
| 851 | 851 | { |
| 852 | - $data = array_intersect_key($data, array_flip([ |
|
| 852 | + $data = array_intersect_key($data, array_flip([ |
|
| 853 | 853 | 'certificate', |
| 854 | 854 | 'max_connections', |
| 855 | 855 | 'allowed_updates', |
@@ -1077,8 +1077,8 @@ discard block |
||
| 1077 | 1077 | $requests = DB::getTelegramRequestCount($chat_id, $inline_message_id); |
| 1078 | 1078 | |
| 1079 | 1079 | $chat_per_second = ($requests['LIMIT_PER_SEC'] == 0); // No more than one message per second inside a particular chat |
| 1080 | - $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats |
|
| 1081 | - $groups_per_minute = (((is_numeric($chat_id) && $chat_id > 0) || !is_null($inline_message_id)) || ((!is_numeric($chat_id) || $chat_id < 0) && $requests['LIMIT_PER_MINUTE'] < 20)); // No more than 20 messages per minute in groups and channels |
|
| 1080 | + $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats |
|
| 1081 | + $groups_per_minute = (((is_numeric($chat_id) && $chat_id > 0) || !is_null($inline_message_id)) || ((!is_numeric($chat_id) || $chat_id < 0) && $requests['LIMIT_PER_MINUTE'] < 20)); // No more than 20 messages per minute in groups and channels |
|
| 1082 | 1082 | |
| 1083 | 1083 | if ($chat_per_second && $global_per_second && $groups_per_minute) { |
| 1084 | 1084 | break; |