mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
fix(MessageManager): do not use client.emojis (#7039)
This commit is contained in:
@@ -5,6 +5,7 @@ const CachedManager = require('./CachedManager');
|
|||||||
const { TypeError } = require('../errors');
|
const { TypeError } = require('../errors');
|
||||||
const Message = require('../structures/Message');
|
const Message = require('../structures/Message');
|
||||||
const MessagePayload = require('../structures/MessagePayload');
|
const MessagePayload = require('../structures/MessagePayload');
|
||||||
|
const Util = require('../util/Util');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages API methods for Messages and holds their cache.
|
* Manages API methods for Messages and holds their cache.
|
||||||
@@ -186,11 +187,15 @@ class MessageManager extends CachedManager {
|
|||||||
message = this.resolveId(message);
|
message = this.resolveId(message);
|
||||||
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
|
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');
|
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
|
// 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user