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

channel creation parent channel not applied after update

essem

Member
Just updated to 1.0.0-beta.1 and encountered a problem with the channel creation now: the channel got created but below the whole channeltree, previously it was created as a subchannel while using this code:

JavaScript:
//...
                var currentchannel = client.getChannels()[0];
                if(currentchannel == undefined) return;
                if(client == undefined) return;
                var channelparams = {};
                channelparams.name = ""+client.name()+"'s channel";
                channelparams.parent = currentchannel;
                channelparams.semiPermanent = true;
                channelparams.encrypted = true;
                channelparams.codec = 4;
                channelparams.codecQuality = 6;
                channelparams.maxClients = -1;
                channelparams.permanent = false;

                var channel = backend.createChannel(channelparams);
                if(channel == undefined) {
                    engine.log("Could not create private channel for some reason.");
                    return;
                }
//...
if anyone can confirm this behaviour or point out an error is on my side it would be much appreciated :)
 
This is the same error for me. I have been suffering for more than an hour because I just couldn't understand what's wrong ... then I realized that the new version of sinusbot.
 

essem

Member
@TwentyFour
if i run the following code it returns an undefined channel with the message "Could not create channel: invalid parameter" (and my custom message), however if i comment the deleteDelay line out it creates the channel. I can't spot a problem in my code. (Bot version: 1.0.0-beta.1-06a54d7)
JavaScript:
                var channelparams = {};
                channelparams.name = ""+client.name()+"'s channel";
                channelparams.parent = currentchannel;
                channelparams.semiPermanent = true;
                channelparams.encrypted = true;
                channelparams.codec = 4;
                channelparams.codecQuality = 6;
                channelparams.maxClients = -1;
                channelparams.permanent = false;
                channelparams.deleteDelay = 100; //this line

                var channel = backend.createChannel(channelparams);
                if(channel == undefined) {
                    engine.log("Could not create private channel for some reason.");
                    return;
                }
 

TwentyFour

Well-Known Member
is awesome!
V.I.P.
channelparams.semiPermanent = true;
channelparams.deleteDelay = 100; //this line
I think those two parameter collide. Only a temporary channel can have a deleteDelay, semi-permanent ones will just get deleted on server restart.
Have you tried it with a just temporary channel?
 

TwentyFour

Well-Known Member
is awesome!
V.I.P.
Intented behavior by TeamSpeak.
Create the channel as permanent first, the way you're doing already, then use the update function afterwards to set it back to temporary + the delay. That way you avoid the move ;)

Code:
var chanToCreate = backend.createChannel({ name: possibleChanName, parent: homeChannel, password: password, permanent: true, codecQuality: 6 });

if (chanToCreate != undefined) {
                    chanToCreate.update({ permanent: false, deleteDelay: tempDeleteDelay });
                    }
 

essem

Member
maybe they should write stuff like only for temporary into the docs.
also just found a workaround for the parent issue: use the channel-id instead of the raw channel
 

Similar threads

Top