• 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 [Request] Kick client on Join Bot Channel

Status
Not open for further replies.
As title,

I'm very bad as JavaScripting, I'm learning right now but I don't know how work at 100% so I want to request a help for making this.

Is in beta and I'm waiting for optimizing and bug/help or something

Sorry for Bad English

-Moon
 

Attachments

  • NoPeople.txt
    850 bytes · Views: 106

good_live

Active Member
Tier III
is awesome!
V.I.P.
Contributor
Insider
Here you go :) It's untested !!!
Code:
registerPlugin({
    name: 'No Other Bot!',
    version: '1.0',
    description: 'This script will kick other people when join the channel',
    author: 'UnwishingMoon <[email protected]>',
    vars: {
        clientUids: {
            title: 'Comma-separated list of client-ids that the bot should kick',
            type: 'string'
        },
        channel: {
            title: 'Id of the channel',
            type: 'channel'
        }
    }
}, function(sinusbot, config, info) {
   
    log('Loading...');
    var author = info.author.split(',');
    if(author.length == 1){
        author = author[0];
        author = author.replace(/<.*>/gi, '').trim();
    } else {
        author = author.map(function(e){
            return e.replace(/<.*>/gi, '').trim();
        });
        author = author.join(' & ');
    }
    log(info.name + ' v' + info.version + ' by ' + author + ' for SinusBot v0.9.9-50e8ba1 (and above)');
   
   
    if (!config.clientUids) {
        log('Invalid clientUids');
        return;
    }
   
    var channelid = parseInt(config.channel, 10);
    var uids = config.clientUids.split(',');
   
    sinusbot.on('clientMove', function(ev) {
        if (ev.newChannel == channelid) {
            var i = uids.length;
            while(i--) {
                if (uids[i] == ev.clientUid) {
                    move(ev.clientId, ev.oldChannel);
                    chatPrivate(ev.clientId, 'Bot vietati in questo Canale!');
                    //kickChannel(ev.clientId, 'Bot vietati in questo Canale!'); (instead of the two lines above if you just want to kick the client from the channel)
                    return;
                }
            }
       }
    });

    log('Loaded');
});
 
Last edited:

good_live

Active Member
Tier III
is awesome!
V.I.P.
Contributor
Insider
For exampel if you dont want a secound musicbot in the channel or just ban some users from hearing the music ^^ Just be creative.
 
Status
Not open for further replies.
Top