【发布时间】:2020-07-30 05:01:58
【问题描述】:
有人知道为什么我的机器人不发送第二反应 (B) 并且当用户做出反应时他不发送消息吗?
client.on("guildMemberAdd", member => {
try {
member.send(`Hello ${member}, welcome to the PotatoHost Server!
I want to help you and so my question is: Do you want to buy a server or do you need more informations first? \n
A: I want to buy a server
B: I need more informations first \n
Please react to this message with A or B.`)
.then(function (message) {
message.react("????")
message.react("????")
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '????' || reaction.emoji.name == '????'),
{ max: 1 }).then(collected => {
if (collected.first().emoji.name == '????') {
message.reply('Ok, so you want to buy a server. Let me recommend you to visit <#699374469977735208>.');
client.destroy();
}
else
message.reply('Ok, so you need more informations first. Let me recommend you to visit <#699374469977735208>.');
})
});
}
catch (err) {
console.log(err)
}
})
错误:
(node:29428) UnhandledPromiseRejectionWarning: DiscordjsError: Request to use token, but token was unavailable to the client.
at RequestHandler.execute (C:\Users\nicos\OneDrive\Documents\Discord Bots\PotatoHost Bot\node_modules\discord.js\src\rest\RequestHandler.js:107:21)
【问题讨论】:
-
根据您的错误,您的机器人令牌不起作用
-
你有
client.login('your token')吗?
标签: javascript bots discord.js