function overwritePermissions($memberOrRole, $allow, $deny = 0, string $reason = '') {
        [ $memberOrRole, $options ] = $this->validateOverwritePermissions($memberOrRole, $allow, $deny);
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($memberOrRole, $options, $reason) {
            $this->client->apimanager()->endpoints->channel->editChannelPermissions($this->id, $memberOrRole, $options, $reason)->done(function () use ($memberOrRole, $options, $resolve, $reject) {
                $options['id'] = $memberOrRole;
                
                if($options['type'] === 'member') {
                    $fetch = $this->guild->fetchMember($options['id']);
                } else {
                    $fetch = \React\Promise\resolve();
                }
                
                $fetch->done(function () use ($options, $resolve) {
                    if($options['allow'] instanceof \CharlotteDunois\Yasmin\Models\Permissions) {
                        $options['allow'] = $options['allow']->bitfield;
                    }
                    
                    if($options['deny'] instanceof \CharlotteDunois\Yasmin\Models\Permissions) {
                        $options['deny'] = $options['deny']->bitfield;
                    }
                    
                    $overwrite = new \CharlotteDunois\Yasmin\Models\PermissionOverwrite($this->client, $this, $options);
                    $this->permissionOverwrites->set($overwrite->id, $overwrite);
                    
                    $resolve($overwrite);
                }, $reject);
            }, $reject);
        }));
    }
function overwritePermissions($memberOrRole, $allow, $deny = 0, string $reason = '') {
        [ $memberOrRole, $options ] = $this->validateOverwritePermissions($memberOrRole, $allow, $deny);
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($memberOrRole, $options, $reason) {
            $this->client->apimanager()->endpoints->channel->editChannelPermissions($this->id, $memberOrRole, $options, $reason)->done(function () use ($memberOrRole, $options, $resolve, $reject) {
                $options['id'] = $memberOrRole;
                
                if($options['type'] === 'member') {
                    $fetch = $this->guild->fetchMember($options['id']);
                } else {
                    $fetch = \React\Promise\resolve();
                }
                
                $fetch->done(function () use ($options, $resolve) {
                    if($options['allow'] instanceof \CharlotteDunois\Yasmin\Models\Permissions) {
                        $options['allow'] = $options['allow']->bitfield;
                    }
                    
                    if($options['deny'] instanceof \CharlotteDunois\Yasmin\Models\Permissions) {
                        $options['deny'] = $options['deny']->bitfield;
                    }
                    
                    $overwrite = new \CharlotteDunois\Yasmin\Models\PermissionOverwrite($this->client, $this, $options);
                    $this->permissionOverwrites->set($overwrite->id, $overwrite);
                    
                    $resolve($overwrite);
                }, $reject);
            }, $reject);
        }));
    }
function overwritePermissions ( $ memberOrRole , $ allow , $ deny = 0 , string $ reason = '' ) { [ $ memberOrRole , $ options ] = $ this -> validateOverwritePermissions ( $ memberOrRole , $ allow , $ deny ) ; return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ memberOrRole , $ options , $ reason ) { $ this -> client -> apimanager ( ) -> endpoints -> channel -> editChannelPermissions ( $ this -> id , $ memberOrRole , $ options , $ reason ) -> done ( function ( ) use ( $ memberOrRole , $ options , $ resolve , $ reject ) { $ options [ 'id' ] = $ memberOrRole ; if ( $ options [ 'type' ] === 'member' ) { $ fetch = $ this -> guild -> fetchMember ( $ options [ 'id' ] ) ; } else { $ fetch = \ React \ Promise \ resolve ( ) ; } $ fetch -> done ( function ( ) use ( $ options , $ resolve ) { if ( $ options [ 'allow' ] instanceof \ CharlotteDunois \ Yasmin \ Models \ Permissions ) { $ options [ 'allow' ] = $ options [ 'allow' ] -> bitfield ; } if ( $ options [ 'deny' ] instanceof \ CharlotteDunois \ Yasmin \ Models \ Permissions ) { $ options [ 'deny' ] = $ options [ 'deny' ] -> bitfield ; } $ overwrite = new \ CharlotteDunois \ Yasmin \ Models \ PermissionOverwrite ( $ this -> client , $ this , $ options ) ; $ this -> permissionOverwrites -> set ( $ overwrite -> id , $ overwrite ) ; $ resolve ( $ overwrite ) ; } , $ reject ) ; } , $ reject ) ; } ) ) ; }
Overwrites the permissions for a member or role in this channel. Resolves with an instance of PermissionOverwrite.
@param \CharlotteDunois\Yasmin\Models\GuildMember|\CharlotteDunois\Yasmin\Models\Role|string  $memberOrRole  The member or role.
@param \CharlotteDunois\Yasmin\Models\Permissions|int                                         $allow         Which permissions should be allowed?
@param \CharlotteDunois\Yasmin\Models\Permissions|int                                         $deny          Which permissions should be denied?
@param string                                                                                 $reason        The reason for this.
@return \React\Promise\ExtendedPromiseInterface
@throws \InvalidArgumentException
@see \CharlotteDunois\Yasmin\Models\PermissionOverwrite
Overwrites the permissions for a member or role in this channel . Resolves with an instance of PermissionOverwrite .