@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | require __DIR__ . '/../vendor/autoload.php'; |
3 | 3 | |
4 | -$filename='logfile.log'; |
|
4 | +$filename = 'logfile.log'; |
|
5 | 5 | $API_KEY = 'random'; |
6 | 6 | $BOT_NAME = 'bot_name'; |
7 | 7 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($chat->isGroupChat() || $chat->isSuperGroup()) { |
59 | 59 | //reply to message id is applied by default |
60 | 60 | //Force reply is applied by default to so can work with privacy on |
61 | - $data['reply_markup'] = new ForceReply([ 'selective' => true]); |
|
61 | + $data['reply_markup'] = new ForceReply(['selective' => true]); |
|
62 | 62 | } |
63 | 63 | $data['chat_id'] = $chat_id; |
64 | 64 | |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $this->conversation->notes['state'] = 3; |
125 | 125 | $this->conversation->update(); |
126 | 126 | |
127 | - $keyboard = [['M','F']]; |
|
127 | + $keyboard = [['M', 'F']]; |
|
128 | 128 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
129 | 129 | [ |
130 | - 'keyboard' => $keyboard , |
|
130 | + 'keyboard' => $keyboard, |
|
131 | 131 | 'resize_keyboard' => true, |
132 | 132 | 'one_time_keyboard' => true, |
133 | 133 | 'selective' => true |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $this->conversation->update(); |
152 | 152 | $data['reply_markup'] = new ReplyKeyboardMarkup([ |
153 | 153 | 'keyboard' => [[ |
154 | - [ 'text' => 'Share Location', 'request_location' => true ], |
|
154 | + ['text' => 'Share Location', 'request_location' => true], |
|
155 | 155 | ]], |
156 | 156 | 'resize_keyboard' => true, |
157 | 157 | 'one_time_keyboard' => true, |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $data['text'] = 'Share your contact information:'; |
188 | 188 | $data['reply_markup'] = new ReplyKeyboardMarkup([ |
189 | 189 | 'keyboard' => [[ |
190 | - [ 'text' => 'Share Contact', 'request_contact' => true ], |
|
190 | + ['text' => 'Share Contact', 'request_contact' => true], |
|
191 | 191 | ]], |
192 | 192 | 'resize_keyboard' => true, |
193 | 193 | 'one_time_keyboard' => true, |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $out_text = '/Survey result:' . "\n"; |
205 | 205 | unset($this->conversation->notes['state']); |
206 | 206 | foreach ($this->conversation->notes as $k => $v) { |
207 | - $out_text .= "\n" . ucfirst($k).': ' . $v; |
|
207 | + $out_text .= "\n" . ucfirst($k) . ': ' . $v; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $data['photo'] = $this->conversation->notes['photo_id']; |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $command = trim($message->getText(true)); |
40 | 40 | |
41 | 41 | //Only get enabled Admin and User commands |
42 | - $commands = array_filter($this->telegram->getCommandsList(), function ($command) { |
|
42 | + $commands = array_filter($this->telegram->getCommandsList(), function($command) { |
|
43 | 43 | return (!$command->isSystemCommand() && $command->isEnabled()); |
44 | 44 | }); |
45 | 45 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | throw new TelegramException($e->getMessage()); |
61 | 61 | } |
62 | 62 | |
63 | - return (string)$response->getBody(); |
|
63 | + return (string) $response->getBody(); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $limit = 10; |
56 | 56 | $offset = null; |
57 | 57 | $ServerResponse = Request::getUserProfilePhotos([ |
58 | - 'user_id' => $user_id , |
|
58 | + 'user_id' => $user_id, |
|
59 | 59 | 'limit' => $limit, |
60 | 60 | 'offset' => $offset, |
61 | 61 | ]); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $command = $message->getCommand(); |
44 | 44 | $text = trim($message->getText(true)); |
45 | 45 | |
46 | - $data = [ 'chat_id' => $chat_id ]; |
|
46 | + $data = ['chat_id' => $chat_id]; |
|
47 | 47 | |
48 | 48 | //No point in replying to messages in private chats |
49 | 49 | if (!$message->getChat()->isPrivateChat()) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $limit = 10; |
118 | 118 | $offset = null; |
119 | 119 | $ServerResponse = Request::getUserProfilePhotos([ |
120 | - 'user_id' => $user_id , |
|
120 | + 'user_id' => $user_id, |
|
121 | 121 | 'limit' => $limit, |
122 | 122 | 'offset' => $offset, |
123 | 123 | ]); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return Request::sendPhoto($data); |
141 | 141 | } |
142 | 142 | } elseif ($chat->isGroupChat()) { |
143 | - $text = 'Chat ID: ' . $user_id . (!empty($old_id) ? ' (previously: '.$old_id.')' : ''). "\n"; |
|
143 | + $text = 'Chat ID: ' . $user_id . (!empty($old_id) ? ' (previously: ' . $old_id . ')' : '') . "\n"; |
|
144 | 144 | $text .= 'Type: ' . ucfirst($chat->getType()) . "\n"; |
145 | 145 | $text .= 'Title: ' . $chat->getTitle() . "\n"; |
146 | 146 | $text .= 'First time added to group: ' . $created_at . "\n"; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | $text_back .= "\n" . 'Total: ' . ($user_chats + $group_chats + $super_group_chats); |
103 | 103 | |
104 | 104 | if ($text === '') { |
105 | - $text_back .= "\n\n" . 'List all chats: /' . $this->name .' *' . "\n" . 'Search for chats: /' . $this->name .' <search string>'; |
|
105 | + $text_back .= "\n\n" . 'List all chats: /' . $this->name . ' *' . "\n" . 'Search for chats: /' . $this->name . ' <search string>'; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
98 | 98 | [ |
99 | - 'keyboard' => $keyboard , |
|
99 | + 'keyboard' => $keyboard, |
|
100 | 100 | 'resize_keyboard' => true, |
101 | 101 | 'one_time_keyboard' => true, |
102 | 102 | 'selective' => true |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $keyboard = [['Yes', 'No']]; |
140 | 140 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
141 | 141 | [ |
142 | - 'keyboard' => $keyboard , |
|
142 | + 'keyboard' => $keyboard, |
|
143 | 143 | 'resize_keyboard' => true, |
144 | 144 | 'one_time_keyboard' => true, |
145 | 145 | 'selective' => true |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->conversation->notes['last_message_id'] = $message->getMessageId(); |
163 | 163 | // no break |
164 | 164 | case 3: |
165 | - if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message' ) && $this->conversation->notes['set_caption']) { |
|
165 | + if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message') && $this->conversation->notes['set_caption']) { |
|
166 | 166 | $this->conversation->notes['state'] = 3; |
167 | 167 | $this->conversation->update(); |
168 | 168 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $keyboard = [['Yes', 'No']]; |
196 | 196 | $reply_keyboard_markup = new ReplyKeyboardMarkup( |
197 | 197 | [ |
198 | - 'keyboard' => $keyboard , |
|
198 | + 'keyboard' => $keyboard, |
|
199 | 199 | 'resize_keyboard' => true, |
200 | 200 | 'one_time_keyboard' => true, |
201 | 201 | 'selective' => true |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | if ($this->sendBack($message, $data)->isOk()) { |
274 | 274 | $response = 'Message sent successfully to: ' . $channel; |
275 | 275 | } else { |
276 | - $response = 'Message not sent to: ' . $channel . "\n" . |
|
276 | + $response = 'Message not sent to: ' . $channel . "\n" . |
|
277 | 277 | '- Does the channel exist?' . "\n" . |
278 | 278 | '- Is the bot an admin of the channel?'; |
279 | 279 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | $callback_path = 'Longman\TelegramBot\Request'; |
325 | 325 | $callback_function = 'send' . $type; |
326 | - if (! method_exists($callback_path, $callback_function)) { |
|
326 | + if (!method_exists($callback_path, $callback_function)) { |
|
327 | 327 | throw new TelegramException('Methods: ' . $callback_function . ' not found in class Request.'); |
328 | 328 | } |
329 | 329 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | //Where |
161 | 161 | $a = 0; |
162 | - $where = ''; |
|
162 | + $where = ''; |
|
163 | 163 | foreach ($where_fields_values as $field => $value) { |
164 | 164 | if ($a) { |
165 | 165 | $where .= ' AND '; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $where .= 'WHERE '; |
169 | 169 | } |
170 | 170 | ++$tokens_counter; |
171 | - $where .= '`' . $field .'`= :' . $tokens_counter; |
|
171 | + $where .= '`' . $field . '`= :' . $tokens_counter; |
|
172 | 172 | $tokens[':' . $tokens_counter] = $value; |
173 | 173 | } |
174 | 174 |