无法读取反应上未定义的属性“表情符号”-即使进行了反应但无法收集

时间:2020-10-28 11:40:31

标签: node.js discord discord.js

无法读取反应中未定义的'表情符号'属性-即使进行了反应但无法收集。

它可以正常嵌入和反应,但从不通过DM收集反应

Collection [Map] {}
TypeError: Cannot read property 'emoji' of undefined
    at E:\New Project - 2020\SocialMisty\lib\Handlers\ToSAgreementHandler.js:30:38
msg.author.send(embed).then(async function (message) {
        message.react('✅').then(r => {
            message.react('❎');
        });
        message.awaitReactions((reaction, user) => user.id == who.author.id && (reaction.emoji.name == '✅' || reaction.emoji.name == '❎'),
            {
                max: 1,
                time: 30000
            }).then(collected => {
                console.log(collected)
                if (collected.first().emoji.name == '✅') {
                    message.channel.send(`${message.author}, Thanks`).then((m) => m.delete({ timeout: 10000 }));
                    message.delete();
                } else {
                    message.channel.send(`${message.author}, You **MUST** agree to the ToS.`).then((m) => m.delete({ timeout: 10000 }));
                    message.delete();
                }
            }).catch((e) => {
                console.log(e) // gets emoji error here.
                message.channel.send(`${message.author}, Please type in here again to recieve the ToS again.`).then((m) => m.delete({ timeout: 10000 }));
                message.delete();
            });
    }).catch((e) => {
        console.log(e) // doesn't get the error here
        this.postToRelayChannel(client, message.author, where);
});

0 个答案:

没有答案