不和谐赠品| TypeError:无法读取未定义的属性“开始”

Posted

技术标签:

【中文标题】不和谐赠品| TypeError:无法读取未定义的属性“开始”【英文标题】:discord-giveaways | TypeError: Cannot read property 'start' of undefined 【发布时间】:2021-04-29 20:58:02 【问题描述】:

Giveaway.js

我收到此错误,我不知道如何修复它,但教程使用相同的东西并且没有收到此错误。:

“无法读取未定义的属性'start'”

   client.giveawaysManager.start(giveawayChannel, 
            // The giveaway duration
            time: ms(giveawayDuration),
            // The giveaway prize
            prize: giveawayPrize,
            // The giveaway winner count
            winnerCount: giveawayNumberWinners,
            // Who hosts this giveaway
            hostedBy: client.config.hostedBy ? message.author : null,
            // Messages
            messages: 
                giveaway: (client.config.everyoneMention ? "@everyone\n\n" : "")+ client.config.giveawayEmoji + "**GIVEAWAY**" + client.config.giveawayEmoji,
                giveawayEnded: (client.config.everyoneMention ? "@everyone\n\n" : "")+ client.config.giveawayEmoji + "**GIVEAWAY ENDED**" + client.config.giveawayEmoji,
                timeRemaining: "Time remaining: **duration**!",
                inviteToParticipate: "React with " + client.config.giveawayEmoji + " to participate!",
                winMessage: client.config.giveawayEmoji + " winners won **prize**!",
                embedFooter: client.config.botName,
                noWinner: "Giveaway cancelled, no valid participations.",
                hostedBy: "Hosted by: user",
                winners: "winner(s)",
                endedAt: "Ended at",
                units: 
                    seconds: "seconds",
                    minutes: "minutes",
                    hours: "hours",
                    days: "days",
                    pluralS: false // Not needed, because units end with a S so it will automatically removed if the unit value is lower than 2
                
            
        );

这是错误行:

client.giveawaysManager.start(giveawayChannel, 

【问题讨论】:

【参考方案1】:

在 index.js 中:

const  GiveawaysManager  = require('discord-giveaways')

client.giveaways = new GiveawaysManager(client, 
        storage : './giveaways.json',
        updateCoundownEvery: 5000,
        embedColor: '#ff0000',
        reaction: '?'
)

在 giveaways.json 中:

[]

【讨论】:

以上是关于不和谐赠品| TypeError:无法读取未定义的属性“开始”的主要内容,如果未能解决你的问题,请参考以下文章

不和谐.js | TypeError:无法读取未定义的属性“0”

TypeError:尝试制作不和谐机器人时无法读取未定义的属性“id”

TypeError:无法读取未定义的不和谐机器人 js 说命令的属性“加入”

Discord.js 在尝试将游戏消息转换为不和谐消息时给我留下“TypeError:无法读取未定义的属性 'includes'”

TypeError:每当我在不和谐的情况下向我的机器人输入 PM 时,都无法读取未定义的属性“id”

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