function delete($timeout = 0, string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($timeout, $reason) {
            if($timeout > 0) {
                $this->client->addTimer($timeout, function () use ($reason, $resolve, $reject) {
                    $this->delete(0, $reason)->done($resolve, $reject);
                });
            } else {
                $this->client->apimanager()->endpoints->channel->deleteMessage($this->channel->getId(), $this->id, $reason)->done(function () use ($resolve) {
                    $resolve();
                }, $reject);
            }
        }));
    }
function delete($timeout = 0, string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($timeout, $reason) {
            if($timeout > 0) {
                $this->client->addTimer($timeout, function () use ($reason, $resolve, $reject) {
                    $this->delete(0, $reason)->done($resolve, $reject);
                });
            } else {
                $this->client->apimanager()->endpoints->channel->deleteMessage($this->channel->getId(), $this->id, $reason)->done(function () use ($resolve) {
                    $resolve();
                }, $reject);
            }
        }));
    }
function delete ( $ timeout = 0 , string $ reason = '' ) { return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ timeout , $ reason ) { if ( $ timeout > 0 ) { $ this -> client -> addTimer ( $ timeout , function ( ) use ( $ reason , $ resolve , $ reject ) { $ this -> delete ( 0 , $ reason ) -> done ( $ resolve , $ reject ) ; } ) ; } else { $ this -> client -> apimanager ( ) -> endpoints -> channel -> deleteMessage ( $ this -> channel -> getId ( ) , $ this -> id , $ reason ) -> done ( function ( ) use ( $ resolve ) { $ resolve ( ) ; } , $ reject ) ; } } ) ) ; }
Deletes the message.
@param float|int  $timeout  An integer or float as timeout in seconds, after which the message gets deleted.
@param string     $reason
@return \React\Promise\ExtendedPromiseInterface
Deletes the message .