data.push 抽搐机器人不工作
data.push is not working twitch bot
function lfg(user){
WTPLength = viewersWTP.length;
if (WTPLength !== 0) {
viewersWTP = viewersWTP - 1
while(WTPLength !== -1){
if(user === viewersWTP[WTPLength]){
console.log("Already in list")
client.action("kong_plays",user+" you cannot execute this command again until kong pulls a viewer to play with him!")
fil = True;
}else{
WTPLength = WTPLength - 1;
}
}if (fil !== true){
viewersWTP.push(user);
console.log("Added into list")
client.action("kong_plays",viewersWTP)
}
}else{ //here
viewersWTP.push(user);
console.log(viewersWTP)
client.action("kong_plays","1"+viewersWTP)
}
}
如果我 运行 代码两次,第一次 while 之外的 else 中的代码(它说//这里)工作但是第二次控制台输出这个:viewersWTP.push is not a function
提前致谢
viewersWTP = viewersWTP - 1
应该做什么?这可能是将数组转换为 NaN
。您的意思是 WTPLength = WTPLength - 1
吗?
var a = [1, 2, 3];
console.log(a);
a = a - 1;
console.log(a);
function lfg(user){
WTPLength = viewersWTP.length;
if (WTPLength !== 0) {
viewersWTP = viewersWTP - 1
while(WTPLength !== -1){
if(user === viewersWTP[WTPLength]){
console.log("Already in list")
client.action("kong_plays",user+" you cannot execute this command again until kong pulls a viewer to play with him!")
fil = True;
}else{
WTPLength = WTPLength - 1;
}
}if (fil !== true){
viewersWTP.push(user);
console.log("Added into list")
client.action("kong_plays",viewersWTP)
}
}else{ //here
viewersWTP.push(user);
console.log(viewersWTP)
client.action("kong_plays","1"+viewersWTP)
}
}
如果我 运行 代码两次,第一次 while 之外的 else 中的代码(它说//这里)工作但是第二次控制台输出这个:viewersWTP.push is not a function
提前致谢
viewersWTP = viewersWTP - 1
应该做什么?这可能是将数组转换为 NaN
。您的意思是 WTPLength = WTPLength - 1
吗?
var a = [1, 2, 3];
console.log(a);
a = a - 1;
console.log(a);