Skip to content

Commit 861800a

Browse files
martinmuntzingmpociot
authored andcommitted
Corrected deprecated 'line' event and writeln method calls (#12)
1 parent b60b354 commit 861800a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Commands/Tinker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function handle()
5555

5656
$botman->setDriver(new ConsoleDriver($config, $stdio));
5757

58-
$stdio->on('line', function ($line) use ($botman) {
58+
$stdio->on('data', function ($line) use ($botman) {
5959
$botman->listen();
6060
});
6161

src/Drivers/ConsoleDriver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public function __construct(array $config, Stdio $client)
4444
$this->config = Collection::make($config);
4545
$this->client = $client;
4646

47-
$this->client->on('line', function ($line) {
48-
$this->message = $line;
47+
$this->client->on('data', function ($line) {
48+
$this->message = rtrim($line, "\r\n");
4949
});
5050
}
5151

@@ -114,7 +114,7 @@ public function isBot()
114114
*/
115115
public function types(IncomingMessage $matchingMessage)
116116
{
117-
$this->client->writeln(self::BOT_NAME.': ...');
117+
$this->client->write(self::BOT_NAME.': ...'.PHP_EOL);
118118
}
119119

120120
/**
@@ -163,11 +163,11 @@ public function buildServicePayload($message, $matchingMessage, $additionalParam
163163
public function sendPayload($payload)
164164
{
165165
$questionData = $payload['questionData'];
166-
$this->client->writeln(self::BOT_NAME.': '.$payload['text']);
166+
$this->client->write(self::BOT_NAME.': '.$payload['text'].PHP_EOL);
167167

168168
if (! is_null($questionData)) {
169169
foreach ($questionData['actions'] as $key => $action) {
170-
$this->client->writeln(($key + 1).') '.$action['text']);
170+
$this->client->write(($key + 1).') '.$action['text'].PHP_EOL);
171171
}
172172
$this->hasQuestion = true;
173173
$this->lastQuestions = $questionData['actions'];

0 commit comments

Comments
 (0)