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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

不和諧.js“通道”未定義錯誤消息

不和諧.js“通道”未定義錯誤消息

滄海一幻覺 2022-08-04 10:12:11
我最近對使用Javascript和node.js制作一個不和諧的機器人產(chǎn)生了興趣。我正在嘗試創(chuàng)建一個旋轉(zhuǎn)虛擬“彩票”的命令,并發(fā)送一條消息,告訴用戶他們是否收到了任何東西。(這是我的代碼:)`function lotteryCommand(arguments, receivedMessage){/*note: receivedMessage is defined as the command (for my bot, it's e!spin)   and arguments is the part following the command (for this particular bit of code,   it's merits, so the user sends "e!spin merits")*/    if (arguments == "merits"){        setTimeout(randomlottery1, 1000);    }    else{receivedMessage.channel.send("Message here")}    }這是另一個函數(shù)。這是它停止工作的地方  function randomlottery1(arguments, receivedMessage){    let respond;    let responses = [        //some random phrases here    ]    respond = responses[Math.floor(Math.random() * responses.length)]    receivedMessage.channel.send(respond)}由于某種原因我無法理解,它在第二次識別函數(shù)中無法識別,但它在代碼中較早地識別了命令。我在這里做錯了什么嗎?謝謝。channelreceivedMessage.channel.sendrandomlottery1
查看完整描述

1 回答

?
守候你守候我

TA貢獻1802條經(jīng)驗 獲得超10個贊

我認為你的問題是你沒有向你的函數(shù)傳遞任何參數(shù),你可以通過這樣做輕松修復(fù)它:


function lotteryCommand(arguments, receivedMessage){



/*note: receivedMessage is defined as the command (for my bot, it's e!spin) 

  and arguments is the part following the command (for this particular bit of code, 

  it's merits, so the user sends "e!spin merits")*/


    if (arguments == "merits"){

            // dont forget to pass in the required parameters while executing your function (parameter1, parameter2)

            setTimeout(randomlottery1(arguments, receivedMessage), 1000);

    }

    else{receivedMessage.channel.send("Message here")}

    }


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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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