function react($emoji) {
        try {
            $emoji = $this->client->emojis->resolve($emoji);
        } catch (\InvalidArgumentException $e) {
            if(\is_numeric($emoji)) {
                throw $e;
            }
            
            $match = (bool) \preg_match('/(?:<a?:)?(.+):(\d+)/', $emoji, $matches);
            if($match) {
                $emoji = $matches[1].':'.$matches[2];
            } else {
                $emoji = \rawurlencode($emoji);
            }
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($emoji) {
            if($emoji instanceof \CharlotteDunois\Yasmin\Models\Emoji) {
                $emoji = $emoji->identifier;
            }
            
            $filter = function (\CharlotteDunois\Yasmin\Models\MessageReaction $reaction, \CharlotteDunois\Yasmin\Models\User $user) use ($emoji) {
                return ($user->id === $this->client->user->id && $reaction->message->id === $this->id && $reaction->emoji->identifier === $emoji);
            };
            
            $prom = \CharlotteDunois\Yasmin\Utils\EventHelpers::waitForEvent($this->client, 'messageReactionAdd', $filter, array('time' => 30))->then(function ($args) use ($resolve) {
                $resolve($args[0]);
            }, function ($error) use ($reject) {
                if($error instanceof \RangeException) {
                    $reject(new \RangeException('Message Reaction did not arrive in time'));
                } elseif(!($error instanceof \OutOfBoundsException)) {
                    $reject($error);
                }
            });
            
            $this->client->apimanager()->endpoints->channel->createMessageReaction($this->channel->getId(), $this->id, $emoji)->done(null, function ($error) use ($prom, $reject) {
                $prom->cancel();
                $reject($error);
            });
        }));
    }
function react($emoji) {
        try {
            $emoji = $this->client->emojis->resolve($emoji);
        } catch (\InvalidArgumentException $e) {
            if(\is_numeric($emoji)) {
                throw $e;
            }
            
            $match = (bool) \preg_match('/(?:<a?:)?(.+):(\d+)/', $emoji, $matches);
            if($match) {
                $emoji = $matches[1].':'.$matches[2];
            } else {
                $emoji = \rawurlencode($emoji);
            }
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($emoji) {
            if($emoji instanceof \CharlotteDunois\Yasmin\Models\Emoji) {
                $emoji = $emoji->identifier;
            }
            
            $filter = function (\CharlotteDunois\Yasmin\Models\MessageReaction $reaction, \CharlotteDunois\Yasmin\Models\User $user) use ($emoji) {
                return ($user->id === $this->client->user->id && $reaction->message->id === $this->id && $reaction->emoji->identifier === $emoji);
            };
            
            $prom = \CharlotteDunois\Yasmin\Utils\EventHelpers::waitForEvent($this->client, 'messageReactionAdd', $filter, array('time' => 30))->then(function ($args) use ($resolve) {
                $resolve($args[0]);
            }, function ($error) use ($reject) {
                if($error instanceof \RangeException) {
                    $reject(new \RangeException('Message Reaction did not arrive in time'));
                } elseif(!($error instanceof \OutOfBoundsException)) {
                    $reject($error);
                }
            });
            
            $this->client->apimanager()->endpoints->channel->createMessageReaction($this->channel->getId(), $this->id, $emoji)->done(null, function ($error) use ($prom, $reject) {
                $prom->cancel();
                $reject($error);
            });
        }));
    }
function react ( $ emoji ) { try { $ emoji = $ this -> client -> emojis -> resolve ( $ emoji ) ; } catch ( \ InvalidArgumentException $ e ) { if ( \ is_numeric ( $ emoji ) ) { throw $ e ; } $ match = ( bool ) \ preg_match ( '/(?:<a?:)?(.+):(\d+)/' , $ emoji , $ matches ) ; if ( $ match ) { $ emoji = $ matches [ 1 ] . ':' . $ matches [ 2 ] ; } else { $ emoji = \ rawurlencode ( $ emoji ) ; } } return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ emoji ) { if ( $ emoji instanceof \ CharlotteDunois \ Yasmin \ Models \ Emoji ) { $ emoji = $ emoji -> identifier ; } $ filter = function ( \ CharlotteDunois \ Yasmin \ Models \ MessageReaction $ reaction , \ CharlotteDunois \ Yasmin \ Models \ User $ user ) use ( $ emoji ) { return ( $ user -> id === $ this -> client -> user -> id && $ reaction -> message -> id === $ this -> id && $ reaction -> emoji -> identifier === $ emoji ) ; } ; $ prom = \ CharlotteDunois \ Yasmin \ Utils \ EventHelpers :: waitForEvent ( $ this -> client , 'messageReactionAdd' , $ filter , array ( 'time' => 30 ) ) -> then ( function ( $ args ) use ( $ resolve ) { $ resolve ( $ args [ 0 ] ) ; } , function ( $ error ) use ( $ reject ) { if ( $ error instanceof \ RangeException ) { $ reject ( new \ RangeException ( 'Message Reaction did not arrive in time' ) ) ; } elseif ( ! ( $ error instanceof \ OutOfBoundsException ) ) { $ reject ( $ error ) ; } } ) ; $ this -> client -> apimanager ( ) -> endpoints -> channel -> createMessageReaction ( $ this -> channel -> getId ( ) , $ this -> id , $ emoji ) -> done ( null , function ( $ error ) use ( $ prom , $ reject ) { $ prom -> cancel ( ) ; $ reject ( $ error ) ; } ) ; } ) ) ; }
Reacts to the message with the specified unicode or custom emoji. Resolves with an instance of MessageReaction.
@param \CharlotteDunois\Yasmin\Models\Emoji|\CharlotteDunois\Yasmin\Models\MessageReaction|string  $emoji
@return \React\Promise\ExtendedPromiseInterface
@throws \InvalidArgumentException
@see \CharlotteDunois\Yasmin\Models\MessageReaction
Reacts to the message with the specified unicode or custom emoji . Resolves with an instance of MessageReaction .