[英]How can you close an open message collector with discord.js
I am making a discord bot and I want to end an open message collector我正在制作一个不和谐的机器人,我想结束一个开放的消息收集器
Here is the code I have这是我的代码
const collector = new discord.MessageCollector(message.channel, m => m.author.id === message.author.id)
collector.on('collect', msg => {
// here is where I want it to close
msg.reply("You win!")
})
To stop a message collector from collecting messages simply use MessageCollector.stop()
要停止消息收集器收集消息,只需使用
MessageCollector.stop()
Your code will look something like this :您的代码将如下所示:
const collector = new discord.MessageCollector(message.channel, m => m.author.id === message.author.id)
collector.on('collect', msg => {
collector.stop()
msg.reply("You win!")
})
This is something really simple to find, I just googled it and found it easily这真的很容易找到,我只是在谷歌上搜索并很容易找到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.