Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registerPlugin({
- name: '!come',
- version: '1.1',
- description: 'Implements the !come and !goaway command.',
- author: 'Xuxe <xuxe@xuxe-network.eu>',
- vars: {
- ids: {
- title: 'Client Unique Ids (Comma seperated):',
- type: 'string'
- },
- cid: {
- title: 'Default Channel ID (Needed for !goaway): ',
- type: 'channel'
- },
- sids: {
- title: 'Whitelisted Servergroup Ids (Comma seperated):',
- type: 'string'
- }
- }
- }, function (sinusbot, config) {
- if (config.sids) {
- var sids = config.sids.split(',');
- }
- else {
- log("SIDs not valid...");
- var sids = new Array();
- }
- if (config.ids) {
- var uids = config.ids.split(',');
- }
- else {
- log("UIDs not valid...");
- var uids = new Array();
- }
- sinusbot.on('chat', function(ev) {
- var IsInServerGroup = ev.clientServerGroups.some(function(group)
- {
- if(sids.indexOf(group.i.toString()) >= 0)
- {
- return true;
- } else { return false; }
- });
- if(uids.indexOf(ev.clientUid) >= 0 || IsInServerGroup == true)
- {
- switch(ev.msg)
- {
- case "!come":
- var oldChannel = getCurrentChannelId();
- var channel, client;
- var channels = getChannels();
- for (var i = 0; i < channels.length; i++) {
- if (!channels[i].clients) continue;
- channel = channels[i];
- for (var x = 0; x < channel.clients.length; x++) {
- client = channel.clients[x];
- if (client.id == ev.clientId) {
- join(channel.id);
- log("Going to client: "+ev.clientNick);
- if(oldChannel == getCurrentChannelId()) {
- chatPrivate(ev.clientId, 'can not join the channel, maybe missing rights or the channel is full');
- }
- }
- }
- }
- break;
- case "!goaway":
- if(!config.cid) {
- log('Default channel is not set. Command !goaway not available.');
- return;
- }
- join(config.cid);
- log("Going back to my default channel.");
- break;
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement