第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

獲取功能|內(nèi)服務(wù)器的所有成員未定義|的特性成員包裝:不和諧贈(zèng)品

獲取功能|內(nèi)服務(wù)器的所有成員未定義|的特性成員包裝:不和諧贈(zèng)品

不負(fù)相思意 2022-08-18 15:49:14
所以我正在使用包“不和諧 - 贈(zèng)品”,我想使用“豁免會(huì)員”選項(xiàng),這是一個(gè)功能,我可以設(shè)置誰不允許參加贈(zèng)品,我希望沒有加入特定服務(wù)器的人不能參加,但我不確定編碼是否正確,并且還有錯(cuò)誤: 我真的不知道要修復(fù),所以如果有人能告訴我我做錯(cuò)了什么就好了。TypeError: Cannot read property 'members' of undefinedvar server = require('./commands/giveaway/start-giveaway.js')let guild = client.guilds.cache.get(server)// Init discord giveawaysconst { GiveawaysManager } = require('discord-giveaways');client.giveawaysManager = new GiveawaysManager(client, {    storage: "./giveaways.json",    updateCountdownEvery: 5000,    default: {        botsCanWin: false,        embedColor: "0x0099ff",        embedColorEnd: "ff0000",        reaction: "??",        exemptMembers: !guild.members.fetch()    }});如果函數(shù)返回 true,則該成員不應(yīng)參與贈(zèng)品:exemptMembers: !guild.members.fetch()請(qǐng)不要把我烤得很硬,如果我完全做錯(cuò)了??。
查看完整描述

1 回答

?
精慕HU

TA貢獻(xiàn)1845條經(jīng)驗(yàn) 獲得超8個(gè)贊

問題是,當(dāng)您在第一個(gè)代碼示例中需要它時(shí),文件將不會(huì)返回任何服務(wù)器 ID。所以將永遠(yuǎn)是.start-giveaway.jslet guild = client.guilds.cache.get(server)undefined

通過查看不和諧贈(zèng)品文檔,您可以發(fā)現(xiàn)在開始贈(zèng)品的選項(xiàng)中,您可以再次定義屬性,因此這是您應(yīng)該做的:exemptMembers

首先,從贈(zèng)品管理器中刪除該屬性。然后,修改如下文件。exemptMembersstart-giveaway.js

警告 - 2020 年 5 月 19 日

豁免成員屬性現(xiàn)在可能無法正常工作,目前在不和諧贈(zèng)品GitHub中打開了一個(gè)問題

run : async (message, client, args) => {

    const ms = require('ms');


    // Giveaway channel

    let giveawayChannel = message.mentions.channels.first();

    // If no channel is mentionned

    if(!giveawayChannel){

        return message.channel.send(':x: You have to mention a valid channel!');

    }


    // Giveaway duration

    let giveawayDuration = args[1];

    // If the duration isn't valid

    if(!giveawayDuration || isNaN(ms(giveawayDuration))){

        return message.channel.send(':x: You have to specify a valid duration!');

    }


    // Number of winners

    let giveawayNumberWinners = args[2];

    // If the specified number of winners is not a number

    if(isNaN(giveawayNumberWinners)){

        return message.channel.send(':x: You have to specify a valid number of winners!');

    }


    // Giveaway prize

    let giveawayPrize = args.slice(4).join(' ');

    // If no prize is specified

    if(!giveawayPrize){

        return message.channel.send(':x: You have to specify a valid prize!');

    }


    // Options for the giveaway

    let giveawayStartOptions = {

        // The giveaway duration

        time: ms(giveawayDuration),

        // The giveaway prize

        prize: giveawayPrize,

        // The giveaway winner count

        winnerCount: giveawayNumberWinners,

        // Who hosts this giveaway

        hostedBy: true ? message.author : null,

        // Messages

        messages: {

            giveaway: "???? **GIVEAWAY** ????",

            giveawayEnded: "???? **GIVEAWAY ENDED** ????",

            timeRemaining: "Time remaining: **{duration}**!",

            inviteToParticipate: "React with ?? to participate!",

            winMessage: "Congratulations, {winners}! You won **{prize}**!",

            embedFooter: "Giveaways",

            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",

                weeks: "weeks",

                months: "months",

                pluralS: false // Not needed, because units end with a S so it will automatically removed if the unit value is lower than 2

            } 

        }

    }


    // Require members to join a server if author does not say "no"

    if (args[3] !== 'no'){

        let server = args[3];

        console.log(server);


        if(!server){

            return message.channel.send(':x: You habe to specify a valid server ID or say "no"');

        } else {

            client.guilds.cache.get(server).members.fetch().then(otherServerMembers => {

                // Who will be excluded from this giveaway if members have to join a specific server

                giveawayStartOptions.exemptMembers = (member) => !otherServerMembers.has(member.id)

            })

        }

    }

    else {

        console.log('User sayed no');

    }


    // Start the giveaway

    client.giveawaysManager.start(giveawayChannel, giveawayStartOptions);

    message.channel.send(`Giveaway started in ${giveawayChannel}!`);


}

像這樣,只有當(dāng)作者給出服務(wù)器ID時(shí)才會(huì)定義。exemptMembers


查看完整回答
反對(duì) 回復(fù) 2022-08-18
  • 1 回答
  • 0 關(guān)注
  • 166 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)