fix(MessageManager): do not use client.emojis (#7039)

This commit is contained in:
Antonio Román
2021-11-29 11:19:32 +01:00
committed by GitHub
parent 0193efae71
commit fd63139b41

View File

@@ -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.
@@ -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();
}
/**