diff --git a/src/Commands/Tinker.php b/src/Commands/Tinker.php index 9a4ad32..1ab0742 100644 --- a/src/Commands/Tinker.php +++ b/src/Commands/Tinker.php @@ -68,4 +68,4 @@ public function handle() $loop->run(); } -} \ No newline at end of file +} diff --git a/src/Drivers/ConsoleDriver.php b/src/Drivers/ConsoleDriver.php index 9278a9a..1899900 100644 --- a/src/Drivers/ConsoleDriver.php +++ b/src/Drivers/ConsoleDriver.php @@ -23,7 +23,7 @@ class ConsoleDriver implements DriverInterface /** @var string */ protected $bot_id; - /** @var boolean */ + /** @var bool */ protected $hasQuestion = false; /** @var array */ @@ -75,15 +75,17 @@ public function matchesRequest() */ public function getConversationAnswer(IncomingMessage $message) { - $index = (int)$message->getText() - 1; + $index = (int) $message->getText() - 1; if ($this->hasQuestion && isset($this->lastQuestions[$index])) { $question = $this->lastQuestions[$index]; + return Answer::create($question['name']) ->setInteractiveReply(true) ->setValue($question['value']) ->setMessage($message); } + return Answer::create($this->message)->setMessage($message); } @@ -163,9 +165,9 @@ public function sendPayload($payload) $questionData = $payload['questionData']; $this->client->writeln(self::BOT_NAME.': '.$payload['text']); - if (!is_null($questionData)) { + if (! is_null($questionData)) { foreach ($questionData['actions'] as $key => $action) { - $this->client->writeln(($key+1).') '.$action['text']); + $this->client->writeln(($key + 1).') '.$action['text']); } $this->hasQuestion = true; $this->lastQuestions = $questionData['actions']; diff --git a/src/TinkerServiceProvider.php b/src/TinkerServiceProvider.php index eee9977..1f2a8d3 100644 --- a/src/TinkerServiceProvider.php +++ b/src/TinkerServiceProvider.php @@ -1,4 +1,5 @@ commands([ - Tinker::class + Tinker::class, ]); } - -} \ No newline at end of file +}