• If you need help or want to discuss things, you now can also join us on our Discord Server!

Solved Nicht erwartete Rückgabe von Channel.position

Kamikaze

Donor
is awesome!
Contributor
Die Funktion Channel.position() gibt nicht die position des Channels aus.
Komme auch leider nicht dahinter nach welcher Logik die Position ermittelt wird.

Nutze Die Win64 Sinusbot Version: 1.0.0-alpha.5-9767656

JavaScript:
        function renameChannels(i) {
            var currentLobby = config.lobbyListener[i];
            var Channels = backend.getChannels();
            Channels.forEach(function(ch) {
                var parentChannel = ch.parent();
                if (parentChannel !== undefined) {
                    if (parentChannel.id() == currentLobby.channel) {
                        console.log("Channel: " ch.name())
                        console.log("ch.position: " + ch.position())
                        console.log("ch.id(): " + ch.id())
                        console.log("---")
                    }
                }
            });
        }
Log:
Code:
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ---
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.id(): 201
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.position: 199
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.name(): Second Channel
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ---
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.id(): 199
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.position: 0
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.name(): First Channel
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ---
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.id(): 200
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.position: 201
2019-06-10T10:26:25+02:00 [ bootstrap.js:1:949] ch.name(): Thrid Channel
EDIT:

First Channel
ch.id(): 199
ch.position: 0

Second Channel
ch.id(): 201
ch.position: 199

Third Channel
ch.id(): 200
ch.position: 201

Sieht so aus als würde sich die position immer auf die ChannelID des vorherigen Channels beziehen. Wodurch 0 dann der übergeordnete Channel ist.
 
Last edited:

Kamikaze

Donor
is awesome!
Contributor
refresh*
its important :(
For you in english:
It seems that "channel.position" doesnt return an order like "1, 2, 3" it return the channel.id of the channel above.
I need to figure out how to make like a sorting or something like this.

But as suggestion, would be nice if there would be something like "channel.orderId" which returns the order of channel "0, 1, 2 .."
 

flyth

is reticulating splines
Staff member
Developer
Contributor
That value comes straight from TeamSpeak itself, the bot doesn't do anything with it :)
 

Similar threads

Top