function clone(string $name = null, bool $withPermissions = true, bool $withTopic = true, string $reason = '') {
        $data = array(
            'name' => (!empty($name) ? ((string) $name) : $this->name),
            'type' => \CharlotteDunois\Yasmin\Models\ChannelStorage::getTypeForChannel($this)
        );
        
        if($withPermissions) {
            $data['permission_overwrites'] = \array_values($this->permissionOverwrites->all());
        }
        
        if($withTopic) {
            $data['topic'] = $this->topic;
        }
        
        if($this->parentID) {
            $data['parent_id'] = $this->parentID;
        }
        
        if($this instanceof \CharlotteDunois\Yasmin\Interfaces\VoiceChannelInterface) {
            $data['bitrate'] = $this->bitrate;
            $data['user_limit'] = $this->userLimit;
        } else {
            $data['nsfw'] = $this->nsfw;
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($data, $reason) {
            $this->client->apimanager()->endpoints->guild->createGuildChannel($this->guild->id, $data, $reason)->done(function ($data) use ($resolve) {
                $channel = $this->guild->channels->factory($data, $this->guild);
                $resolve($channel);
            }, $reject);
        }));
    }
function clone(string $name = null, bool $withPermissions = true, bool $withTopic = true, string $reason = '') {
        $data = array(
            'name' => (!empty($name) ? ((string) $name) : $this->name),
            'type' => \CharlotteDunois\Yasmin\Models\ChannelStorage::getTypeForChannel($this)
        );
        
        if($withPermissions) {
            $data['permission_overwrites'] = \array_values($this->permissionOverwrites->all());
        }
        
        if($withTopic) {
            $data['topic'] = $this->topic;
        }
        
        if($this->parentID) {
            $data['parent_id'] = $this->parentID;
        }
        
        if($this instanceof \CharlotteDunois\Yasmin\Interfaces\VoiceChannelInterface) {
            $data['bitrate'] = $this->bitrate;
            $data['user_limit'] = $this->userLimit;
        } else {
            $data['nsfw'] = $this->nsfw;
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($data, $reason) {
            $this->client->apimanager()->endpoints->guild->createGuildChannel($this->guild->id, $data, $reason)->done(function ($data) use ($resolve) {
                $channel = $this->guild->channels->factory($data, $this->guild);
                $resolve($channel);
            }, $reject);
        }));
    }
function clone ( string $ name = null , bool $ withPermissions = true , bool $ withTopic = true , string $ reason = '' ) { $ data = array ( 'name' => ( ! empty ( $ name ) ? ( ( string ) $ name ) : $ this -> name ) , 'type' => \ CharlotteDunois \ Yasmin \ Models \ ChannelStorage :: getTypeForChannel ( $ this ) ) ; if ( $ withPermissions ) { $ data [ 'permission_overwrites' ] = \ array_values ( $ this -> permissionOverwrites -> all ( ) ) ; } if ( $ withTopic ) { $ data [ 'topic' ] = $ this -> topic ; } if ( $ this -> parentID ) { $ data [ 'parent_id' ] = $ this -> parentID ; } if ( $ this instanceof \ CharlotteDunois \ Yasmin \ Interfaces \ VoiceChannelInterface ) { $ data [ 'bitrate' ] = $ this -> bitrate ; $ data [ 'user_limit' ] = $ this -> userLimit ; } else { $ data [ 'nsfw' ] = $ this -> nsfw ; } return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ data , $ reason ) { $ this -> client -> apimanager ( ) -> endpoints -> guild -> createGuildChannel ( $ this -> guild -> id , $ data , $ reason ) -> done ( function ( $ data ) use ( $ resolve ) { $ channel = $ this -> guild -> channels -> factory ( $ data , $ this -> guild ) ; $ resolve ( $ channel ) ; } , $ reject ) ; } ) ) ; }
Clones a guild channel. Resolves with an instance of GuildChannelInterface.
@param string  $name             Optional name for the new channel, otherwise it has the name of this channel.
@param bool    $withPermissions  Whether to clone the channel with this channel's permission overwrites
@param bool    $withTopic        Whether to clone the channel with this channel's topic.
@param string  $reason
@return \React\Promise\ExtendedPromiseInterface
@see \CharlotteDunois\Yasmin\Interfaces\GuildChannelInterface
Clones a guild channel . Resolves with an instance of GuildChannelInterface .