Так что мой бот не отправляет сообщение, когда пользователь реагирует, даже если он должен, и затем появляются ошибки ... кстати, я добавил так много ошибок .catch в код из-за ошибки отклонения обещания
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.`)
.catch(err => console.log('err1'))
.then(function (message) {
message.react("?")
.catch(err => console.log(err));
message.react("?")
.catch(err => console.log(err));
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '?' || reaction.emoji.name == '?'),
{ max: 1})
.catch(err => console.log(err))
.then(collected => {
if (collected.first().emoji.name == '?') {
message.send('Ok, so you want to buy a server. Let me recommend you to visit <#699374469977735208>.')
.catch(err => console.log(err));
}
else
message.send('Ok, so you need more informations first. Let me recommend you to visit <#699374469977735208>.')
.catch(err => console.log(err));
})
});
}catch (err) {
console.log(err)
}
})
Вот ошибки, которые я не знаю, как исправить:
(node:31944) UnhandledPromiseRejectionWarning: TypeError: message.send is not a function
at C:\Users\nicos\OneDrive\Documents\Discord Bots\PotatoHost Bot\index.js:27:33
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:31944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:31944) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.