public function switchChannel(Channel $channel)
    {
        $deferred = new Deferred();

        if ($channel->type != Channel::TYPE_VOICE) {
            $deferred->reject(new \InvalidArgumentException('Channel must be a voice chnanel to be able to switch'));

            return $deferred->promise();
        }

        $this->mainSend([
            'op' => Op::OP_VOICE_STATE_UPDATE,
            'd'  => [
                'guild_id'   => $channel->guild_id,
                'channel_id' => $channel->id,
                'self_mute'  => $this->mute,
                'self_deaf'  => $this->deaf,
            ],
        ]);

        $this->channel = $channel;

        $deferred->resolve();

        return $deferred->promise();
    }
public function switchChannel(Channel $channel)
    {
        $deferred = new Deferred();

        if ($channel->type != Channel::TYPE_VOICE) {
            $deferred->reject(new \InvalidArgumentException('Channel must be a voice chnanel to be able to switch'));

            return $deferred->promise();
        }

        $this->mainSend([
            'op' => Op::OP_VOICE_STATE_UPDATE,
            'd'  => [
                'guild_id'   => $channel->guild_id,
                'channel_id' => $channel->id,
                'self_mute'  => $this->mute,
                'self_deaf'  => $this->deaf,
            ],
        ]);

        $this->channel = $channel;

        $deferred->resolve();

        return $deferred->promise();
    }
public function switchChannel ( Channel $ channel ) { $ deferred = new Deferred ( ) ; if ( $ channel -> type != Channel :: TYPE_VOICE ) { $ deferred -> reject ( new \ InvalidArgumentException ( 'Channel must be a voice chnanel to be able to switch' ) ) ; return $ deferred -> promise ( ) ; } $ this -> mainSend ( [ 'op' => Op :: OP_VOICE_STATE_UPDATE , 'd' => [ 'guild_id' => $ channel -> guild_id , 'channel_id' => $ channel -> id , 'self_mute' => $ this -> mute , 'self_deaf' => $ this -> deaf , ] , ] ) ; $ this -> channel = $ channel ; $ deferred -> resolve ( ) ; return $ deferred -> promise ( ) ; }
Switches voice channels.

@param Channel $channel The channel to switch to.

@return \React\Promise\Promise
Switches voice channels .