Timer 定时器启动时如何执行命令
我最近一直在研究这段代码,我在这里发现: 我想知道,当计时器没有任何响应就关闭时,脚本是否可以运行命令 我已尝试将命令置于收集器的代码块之外 我试着把一个Timer 定时器启动时如何执行命令,timer,bots,discord,discord.js,Timer,Bots,Discord,Discord.js,我最近一直在研究这段代码,我在这里发现: 我想知道,当计时器没有任何响应就关闭时,脚本是否可以运行命令 我已尝试将命令置于收集器的代码块之外 我试着把一个if(timer>10000)放进去,但没用 if(命令=='spec'){ message.author.send(“查看或更改?”); const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{ 时间:100
if(timer>10000)
放进去,但没用
if(命令=='spec'){
message.author.send(“查看或更改?”);
const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{
时间:10000
});
console.log(收集器);
collector.on('collect',message=>{
如果(message.content==“请参阅”){
message.channel.send(“您想看到某人的规格确定!”);
}else if(message.content==“更改”){
message.channel.send(“您想更改规格,好吧!”);
}
});
}
当时间结束时,我希望脚本更改使用它的用户的昵称。您可以收听收集器的消息并检查收集的消息的大小
collector.on('end',collected=>{
如果(已收集。大小===0){
//做点什么
}
});
您可以收听收集器的声音,并检查所收集邮件的大小
collector.on('end',collected=>{
如果(已收集。大小===0){
//做点什么
}
});