[英]How do I add a reaction to a specific message?
I would like the bot to react to a message that i have defined (in this case, the ID message "708780848853286962") but when i try to do that an error happens on the console, how do i proceed?我希望机器人对我定义的消息做出反应(在这种情况下,ID 消息“708780848853286962”)但是当我尝试这样做时,控制台上发生错误,我该如何继续?
How am i doing:我好吗:
let msg = '708780848853286962'
msg.react('👆')
Console error:控制台错误:
TypeError: msg.react is not a function
You need to fetch that message first, as far as discord.js is concerned with your current code, you're just doing '708780848853286962'.react('')
.您需要先获取该消息,就 discord.js 关注您当前的代码而言,您只是在执行'708780848853286962'.react('')
。
You also need to know what channel the message is in.您还需要知道消息在哪个频道中。
const msg = client.channels.cache.get(CHANNEL_ID).messages.fetch('708780848853286962')
msg.react('👆')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.