我希望僵尸程序无法再次反应,当我单击该僵尸程序将发送消息的反应时,问题在于该僵尸程序始终会做出反应
async function emojiMessage(message, validReactions) {
for (const reaction of validReactions) await message.react(reaction);
const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && (!user.bot)
return message
.awaitReactions(filter, {
max: 1,
time: 10000
})
.then(collected => collected.first() && collected.first().emoji.name);
}async function deleteMessage(message) {
const emoji = await emojiMessage(message, ["❌","✅"]);
console.log(emoji)
// if the emoji is a tick:
if (emoji === "✅") {
// delete their message
console.log("tick")
if (message.deletable == true) {
console.log("can delete")
console.log("attempting to delete")
message.delete()
message.channel.send("Baik, Kami akan Mengganti Nickname Anda.")
}
if (!message.deletable == false) {
"cannot delete"
}
} else if (emoji === "❌") { // if the emoji is a cross
message.channel.send("Maaf Kami Tidak Bisa Mengubah Nickname Anda.")
return;
}
}
music.on('message', message => {
if (message.channel.id === emojiChannelID) {
// runs the function
deleteMessage(message)
}
})