@@ -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 | |
@@ -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 | |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | $this->type = 'Voice'; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $this->caption = isset($data['caption']) ? $data['caption'] : null;//string |
|
| 191 | + $this->caption = isset($data['caption']) ? $data['caption'] : null; //string |
|
| 192 | 192 | |
| 193 | 193 | $this->contact = isset($data['contact']) ? $data['contact'] : null; |
| 194 | 194 | if (!empty($this->contact)) { |
@@ -47,8 +47,8 @@ |
||
| 47 | 47 | //return random picture from the telegram->getUploadPath(); |
| 48 | 48 | |
| 49 | 49 | private function ShowRandomImage($dir) { |
| 50 | - $image_list = scandir($dir); |
|
| 51 | - return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
| 52 | - } |
|
| 50 | + $image_list = scandir($dir); |
|
| 51 | + return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |
@@ -45,19 +45,19 @@ discard block |
||
| 45 | 45 | $keyboards = []; |
| 46 | 46 | |
| 47 | 47 | //0 |
| 48 | - $keyboard[] = ['7','8','9']; |
|
| 49 | - $keyboard[] = ['4','5','6']; |
|
| 50 | - $keyboard[] = ['1','2','3']; |
|
| 51 | - $keyboard[] = [' ','0',' ']; |
|
| 48 | + $keyboard[] = ['7', '8', '9']; |
|
| 49 | + $keyboard[] = ['4', '5', '6']; |
|
| 50 | + $keyboard[] = ['1', '2', '3']; |
|
| 51 | + $keyboard[] = [' ', '0', ' ']; |
|
| 52 | 52 | |
| 53 | 53 | $keyboards[] = $keyboard; |
| 54 | 54 | unset($keyboard); |
| 55 | 55 | |
| 56 | 56 | //1 |
| 57 | - $keyboard[] = ['7','8','9','+']; |
|
| 58 | - $keyboard[] = ['4','5','6','-']; |
|
| 59 | - $keyboard[] = ['1','2','3','*']; |
|
| 60 | - $keyboard[] = [' ','0',' ','/']; |
|
| 57 | + $keyboard[] = ['7', '8', '9', '+']; |
|
| 58 | + $keyboard[] = ['4', '5', '6', '-']; |
|
| 59 | + $keyboard[] = ['1', '2', '3', '*']; |
|
| 60 | + $keyboard[] = [' ', '0', ' ', '/']; |
|
| 61 | 61 | |
| 62 | 62 | $keyboards[] = $keyboard; |
| 63 | 63 | unset($keyboard); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | //3 |
| 74 | 74 | $keyboard[] = ['A']; |
| 75 | 75 | $keyboard[] = ['B']; |
| 76 | - $keyboard[] = ['C','D']; |
|
| 76 | + $keyboard[] = ['C', 'D']; |
|
| 77 | 77 | |
| 78 | 78 | $keyboards[] = $keyboard; |
| 79 | 79 | unset($keyboard); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $data['reply_markup'] = new ReplyKeyboardMarkup( |
| 97 | 97 | [ |
| 98 | - 'keyboard' => $keyboards[1] , |
|
| 98 | + 'keyboard' => $keyboards[1], |
|
| 99 | 99 | 'resize_keyboard' => true, |
| 100 | 100 | 'one_time_keyboard' => false, |
| 101 | 101 | 'selective' => false |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | |
| 22 | 22 | // Enter your MySQL database credentials |
| 23 | 23 | $mysql_credentials = [ |
| 24 | - 'host' => 'localhost', |
|
| 25 | - 'user' => 'dbuser', |
|
| 26 | - 'password' => 'dbpass', |
|
| 27 | - 'database' => 'dbname', |
|
| 24 | + 'host' => 'localhost', |
|
| 25 | + 'user' => 'dbuser', |
|
| 26 | + 'password' => 'dbpass', |
|
| 27 | + 'database' => 'dbname', |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | try { |
@@ -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 | ) |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | 'first_name' => 'botname', |
| 154 | 154 | 'username' => 'namebot', |
| 155 | 155 | ]; |
| 156 | - $data['chat'] = ['id' => $data['chat_id']]; |
|
| 156 | + $data['chat'] = ['id' => $data['chat_id']]; |
|
| 157 | 157 | |
| 158 | 158 | $fake_response['result'] = $data; |
| 159 | 159 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // Conversation |
| 75 | 75 | $this->conversation = new Conversation($user_id, $chat_id, $this->getName()); |
| 76 | 76 | |
| 77 | - $channels = (array)$this->getConfig('your_channel'); |
|
| 77 | + $channels = (array) $this->getConfig('your_channel'); |
|
| 78 | 78 | if (!isset($this->conversation->notes['state'])) { |
| 79 | 79 | $state = (count($channels) == 0) ? -1 : 0; |
| 80 | 80 | $this->conversation->notes['last_message_id'] = $message->getMessageId(); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | 'selective' => true |
| 163 | 163 | ] |
| 164 | 164 | ); |
| 165 | - $data['reply_markup'] = $reply_keyboard_markup; |
|
| 165 | + $data['reply_markup'] = $reply_keyboard_markup; |
|
| 166 | 166 | |
| 167 | 167 | $data['text'] = 'Would you insert caption?'; |
| 168 | 168 | if ($this->conversation->notes['last_message_id'] != $message->getMessageId() && !($text == 'Yes' || $text == 'No')) { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | if ($text === '') { |
| 267 | 267 | $data['text'] = 'Usage: /sendtochannel <text>'; |
| 268 | 268 | } else { |
| 269 | - $channels = (array)$this->getConfig('your_channel'); |
|
| 269 | + $channels = (array) $this->getConfig('your_channel'); |
|
| 270 | 270 | $first_channel = $channels[0]; |
| 271 | 271 | $data['text'] = $this->publish(new Message($message->reflect(), 'anystring'), $first_channel); |
| 272 | 272 | } |