Hello i have a issue im working on a lurk/ unlurk command with a list of current lurkers
the only problem is that when a viewers lurks it adds him/her to the lurkers list but when the unlurk it doesnt remove them from the list this also comes with the problem that the can not lurk again
here is also a screenshot and the code
(i used the Lurkers Variable in the lurkers command for debugging)
var lurkCount = 0;
var lurkers = [];
client.on(‘message’, (channel, tags, message, self) => {
if(self) return;
let theUser = tags.username;
if(message.toLowerCase() === ‘!lurk’) {
if ( lurkers.includes(theUser)) {
console.log(“lurking”);
console.log(lurkers)
} else {
client.say (channel, ${theUser} is watching on the back seat (Dont forget to use ( !back ) when you are back from lurking)
)
console.log(“not lurking”);
lurkers.push(${tags.username}
);
console.log(lurkers)
lurkCount = lurkers.length;
}
}
if(message.toLowerCase() === ‘!back’) {
if ( lurkers.includes(theUser)) {
let toRemove = lurkers.indexOf(theUser);
client.say(channel, ${theUser} is back in the front seat!
)
} else{
client.say(channel, ${theUser} was not even lurking
)
}
}
if(message.toLowerCase() === ‘!lurkers’) {
client.say(channel, ${lurkers} are currently lurking
);
};
});
thank you in advance