Phantombot run shell command


Hello! I made this script to make the phantombot run a shell command as my choice.

But it wont execute the and i don’t know why.

Here is my script:

(function() {
    $.bind('command', function(event) {
        var sender = event.getSender(),  
            command = event.getCommand(), 
            args = event.getArgs(),  
            action = args[0],                     
            subAction = args[1];                

        if (command.equalsIgnoreCase('helloworld')) {

                        if (action === undefined) {
const exec = require('child_process').exec;

var yourscript = exec('sh ./');


    $.bind('initReady', function() {
        $.registerChatCommand('./commands/helloWorld.js', 'helloworld', 1);


PhantomBot scripts aren’t NodeJS, they are all ran with Rhino JavaScript. You’ll have to look into how to use Java classes in Rhino to get this working.

Something like this could work. (I have not tested this)

java.lang.Runtime.getRuntime().exec("sh ./");