I'm making a verification system that if you send a message.
(我正在建立一个验证系统,如果您发送消息。)
In a different channel, an embed shows up with 2 emoji's: 1 to accept, and 1 to deny.(在不同的频道中,嵌入会显示2种表情符号:1表示接受,1表示拒绝。)
The .awaitReaction has to be triggered by a different user then the author.(.awaitReaction必须由不同于作者的其他用户触发。)
But when I change the filter.(但是当我更换过滤器时。)
It triggers the message if the bot reacts to it.(如果机器人对此作出反应,它将触发该消息。)
How can I fix this?(我怎样才能解决这个问题?)
Here is my code:
(这是我的代码:)
let register = args.join(" ").slice(7)
const filter = (reaction, user) => ["?", "?"].includes(reaction.emoji.name) && !bot.user;
let test = new Discord.RichEmbed()
.addField("User:", message.author.username && message.author.tag, true)
.addField("Requested nickname:", register)
.setColor("#ed0c75")
.setImage(message.author.displayAvatarURL)
let acceptordeny = message.guild.channels.find(`name`, "accept-or-deny");
if(!acceptordeny) return message.channel.send("Can't find accept or deny channel.");
acceptordeny.send(test).then(async message => {
await message.react("?")
await message.react("?")
message.awaitReactions(filter, {
max: 1,
time: 60000,
errors: ["time"]
}).then(collected => {
const reaction = collected.first();
switch (reaction.emoji.name) {
case "?":
console.log("Accepted")
break;
case '?':
console.log("Denied")
break;
}
}).catch(collected => {
return acceptordeny.send("Failed")
})
})
Hope someone can help me with this.
(希望有人可以帮助我。)
ask by Kieran Julien translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…