TypeError:无法读取未定义discord.js的属性“发送”

时间:2020-09-19 12:34:21

标签: discord.js

我有此代码:

msg.author.send(Finished);

它不起作用。完成的是一个常量变量,它是Discord.MessageEmbed。这个问题很烦人,我不知道该如何解决。任何帮助表示赞赏。 如果您想在此处查看大部分代码,则为:

client.on('message', msg => {

    if (msg.content === '-na') {
        if (msg.channel === Discord.DMChannel) {
            return
            } else
            if (msg.member.roles.cache.has('756713479003701338')) {
                msg.author.send(Ping);

                msg.author.dmChannel.awaitMessages(m => m.author.id === msg.author.id,
                    {max: 1, time: 300000}).then(collected => {
                            msg.author.send(Title);
                            EmbedPing = collected.first().content;

                            msg.author.dmChannel.awaitMessages(m => m.author.id === msg.author.id,
                                {max: 1, time: 300000}).then(collected => {
                                    msg.author.send(Message);
                                    EmbedTitle = collected.first().content;

                                    msg.author.dmChannel.awaitMessages(m => m.author.id === msg.author.id,
                                        {max: 1, time: 300000}).then(collected => {
                                            msg.author.send(Image);
                                            EmbedMessage = collected.first().content;
                                            
                                            msg.author.dmChannel.awaitMessages(m => m.author.id === msg.author.id,
                                                {max: 1, time: 300000}).then(collected => {
                                                    if (collected.first().content.toLowerCase() === 'yes') {
                                                        msg.author.send(ImageURL);
                                                        EmbedImage = collected.first().content;

                                                        var FinishedEmbedImage = new Discord.MessageEmbed()
                                                            .setColor('#FFD700')
                                                            .setTitle(EmbedTitle)
                                                            .setDescription(EmbedMessage)
                                                            .setImage(EmbedImage)
                                                            .setTimestamp()
                                                            .setFooter('Sent By: ' + msg.author)

                                                        allyAnnouncementChannel.send(EmbedPing, FinishedEmbed);

                                                    } else
                                                    msg.author.send(Finished);

                                                    var FinishedEmbed = new Discord.MessageEmbed()
                                                        .setColor('#FFD700')
                                                        .setTitle(EmbedTitle)
                                                        .setDescription(EmbedMessage)
                                                        .setTimestamp()
                                                        .setFooter('Sent By: ' + msg.author)

                                                    allyAnnouncementChannel.send(EmbedPing, FinishedEmbed);
                                                }).catch(Cancelled)
                                        }).catch(Cancelled)
                                }).catch(Cancelled)
                    }).catch(Cancelled)
        };
    };
});

Ping,标题,消息,图像,ImageURL和完成都是嵌入变量。 EmbedPing,EmbedTitle,EmbedMessage和EmbedImage都是空字符串变量。

const allyAnnouncementChannel = client.channels.cache.get('756701256122236941')

Discord显然是require函数。 客户是Discord.Client();。

0 个答案:

没有答案