【发布时间】:2021-04-07 17:53:50
【问题描述】:
所以,我有一个专为我的 Discord 服务器设计的 Call All Staff 系统,但我想要它,所以当一个用户使用它时,每个用户必须等待 30 分钟才能再次使用它。 这是我的代码:
var callallstaff = ['<@&791604815620603904>']
if (callallstaff.some(w => ` ${message.content.toLowerCase()} `.includes(` ${w} `))) {
var warn = new Discord.MessageEmbed()
.setTitle('Call All Staff')
.setDescription('Your about to mention all staff members of this server. \n \n **ONLY use for emergencies**, abusing this will result in a warn. \n \n Do you want to continue? Respond with \`yes`\ or \`no`\ ')
.setFooter(`Requested by ${message.author.tag}`)
.setColor('#ff0000')
message.channel.send(warn)
message.channel.awaitMessages(m => m.author.id == message.author.id, {max: 1, time: 30000}).then(collected => {
if (collected.first().content.toLowerCase() == 'yes') {
message.channel.send(`<@&757974725359042600> -Requested by ${message.author}`)
}
else {
message.channel.send('Canceled!')
}
}).catch(() => {
message.channel.send('Timed out!')
})
}
但是,我确实知道如何为一个用户设置冷却时间,以便只有该用户获得冷却时间,但我不确定如何设置它,所以所有用户都必须等待, 谢谢!
【问题讨论】:
标签: javascript discord discord.js