[英]Is there a way to React to a Certain Message in discord.js Using Message IDs?
I'm aware of message.react();
我知道
message.react();
, but I can't seem to find anything that specifically reacts to a message using message IDs. ,但我似乎找不到任何对使用消息 ID 的消息做出具体反应的内容。 My code now reads as
我的代码现在读作
if(message.content.startsWith('$react')) {
let splicedMessage = message.content.slice(7);
let messageParts = splicedMessage.split(' ');
let pendingMessage = messageParts[0];
let pendingReaction = messageParts[1];
}
eg "$react (messageID) (reaction)".例如“$react (messageID) (reaction)”。 Is there any way that I can react to messageID (
pendingMessage
in the code) with the specified reaction?有什么方法可以让我对 messageID(代码中的
pendingMessage
)做出指定的反应?
First, you need to fetch the message , and then react to it.首先,您需要获取消息,然后对其做出反应。 I'm assuming that the message is in the channel that you're invoking the command in:
我假设消息位于您正在调用命令的通道中:
message.channel.fetchMessage(pendingMessage)
.then(msg => msg.react(pendingReaction));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.