-1

I was wondering if I can get my bot to start an application on my computer? if i use a command like

    if (message.content === 'grimm!start-minecraft')

is there a way to start an .exe file from a command?

Grimm
  • 43
  • 8

1 Answers1

1

You can use this code to run any .exe but it'll run that file on the pc you're hosting the bot on. Not the client's computer (That'd be weird)

const exec = require('child_process').execFile;

var runExe =fileName => {
   exec( fileName , function(err, data) {  
        console.log(err)
        console.log(data.toString());                  
    }); 
}
runExe();

Also check this out

Akio
  • 721
  • 2
  • 6
  • 21
  • Thanks for helpin me out! I still have one issue, I made another line of code so the app could open on command, `client2.on('message', message => { if (message.content === "grimm!login") exec('Client.exe', function(err, data) { ` but i get an `exec is not defined` how could i fix this? – Grimm Mar 25 '21 at 17:27