我正在尝试使Bot对特定用户发送的每条消息都使用自定义表情符号。
我的代码当前是:
if (msg.content.startsWith("")) {
msg.react(msg.guild.emojis.get("475766563719479296"))
}
即使我检查了所有内容,仍然出现此错误:
(node:13640) UnhandledPromiseRejectionWarning: TypeError: Emoji must be a string or Emoji/ReactionEmoji
at Message.react (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\discord.js\src\structures\Message.js:437:23)
at Client.client.on (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\index.js:40:17)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\Lars\Documents\Bots\Support Bot [Resanance]\node_modules\ws\lib\websocket.js:137:47)
我不知道有什么问题。 有人可以帮我吗?
编辑:
我确实尝试过msg.react("475766563719479296")
,但这只是错误未知的表情符号。
答案 0 :(得分:1)
尝试使用此代替:
const like = client.emojis.find(emoji => emoji.name === "like");
const dislike = client.emojis.find(emoji => emoji.name === "dislike");
message.react(like);
message.react(dislike);
答案 1 :(得分:0)
没关系,我复制了错误的ID