• 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.

Script won't load

Aerora

New Member
I wrote a script by myself and I put it into the script folder. I restarted the bot but it won't load. I checked but I haven't found nothing: no errors, no warnings, nothing... What can I do?
My bot version: 0.14.3
My O.S. version: CentOS Linux (7)
 
I wrote a script by myself and I put it into the script folder. I restarted the bot but it won't load. I checked and I haven't found nothing: no errors, no warnings, nothing... What can I do?
My bot version: 0.14.3
My O.S. version: CentOS Linux (7)
Set Loglevel = 10 , restart Sinusbot, post log
 
How about sending us the script that is likely to be at fault? :rolleyes:
 
JavaScript:
registerPlugin({
    name 'Advanced ChaosGaming Welcome',
    version: '1.0'
    description: 'Gestisce i messaggi di join.'
    author: 'Aerora <[email protected]>'
    vars: [{
        name: 'primoMessaggio',
        title: 'Messaggio da inviare. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'secondoMessaggio',
        title: 'Messaggio quando entra la seconda volta. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'tipoMessaggio',
        title: 'Modalità di messaggio.',
        type: 'select',
        options: [
            'Chat privata', //0
            'Poke' //1
        ]
    }]
}, function(sinusbot, config) {
    var event = require('event');
    event.on('connect', function (connectionEvent) {
        var messaggyno = config.primoMessaggio;
        var messaggyno2 = config.secondoMessaggio;
        messaggyno = messaggyno.replace(/%u/g, connectionEvent.client.name());
        messaggyno2 = messaggyno2.replace(/%u/g, connectionEvent.client.name());
        if(connectionEvent.client.getTotalConnectionsCount() == 1){
            if(config.tipoMessaggio == 0){
                connectionEvent.client.chat(messaggyno);
            }
            else{
                connectionEvent.client.poke(messaggyno2);
            }
            connectionEvent.client.addToServerGroup('Utente');
        }
        else{
            if(config.tipoMessaggio == 0){
                connectionEvent.client.chat(messaggyno);
            }
            else{
                connectionEvent.client.poke(messaggyno2);
            }
        }
    });
});
 
Where is the ,
Besides, scripts for this already exsist
It there a script that add a server group on the first join with a message changing? Could you send it to me?
Anyway, how can I fix this?
Error in script (event connect): TypeError: Cannot access member 'client' of undefined
at CGWelcome.js:28:42
 
First, you should always write scripts in english.
Second: i try ot at home, i am in a train right now
 
Error in script (event connect): TypeError: Cannot access member 'client' of undefined
at CGWelcome.js:28:42
The connect event does not have any parameters.
It doesn't do what you think it does. It's not fired when clients connect, only when the bot connects.

Client connection events are just "clientMove" events where fromChannel is null.
 
The connect event does not have any parameters.
It doesn't do what you think it does. It's not fired when clients connect, only when the bot connects.

Client connection events are just "clientMove" events where fromChannel is null.
Thanks, I'm going to edit it.
 
It there a script that add a server group on the first join with a message changing? Could you send it to me?
Anyway, how can I fix this?
Error in script (event connect): TypeError: Cannot access member 'client' of undefined
at CGWelcome.js:28:42
JavaScript:
registerPlugin({
    name 'Advanced ChaosGaming Welcome',
    version: '1.0',
    description: 'Gestisce i messaggi di join.',
    author: 'Aerora <[email protected]>',
    vars: [{
        name: 'primoMessaggio',
        title: 'Messaggio da inviare. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'secondoMessaggio',
        title: 'Messaggio quando entra la seconda volta. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'tipoMessaggio',
        title: 'Modalità di messaggio.',
        type: 'select',
        options: [
            'Chat privata', //0
            'Poke' //1
        ]
    }]
}, function(sinusbot, config) {
    var event = require('event');
    event.on('clientMove', function (connectionEvent) {
        var messaggyno = config.primoMessaggio;
        var messaggyno2 = config.secondoMessaggio;
        messaggyno = messaggyno.replace(/%u/g, connectionEvent.client.name());
        messaggyno2 = messaggyno2.replace(/%u/g, connectionEvent.client.name());
        if(connectionEvent.toChannel.id() == x) { // replace x with channel id of default channel
            if(connectionEvent.client.getTotalConnectionsCount() == 1){
                if(config.tipoMessaggio == 0){
                    connectionEvent.client.chat(messaggyno);
                }
                else{
                    connectionEvent.client.poke(messaggyno2);
                }
                connectionEvent.client.addToServerGroup('Utente');
            }
            else{
                if(config.tipoMessaggio == 0){
                    connectionEvent.client.chat(messaggyno);
                }
                else{
                    connectionEvent.client.poke(messaggyno2);
                }
            }
        }
    });
});
 
JavaScript:
registerPlugin({
    name 'Advanced ChaosGaming Welcome',
    version: '1.0',
    description: 'Gestisce i messaggi di join.',
    author: 'Aerora <[email protected]>',
    vars: [{
        name: 'primoMessaggio',
        title: 'Messaggio da inviare. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'secondoMessaggio',
        title: 'Messaggio quando entra la seconda volta. (%u = nome utente)',
        type: 'string'
    }, {
        name: 'tipoMessaggio',
        title: 'Modalità di messaggio.',
        type: 'select',
        options: [
            'Chat privata', //0
            'Poke' //1
        ]
    }]
}, function(sinusbot, config) {
    var event = require('event');
    event.on('clientMove', function (connectionEvent) {
        var messaggyno = config.primoMessaggio;
        var messaggyno2 = config.secondoMessaggio;
        messaggyno = messaggyno.replace(/%u/g, connectionEvent.client.name());
        messaggyno2 = messaggyno2.replace(/%u/g, connectionEvent.client.name());
        if(connectionEvent.toChannel.id() == x) { // replace x with channel id of default channel
            if(connectionEvent.client.getTotalConnectionsCount() == 1){
                if(config.tipoMessaggio == 0){
                    connectionEvent.client.chat(messaggyno);
                }
                else{
                    connectionEvent.client.poke(messaggyno2);
                }
                connectionEvent.client.addToServerGroup('Utente');
            }
            else{
                if(config.tipoMessaggio == 0){
                    connectionEvent.client.chat(messaggyno);
                }
                else{
                    connectionEvent.client.poke(messaggyno2);
                }
            }
        }
    });
});
Shouldn't be 'connectionEvent' instead of 'ev'?
 
It sends only the message for the first join (even if the total connections are > 1) and then it doesn't do nothing more.
 
Back
Top Bottom