Discord. js - жду сообщений в текстовом канале - PullRequest
0 голосов
/ 01 мая 2020

Я хотел бы сделать сообщение с разногласиями. js, но у меня есть ошибка. Вот мой код:

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

Ответы [ 2 ]

0 голосов
/ 03 мая 2020

Вы должны попробовать что-то вроде:

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());
            });
0 голосов
/ 02 мая 2020

Первый параметр в awaitMessages - это функция фильтра, а не объект сообщения.

docs

...