我想用discord.js做一个awaitMessages,但是出现错误。这是我的代码:
message.channel.send('hello').then(msg => {
message.channel.awaitMessages(msg, {
max: 1,
time: 10000,
errors: ['time'] })
.then(collected => message.channel.send('this is a test'))
.catch(collected => msg.delete());
});
这是我的错误:
if (collect && this.filter(...args, this.collected)) {
^
TypeError: Function.prototype.apply was called on [object Object], which is a object and not a function
答案 0 :(得分:0)
awaitMessages
中的第一个参数是过滤器功能,而不是消息对象。
答案 1 :(得分:0)
您应该尝试类似的操作:
message.channel.send('hello').then(msg => {
message.channel.awaitMessages(m => m.author.id === msg.author.id, {
max: 1,
time: 10000,
errors: ['time'] })
.then(collected => message.channel.send('this is a test'))
.catch(collected => msg.delete());
});