public function sendMessage($message, $tts = false)
    {
        $deferred = new Deferred();

        $this->getPrivateChannel()->then(function ($channel) use ($message, $tts, $deferred) {
            $channel->sendMessage($message, $tts)->then(function ($response) use ($deferred) {
                $message = $this->factory->create(Message::class, $response, true);
                $deferred->resolve($message);
            }, \React\Partial\bind_right($this->reject, $deferred));
        }, \React\Partial\bind_right($this->reject, $deferred));

        return $deferred->promise();
    }
public function sendMessage($message, $tts = false)
    {
        $deferred = new Deferred();

        $this->getPrivateChannel()->then(function ($channel) use ($message, $tts, $deferred) {
            $channel->sendMessage($message, $tts)->then(function ($response) use ($deferred) {
                $message = $this->factory->create(Message::class, $response, true);
                $deferred->resolve($message);
            }, \React\Partial\bind_right($this->reject, $deferred));
        }, \React\Partial\bind_right($this->reject, $deferred));

        return $deferred->promise();
    }
public function sendMessage ( $ message , $ tts = false ) { $ deferred = new Deferred ( ) ; $ this -> getPrivateChannel ( ) -> then ( function ( $ channel ) use ( $ message , $ tts , $ deferred ) { $ channel -> sendMessage ( $ message , $ tts ) -> then ( function ( $ response ) use ( $ deferred ) { $ message = $ this -> factory -> create ( Message :: class , $ response , true ) ; $ deferred -> resolve ( $ message ) ; } , \ React \ Partial \ bind_right ( $ this -> reject , $ deferred ) ) ; } , \ React \ Partial \ bind_right ( $ this -> reject , $ deferred ) ) ; return $ deferred -> promise ( ) ; }
Sends a message to the user.

@param string $text The text to send in the message.
@param bool   $tts  Whether the message should be sent with text to speech enabled.

@return \React\Promise\Promise
Sends a message to the user .