0

不久前我从 rethinkdb 切换到猫鼬,当然我已经重新编码了大部分内容。我不断收到这个错误的垃圾邮件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.
4

0 回答 0