我将如何对 [discord.js] 中的特定消息做出反应 [英] How would I react to a specific message in [discord.js]

查看:21
本文介绍了我将如何对 [discord.js] 中的特定消息做出反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的机器人对频道中的特定消息做出反应.这是我到目前为止的代码:

I'm trying to make my bot react to a specific message in a channel. This is the code I have so far:

message.fetch(`messageID`).then(message => {
  message.react(`emoji`);
});

推荐答案

要获取特定消息,您至少必须先获取它的频道:

To fetch a specific message you must at least fetch it's channel before :

message.client.channels.fetch("channelID").then(channel => {
    channel.messages.fetch("messageID").then(message => {
        message.react("emoji");
    }
}

这篇关于我将如何对 [discord.js] 中的特定消息做出反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆