public function unpinMessage(Message $message)
    {
        $deferred = new Deferred();

        if (! $message->pinned) {
            return \React\Promise\reject(new \Exception('This message is not pinned.'));
        }

        if ($message->channel_id != $this->id) {
            return \React\Promise\reject(new \Exception('You cannot un-pin a message from a different channel.'));
        }

        $this->http->delete("channels/{$this->id}/pins/{$message->id}")->then(
            function () use (&$message, $deferred) {
                $message->pinned = false;
                $deferred->resolve($message);
            },
            \React\Partial\bind_right($this->reject, $deferred)
        );

        return $deferred->promise();
    }
public function unpinMessage(Message $message)
    {
        $deferred = new Deferred();

        if (! $message->pinned) {
            return \React\Promise\reject(new \Exception('This message is not pinned.'));
        }

        if ($message->channel_id != $this->id) {
            return \React\Promise\reject(new \Exception('You cannot un-pin a message from a different channel.'));
        }

        $this->http->delete("channels/{$this->id}/pins/{$message->id}")->then(
            function () use (&$message, $deferred) {
                $message->pinned = false;
                $deferred->resolve($message);
            },
            \React\Partial\bind_right($this->reject, $deferred)
        );

        return $deferred->promise();
    }
public function unpinMessage ( Message $ message ) { $ deferred = new Deferred ( ) ; if ( ! $ message -> pinned ) { return \ React \ Promise \ reject ( new \ Exception ( 'This message is not pinned.' ) ) ; } if ( $ message -> channel_id != $ this -> id ) { return \ React \ Promise \ reject ( new \ Exception ( 'You cannot un-pin a message from a different channel.' ) ) ; } $ this -> http -> delete ( "channels/{$this->id}/pins/{$message->id}" ) -> then ( function ( ) use ( & $ message , $ deferred ) { $ message -> pinned = false ; $ deferred -> resolve ( $ message ) ; } , \ React \ Partial \ bind_right ( $ this -> reject , $ deferred ) ) ; return $ deferred -> promise ( ) ; }
Removes a message from the channels pinboard.

@param Message $message The message to un-pin.

@return \React\Promise\Promise
Removes a message from the channels pinboard .