typeerror:无法读取未定义的属性“logschannel”

tquggr8v  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(294)

不久前,我从RejectionDB切换到mongoose,当然,我已经对大部分内容进行了重新编码。我不断收到这个错误的垃圾邮件 TypeError: Cannot read property 'logsChannel' of undefined at Trinity.exports.handle (/home/ubuntu/Trinity/src/events/guildMemberAdd.js:5:22) 它对我的其他活动也有很多错误。

const Guild  = require('../db/models/Guild');

exports.handle = async function (guild, member) {   
    let logs = await Guild.findOne({ guildID: guild.id })
    if(logs.lchannel.logsChannel.enabled == false) return;
    this.bot.createMessage(logs.lchannel.logsChannel.channelID, {
        embed: {
            author: {
                name: `${member.username}#${member.discriminator}`,
                icon_url: member.avatarURL
            },
            color: 0x2196F3,
            timestamp: new Date(),
            fields: [
                {
                    name: "Member Joined",
                    value: `**${member.username}**has joined**${guild.name}**`
                }
            ]
        }
    }).catch(err => { });

that is my code.

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题