在discord.js中的时间限制之前获取收集的消息

有没有办法在时间限制到期之前接收来自 discord.js 收集器的消息?


我尝试使用collector.on收集,但它在我设置的时间限制后触发。


这是我目前拥有的:


this.collected = false

        this.collector = new Discord.MessageCollector(msg.channel, m => m.author.bot === false,{time: 10000});

        this.collector.on('collect', message =>{

            if(!this.collected){

                this.collected = true

                console.log(message)

                msg.channel.send(message.content)

                this.collector.stop()

               //Insert the same thing here(Copy+Paste the same code here)

            }

        });

(这一切都是为了全局性,因为它必须是递归的)


我希望收集器在收到第一条消息时发出一个事件,但使用当前代码,它只能在时间限制之后执行。


郎朗坤
浏览 130回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript