我試圖讓這個當有人類型!在消息,將與命令運行,並從消息採取的參數(%NAME%)familyfortunes%NAME%然後將其存儲在一個變量中。 !使用if語句在JS自定義參數
我以爲我可以使用if(message.toLowerCase.indexOf("!familyfortunes") !=-1){}
和存儲$消息到另一個變量,但拆分刪除familyfortunes所以只保留了用戶名,但是,保持返回錯誤:
greatbritishbg: !familyfortunes lol [10:53:39] error - TypeError: undefined is not a function at null. (example.js:68:29)
哪個是.split()
一部分。
client.addListener('chat', function (channel, user, message) {
console.log(user.username + ': ' + message);
if (message.toLowerCase() === '!familyfortunes') { //If message contains !familyfortunes
//var res = messageString.split("familyfortunes ");// Remove Family Fortunes to just get username
client.say(channel, 'Latest Follower: ' + Follower.response);
var raidName = Follower.response;
io.emit('follow', raidName);
}
}
有關如何解決這個問題的任何意見,將不勝感激。謝謝。
哎@msfoster感謝的是,一直在看文檔和琢磨了一會兒。關於param1和param2,我認爲它使用空格來區分不同的參數? (在繼續使用之前試圖充分理解) –
你是對的。我將添加更多描述。 – msfoster