Hello,
a few months ago I wrote my script "unused channel deleter", as I think a very useful one, at least for me.
But it´s written really bad, even I don´t know what I did there when I look at the code, when I try to add or fix something.
So, I have a major bug, for some reason, and completely random, it does delete channels from my datebase, I already tried to fix that months ago, sometimes this bug does not appear for some days, sometimes every few hours. I tried to fix this in so many ways, but could never find the real reason.
So I decided to rewrite the script, becouse many users want new cool features I also want to implement.
Howsoever, today I worked on a new function which should get all channels existing on the teamspeak, and filter the blacklisted ones, no problem so far. As I wanted, if I blacklisted some channels via webinterface, they didn´t occure in the output, if I didn´t blacklisted any channels, they occured... at least, some times, and some times, multiple times. And here is the problem!
I (also sometimes called Sherock) made some further tests. I used this simple code:
So as you can see, the code just gets all channels existing on the teamspeak right now (backend.getChannels()), creates an list (array) with all channel ids.
With the command !printDebug, I let the bot write this list into the log. and this is the output:

As you can see, the channel-id 44 sometimes occures, zero times, somethimes 2, 3 or 1 time/s. Completely random

Another example with th channel-id 128...
Iam not a 100% sure, but I guess this is/was the bug with my script. In the old version I tried to get all channels, and check if there is a channel in my datebas that does not even exist anymore on the teamspeak, and then delete it. So if the specific channel din´t occur in a list like the one above, my script just deleted it...
Iam not sure if I use the function wrong, if this is a "bug", only fixable by @flyth or maybe Iam just stupid. Howsoever, thanks for reading my story.
Have a great day, Greetings
Everlike
a few months ago I wrote my script "unused channel deleter", as I think a very useful one, at least for me.
But it´s written really bad, even I don´t know what I did there when I look at the code, when I try to add or fix something.
So, I have a major bug, for some reason, and completely random, it does delete channels from my datebase, I already tried to fix that months ago, sometimes this bug does not appear for some days, sometimes every few hours. I tried to fix this in so many ways, but could never find the real reason.
So I decided to rewrite the script, becouse many users want new cool features I also want to implement.
Howsoever, today I worked on a new function which should get all channels existing on the teamspeak, and filter the blacklisted ones, no problem so far. As I wanted, if I blacklisted some channels via webinterface, they didn´t occure in the output, if I didn´t blacklisted any channels, they occured... at least, some times, and some times, multiple times. And here is the problem!
I (also sometimes called Sherock) made some further tests. I used this simple code:
JavaScript:
event.on('chat', function(ev) {
if (ev.text.indexOf("!printDebug") >= 0) {
ev.client.chat("+");
engine.log(allChannelIds());
}
});
function allChannelIds() {
var allChannelIds = [];
for (i = 0; i < backend.getChannels().length; i++) {
allChannelIds.push(backend.getChannels()[i].id());
}
return allChannelIds;
}
So as you can see, the code just gets all channels existing on the teamspeak right now (backend.getChannels()), creates an list (array) with all channel ids.
With the command !printDebug, I let the bot write this list into the log. and this is the output:

As you can see, the channel-id 44 sometimes occures, zero times, somethimes 2, 3 or 1 time/s. Completely random

Another example with th channel-id 128...
Iam not a 100% sure, but I guess this is/was the bug with my script. In the old version I tried to get all channels, and check if there is a channel in my datebas that does not even exist anymore on the teamspeak, and then delete it. So if the specific channel din´t occur in a list like the one above, my script just deleted it...
Iam not sure if I use the function wrong, if this is a "bug", only fixable by @flyth or maybe Iam just stupid. Howsoever, thanks for reading my story.
Have a great day, Greetings
Everlike