@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param array $buttons Buttons passed as inizialization. |
| 40 | 40 | */ |
| 41 | 41 | public function __construct( |
| 42 | - CoreBot &$bot, |
|
| 42 | + CoreBot & $bot, |
|
| 43 | 43 | array $buttons = array() |
| 44 | 44 | ) { |
| 45 | 45 | // Set bot reference |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public function getBackButton(bool $json_serialized = true) |
| 59 | 59 | { |
| 60 | 60 | // Create the button |
| 61 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 61 | + $inline_keyboard = ['inline_keyboard' => |
|
| 62 | 62 | [ |
| 63 | 63 | [ |
| 64 | 64 | [ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function getBackSkipKeyboard(bool $json_serialized = true) |
| 87 | 87 | { |
| 88 | 88 | // Create the keyboard |
| 89 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 89 | + $inline_keyboard = ['inline_keyboard' => |
|
| 90 | 90 | [ |
| 91 | 91 | [ |
| 92 | 92 | [ |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | protected function addDefaultValue(array $params) : array |
| 80 | 80 | { |
| 81 | - static $defaults = [ 'adapter' => PDO_DEFAULT_ADAPTER, 'host' => 'localhost', 'options' => [] ]; |
|
| 81 | + static $defaults = ['adapter' => PDO_DEFAULT_ADAPTER, 'host' => 'localhost', 'options' => []]; |
|
| 82 | 82 | return array_merge($defaults, $params); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -8,21 +8,21 @@ discard block |
||
| 8 | 8 | require_once '../../vendor/autoload.php'; |
| 9 | 9 | |
| 10 | 10 | class WhoAmIBot extends PhpBotFramework\Bot { |
| 11 | - // Override 'processMessage' in order to intercept the message and |
|
| 12 | - // get information about its author (if forwarded, its original author). |
|
| 13 | - protected function processMessage($message) { |
|
| 11 | + // Override 'processMessage' in order to intercept the message and |
|
| 12 | + // get information about its author (if forwarded, its original author). |
|
| 13 | + protected function processMessage($message) { |
|
| 14 | 14 | // Check if the message was forward |
| 15 | 15 | isset($message['forward_from']) ? $index = 'forward_from' : $index = 'from'; |
| 16 | 16 | |
| 17 | 17 | $response = $this->prepareResponse($message[$index]); |
| 18 | 18 | $this->sendMessage($response); |
| 19 | - } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - private function prepareResponse($user) { |
|
| 21 | + private function prepareResponse($user) { |
|
| 22 | 22 | return '<strong>Message sent by </strong>' . $user['first_name'] . "\n" . |
| 23 | - '<strong>User ID: </strong>' . $user['id'] . "\n" . |
|
| 24 | - '<strong>Username: </strong>' . $user['username'] . "\n"; |
|
| 25 | - } |
|
| 23 | + '<strong>User ID: </strong>' . $user['id'] . "\n" . |
|
| 24 | + '<strong>Username: </strong>' . $user['username'] . "\n"; |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Add a welcome message |
| 32 | 32 | $bot->addMessageCommand('start', function ($bot, $message) { |
| 33 | - $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
|
| 33 | + $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
|
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | $bot->getUpdatesLocal(); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $bot = new WhoAmIBot('YOUR_BOT_TOKEN'); |
| 30 | 30 | |
| 31 | 31 | // Add a welcome message |
| 32 | -$bot->addMessageCommand('start', function ($bot, $message) { |
|
| 32 | +$bot->addMessageCommand('start', function($bot, $message) { |
|
| 33 | 33 | $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
| 34 | 34 | }); |
| 35 | 35 | |