function createWebhook(string $name, ?string $avatar = null, string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($name, $avatar, $reason) {
            if(!empty($avatar)) {
                $file = \CharlotteDunois\Yasmin\Utils\FileHelpers::resolveFileResolvable($avatar)->then(function ($avatar) {
                    return \CharlotteDunois\Yasmin\Utils\DataHelpers::makeBase64URI($avatar);
                });
            } else {
                $file = \React\Promise\resolve(null);
            }
            
            $file->done(function ($avatar = null) use ($name, $reason, $resolve, $reject) {
                $this->client->apimanager()->endpoints->webhook->createWebhook($this->id, $name, $avatar, $reason)->done(function ($data) use ($resolve) {
                    $hook = new \CharlotteDunois\Yasmin\Models\Webhook($this->client, $data);
                    $resolve($hook);
                }, $reject);
            }, $reject);
        }));
    }
function createWebhook(string $name, ?string $avatar = null, string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($name, $avatar, $reason) {
            if(!empty($avatar)) {
                $file = \CharlotteDunois\Yasmin\Utils\FileHelpers::resolveFileResolvable($avatar)->then(function ($avatar) {
                    return \CharlotteDunois\Yasmin\Utils\DataHelpers::makeBase64URI($avatar);
                });
            } else {
                $file = \React\Promise\resolve(null);
            }
            
            $file->done(function ($avatar = null) use ($name, $reason, $resolve, $reject) {
                $this->client->apimanager()->endpoints->webhook->createWebhook($this->id, $name, $avatar, $reason)->done(function ($data) use ($resolve) {
                    $hook = new \CharlotteDunois\Yasmin\Models\Webhook($this->client, $data);
                    $resolve($hook);
                }, $reject);
            }, $reject);
        }));
    }
function createWebhook ( string $ name , ? string $ avatar = null , string $ reason = '' ) { return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ name , $ avatar , $ reason ) { if ( ! empty ( $ avatar ) ) { $ file = \ CharlotteDunois \ Yasmin \ Utils \ FileHelpers :: resolveFileResolvable ( $ avatar ) -> then ( function ( $ avatar ) { return \ CharlotteDunois \ Yasmin \ Utils \ DataHelpers :: makeBase64URI ( $ avatar ) ; } ) ; } else { $ file = \ React \ Promise \ resolve ( null ) ; } $ file -> done ( function ( $ avatar = null ) use ( $ name , $ reason , $ resolve , $ reject ) { $ this -> client -> apimanager ( ) -> endpoints -> webhook -> createWebhook ( $ this -> id , $ name , $ avatar , $ reason ) -> done ( function ( $ data ) use ( $ resolve ) { $ hook = new \ CharlotteDunois \ Yasmin \ Models \ Webhook ( $ this -> client , $ data ) ; $ resolve ( $ hook ) ; } , $ reject ) ; } , $ reject ) ; } ) ) ; }
Create a webhook for the channel. Resolves with the new Webhook instance.
@param string       $name
@param string|null  $avatar  An URL or file path, or data.
@param string       $reason
@return \React\Promise\ExtendedPromiseInterface
@see \CharlotteDunois\Yasmin\Models\Webhook
Create a webhook for the channel . Resolves with the new Webhook instance .