registerPlugin({
name: 'Group On Channel Join',
version: '0.1',
backends: ['ts3'],
description: 'Adds specified group to a user, when he joins specified channel, and removes, when he leaves the channel',
author: 'DrWarpMan',
vars: [
{
name: 'channelId',
title: 'The channel ID, that if user joins, user will be added to specified group:',
type: 'channel'
},
{
name: 'groupId',
title: 'The group ID, that will be given, to the user, after joining specified channel:',
type: 'string',
placeholder: '69'
}
]
}, function (sinusbot, config) {
var engine = require('engine');
var backend = require('backend');
var event = require('event');
if(config.channelId == undefined || config.groupId == undefined)
return;
var channelId = config.channelId;
var groupId = config.groupId;
event.on('clientMove', function (ev) {
if(ev.toChannel != null)
{
if(channelId === ev.toChannel.id())
{
ev.client.addToServerGroup(backend.getServerGroupByID(groupId));
} else ev.client.removeFromServerGroup(backend.getServerGroupByID(groupId));
}
});
});