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()
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.