Discord.js 收集结束时的消息

Discord.js 收集结束时的消息,discord.js,Discord.js,我正在尝试为我的bot生成一个琐事命令,我想使它在显示“超时”的收集时间之后发送消息。 这是我到目前为止写的: const Discord=require(“Discord.js”) exports.run=async(客户端、消息、参数)=>{ const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{ 时间:10000 }); 数字=1; var random=

我正在尝试为我的bot生成一个琐事命令,我想使它在显示“超时”的收集时间之后发送消息。
这是我到目前为止写的:

const Discord=require(“Discord.js”)
exports.run=async(客户端、消息、参数)=>{
const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{
时间:10000
});
数字=1;
var random=Math.floor(Math.random()*(数字-1+1))+1;
开关(随机){
案例1:
{
message.channel.send(“案例1”);
collector.on('collect',message=>{
如果(message.content==“1”){
返回message.channel.send(“正确!”);
}否则{
message.channel.send(“错误!”);
}
});
collector.on('end',message=>{
message.channel.send(“时间到了!”)
});
}
}
};
当我这样做的时候,它表示发送未定义的结束事件

我在下面也尝试过这个,但没有任何效果:

const Discord=require(“Discord.js”)
exports.run=async(客户端、消息、参数)=>{
const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{
时间:10000
});
数字=1;
var random=Math.floor(Math.random()*(数字-1+1))+1;
开关(随机){
案例1:
{
message.channel.send(“案例1”);
collector.on('collect',message=>{
如果(message.content==“1”){
返回message.channel.send(“正确!”);
}否则{
message.channel.send(“错误!”);
}
});
收集器.stop('end',message=>{
message.channel.send(“时间到了!”);
});
}
}
};
我最后尝试的是这个,但我得到了。停止未定义:

const Discord=require(“Discord.js”)
exports.run=async(客户端、消息、参数)=>{
const collector=new Discord.MessageCollector(message.channel,m=>m.author.id==message.author.id{
时间:10000
});
数字=1;
var random=Math.floor(Math.random()*(数字-1+1))+1;
开关(随机){
案例1:
{
message.channel.send(“案例1”);
collector.on('collect',message=>{
如果(message.content==“1”){
返回message.channel.send(“正确!”);
}否则{
message.channel.send(“错误!”);
}
}).stop([“times up”]);
}
}
};
此外,我如何在“正确!”点之后停止采集?

尝试使用:

collector.on('end', (collected, reason) => {
          message.channel.send("times up!")
        });

如文档中所示:

请检查您的问题的答案,并将其中一个标记为已接受的答案,谢谢。