为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

郎朗坤 2021-07-03 17:05:14
有没有办法在时间限制到期之前接收来自 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)            }        });(这一切都是为了全局性,因为它必须是递归的)我希望收集器在收到第一条消息时发出一个事件,但使用当前代码,它只能在时间限制之后执行。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 129 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信