• 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 Own script problem

Status
Not open for further replies.

BisKit

Member
Hi !
I try to script a plugin that will start when client joins "channel1" and move him to "channel2".
I put it in /opt/sinusbot/scripts directory, but I don't see it in scripts (in sinusbot options). I tried restarts. Other plugins work well.
Code:
registerPlugin({
    name: 'Channel Move',
    version: '1.0',
    description: 'Simple move client script',
    author: 'BisKit ([email protected])',
    vars: {
        channelone: {
            title: 'channel1',
            type: 'channel',
        },
        channeltwo: {
            title: 'channel2',
            type: 'channel',
        }
    }
}, function(sinusbot, config) {
    sinusbot.on('clientMove', function(ev)) {
        if (ev.newChannel == config.channelone)
            sinusbot.move(ev.clientId, config.channeltwo);
            return;
        }
    });

    sinusbot.log('ChannelMove Plugin Initialized.');
});
 

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Hi !
I try to script a plugin that will start when client joins "channel1" and move him to "channel2".
I put it in /opt/sinusbot/scripts directory, but I don't see it in scripts (in sinusbot options). I tried restarts. Other plugins work well.
Code:
registerPlugin({
    name: 'Channel Move',
    version: '1.0',
    description: 'Simple move client script',
    author: 'BisKit ([email protected])',
    vars: {
        channelone: {
            title: 'channel1',
            type: 'channel',
        },
        channeltwo: {
            title: 'channel2',
            type: 'channel',
        }
    }
}, function(sinusbot, config) {
    sinusbot.on('clientMove', function(ev)) {
        if (ev.newChannel == config.channelone)
            sinusbot.move(ev.clientId, config.channeltwo);
            return;
        }
    });

    sinusbot.log('ChannelMove Plugin Initialized.');
});
you missed a curly bracket after the if condition. This one should work:
http://hastebin.com/uhojunosud.vbs
At the next time, if you have such a problem, first check the logs, when the bot starts, there should be the error message. ;)
 

kanalumaddela

Insider
Insider
I wanted to try the script, but for some reason it still wasn't working. After looking through the script multiple times (I hate losing track of parentheses in code tbh), I found the error.

You had
Code:
sinusbot.on('clientMove', function(ev)) {
instead of
Code:
sinusbot.on('clientMove', function(ev) {
Code:
registerPlugin({
    name: 'Channel Move',
    version: '1.0',
    description: 'Simple move client script',
    author: 'BisKit ([email protected])',
    vars: {
        channelone: {
            title: 'Channel to move client from',
            type: 'channel'
        },
        channeltwo: {
            title: 'Channel to move client to',
            type: 'channel'
        }
    }
}, function(sinusbot, config) {
    sinusbot.on('clientMove', function(ev) {
        if (ev.newChannel == config.channelone) {
            sinusbot.move(ev.clientId, config.channeltwo);
            return;
        }
    });

    sinusbot.log('ChannelMove Plugin Initialized.');
});

Also tested that^ and it works, so nice job.
 
Status
Not open for further replies.
Top