• 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] Finish reload script

solding

Member
Contributor
Hi, I have used "ScriptReload" for my bot, but since the latest update to version 0.13.37 on my windows server, it has not been working (outdated/errors).
So I thought I would give it a try to make my own improved from scratch, but yeah, that went to shit faster than I Imagined XD

Made the structure as I wanted it, and the base function to reload the script on a specific command works. But none of the other functions is added..
So need help finishing the script / extra functions, and look over the code I made, if anyone feel like giving a helping hand :)

reload.PNG

JavaScript:
registerPlugin({
  name: 'Script Reload',
  version: '1.0',
  description: 'Reload the scripts without having to restart the bot.!',
  author: 'Solding',
    vars: [
        {
            name: 'command',
            title: "The command used to execute the reload. (send it in a chat message to the Bot)",
            type: 'string'
            placeholder: '!reload'
        },
        {
            name: 'group',
            title: "ServerGroups with permission to use the command.",
            type: 'strings'
        },
        {
            name: 'uid',
            title: "Client UID with permission to use the command.",
            type: 'array'
            vars: [{
                name: 'uids',
                title: 'UID:',
                placeholder: 'tHa47e8nqzqk7YsaanXqBu752lM=',
                type: 'string'
            }]
        },
        {
            name: 'sendMessage',
            title: "Send chat message to client after scripts have been reloaded.?",
            type: 'checkbox',
        },
        {
            name: 'message',
            indent: 4,
            title: 'Message to be sent. (bbcode suported)',
            type: 'string'
            placeholder: '[COLOR=green][B]Scripts have been reloaded![/B][/COLOR]'
            conditions: [{field: 'sendMessage', value: true}]
        },
        {
            name: 'notifyAdmin',
            title: "Notify admin when a reload is executed",
            type: 'checkbox',
        },
        {
            name: 'adminUid',
            indent: 4,
            title: 'Admin UID',
            type: 'string'
            conditions: [{field: 'notifyAdmin', value: true}]
        },
        {
            name: 'adminMessage',
            indent: 4,
            title: 'Message to be sent. (bbcode suported)',
            type: 'string'
            placeholder: '[COLOR=green][B]Scripts have been reloaded![/B][/COLOR]'
            conditions: [{field: 'notifyAdmin', value: true}]
        }
    ],   
    
}, function (sinusbot, config)    {
    if (typeof config.command == 'undefined') {
        config.command = "!reload";
    }
    if (typeof config.sendMessage == 'undefined') {
        config.sendMessage = [];
    }
    if (typeof config.message == 'undefined') {
        config.message = "[COLOR=green][B]Scripts have been reloaded![/B][/COLOR]";
    }
    if (typeof config.adminMessage == 'undefined') {
        config.adminMessage = "[COLOR=green][B]Scripts have been reloaded![/B][/COLOR]";
    }
    
    var engine = require('engine');   
    var event = require('event');

    event.on('chat', function(ev) {
        if (ev.text == config.command) {
            reloadScripts();                           
            engine.log('Scripts have been reloaded by '+ ev.client.name());
        }   
    });

});
 

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
event.on('chat', function(ev) { if (ev.text == config.command) { reloadScripts(); engine.log('Scripts have been reloaded by '+ ev.client.name()); } });
reloadScripts() isn't a valid method of the new scripting engine. use:
Code:
engine.reloadScripts()
 

solding

Member
Contributor
Last edited:

solding

Member
Contributor
sorry for the wrong language :O a little tired today XD uppdated my answear to english now
 
Top