• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Multiple Admin channels

Status
Not open for further replies.

C4undBIER

Member
Hello,

i want to build a script, where you can choose which groups are getting kicked out of a specified channel because teamspeaks rights system with join power and max users in a channel is enough for 2, not for more. and i need more.
Maybe i am too dumb to use the docs or dont understand javascript right. i tested what i thought was right without the group part. Here's what i came up with:
registerPlugin({
name: 'AdminChannel',
version: '0,1',
description: 'moves clients to old channel when not in a server group',
author: 'C4undBIER',
vars: {
Channels: {
title: 'Channels',
type: 'array',
vars: [
{
name: 'channel1',
indent: 1,
title: 'Channel',
type: 'channel'
},
{
name: 'group1',
indent: 1,
title: 'Group1, that is allowed to join and will not get kicked',
type: 'string',
}
}
}
function (sinusbot, config)
{
sinusbot.on('clientMove', function(ev){
if (channel1 == ev.client.getChannels())
getServerGroups(): Array<ServerGroup>
if (channel1 in Array)
move(ev.clientId, ev.oldChannel);
}
}

it doesn't even show up in the scripts.

someone has an idea what i am doing wrong or which script already does what i want to do and i didn't find while i googled?

Thanks in advance
 

C4undBIER

Member
Oh. spaces dont seem to work. here is the .js so you get some more survivability while reading.
 

Attachments

  • mover.js
    734 bytes · Views: 12

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Last edited:

Diesmon

Tuetchen Dominator
is awesome!
Contributor
Insider
www.jshint.com is always the best place to make a rough syntax check if nothing is showing up.

also you using the old engine syntax, at least it looks like you copied/learned a few functions from old engine v1 scripts.

if you want to call a variable from the config (e.g. channel1) you need to write config.channel1

also you can't compare a single ID (like channel1) with an array, because .getChannels always gives you an array of channels. (because in discord you can have multiple client channels at once etc) So if you want to get the TS3 channel you can just call it via .getChannels[0]

also oldChannel doesn't exist (anymore/shouldn't be used). Use .fromChannel instead.

Same for clientid. use ev.client.id() It's now a function call

In general I would recommend that you take a look at the documentation first for the new engine, because the old one will get dropped soon™ https://www.sinusbot.com/docs/scripting/
 
Last edited:

C4undBIER

Member
Well... thank you all for helping me. Especially for looking over the crap i wrote...

Javascript is something completely new for me. I will probably get into it a bit more, since it is used in webdesigning as well.

I will take a look at Keep Out! and i'll try to understand what Thunderkill has done.

BTW: Who uses Windows Server? Linux is way more Lightweight and probably easier for stuff like Teamspeak, Sinusbots and Hosting Websites. It doesn't cost 1000€ as well.
 
Status
Not open for further replies.
Top