Skip to content

Commit

Permalink
fix(MessageManager): do not use client.emojis (#7039)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Nov 29, 2021
1 parent 0193efa commit fd63139
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/managers/MessageManager.js
Expand Up @@ -5,6 +5,7 @@ const CachedManager = require('./CachedManager');
const { TypeError } = require('../errors');
const Message = require('../structures/Message');
const MessagePayload = require('../structures/MessagePayload');
const Util = require('../util/Util');

/**
* Manages API methods for Messages and holds their cache.
Expand Down Expand Up @@ -186,11 +187,15 @@ class MessageManager extends CachedManager {
message = this.resolveId(message);
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');

emoji = this.client.emojis.resolveIdentifier(emoji);
emoji = Util.resolvePartialEmoji(emoji);
if (!emoji) throw new TypeError('EMOJI_TYPE', 'emoji', 'EmojiIdentifierResolvable');

const emojiId = emoji.id
? `${emoji.animated ? 'a:' : ''}${emoji.name}:${emoji.id}`
: encodeURIComponent(emoji.name);

// eslint-disable-next-line newline-per-chained-call
await this.client.api.channels(this.channel.id).messages(message).reactions(emoji, '@me').put();
await this.client.api.channels(this.channel.id).messages(message).reactions(emojiId, '@me').put();
}

/**
Expand Down

0 comments on commit fd63139

Please sign in to comment.