Tomato6966 / Multipurpose-discord-bot

A multipurpose bot, a clan bot, a all in one bot. The one bot u need for ur server originally made as Milrato discord Bot and by Tomato6966.
https://milrato.com
MIT License
587 stars 611 forks source link

Bug report #73

Open AudiRoCWA opened 2 years ago

AudiRoCWA commented 2 years ago

i use replit and restartbot,stopbot,reloadbot arent working

console log exec error: Error: Command failed: pm2 restart ID_OF_THE_BOT_PROCESS_IN_PM2_LIST [PM2][ERROR] Process or Namespace ID_OF_THE_BOT_PROCESS_IN_PM2_LIST not found

KayTwenty commented 2 years ago

It looks like the restart scripts/commands are using pm2. Since you can't pm2 globally in replit, you're gonna have to use npx. To run pm2, install pm2 by going to shell on the right next to the console and type this command:

npx pm2

Right after, to start the current process of your bot(Multipurpose Discord Bot) with pm2, type this command:

npx pm2 start index.js

Alternatively you can just adjust the restart commands not to use pm2.

malbouy commented 2 years ago

You'd not be using pm2 to start the scripts, either you can create a go-around for the same or use npx like KayTwenty suggested.

riciuuu commented 2 years ago

It looks like the restart scripts/commands are using pm2. Since you can't pm2 globally in replit, you're gonna have to use npx. To run pm2, install pm2 by going to shell on the right next to the console and type this command:

npx pm2

Right after, to start the current process of your bot(Multipurpose Discord Bot) with pm2, type this command:

npx pm2 start index.js

Alternatively you can just adjust the restart commands not to use pm2.

Hello, I did exactly as you said but the orders still don't work, or after I write what you said above do I still have to do something?

KayTwenty commented 2 years ago

Hello, I did exactly as you said but the orders still don't work, or after I write what you said above do I still have to do something?

Interesting... Are you sure you've used npx at the start of all commands? I've managed to get this working with my other project.

image

If my suggestion doesn't work the other way I can think about it is that you would need to edit the restart scripts to work without pm2.

riciuuu commented 2 years ago

Buna ziua, am facut exact cum ati spus dar comenzile tot nu merg, sau dupa ce scriu ce ati spus mai sus mai trebuie sa fac ceva?

Interesant... Ești sigur că ai folosit npxla începutul tuturor comenzilor? Am reușit să lucrez cu celălalt proiect al meu.

imagine

Dacă sugestia mea nu funcționează în alt mod, mă pot gândi că ar trebui să editați scripturile de repornire pentru a funcționa fără pm2.

Hello, I did exactly as you said but the orders still don't work, or after I write what you said above do I still have to do something?

Interesting... Are you sure you've used npx at the start of all commands? I've managed to get this working with my other project.

image

If my suggestion doesn't work the other way I can think about it is that you would need to edit the restart scripts to work without pm2.

I wrote npx pm2 in the shell, it was installed without errors, after I wrote npx pm2 start index.js, after which that table appeared to me as if index.js is online. The bot is online but the reloadbot, restartbot and other commands that use pm2 still don't work, did I miss something? I ask for help because I am a beginner and every day I struggle to learn to program, thank you!

KayTwenty commented 2 years ago

I believe one of the problems is in the restartbot.js script. At line 24:

await message.reply("NOW RESTARTING!");
      require("child_process").exec(`pm2 restart ID_OF_THE_BOT_PROCESS_IN_PM2_LIST`, (error, stdout, stderr) => {

It's trying to execute pm2 by restarting the id of the bot. But the problem is that since we used npx. It cannot execute that command without it. I think if we tweak line 24 to use npx. That should work.

await message.reply("NOW RESTARTING!");
      require("child_process").exec(`npx pm2 restart ID_OF_THE_BOT_PROCESS_IN_PM2_LIST`, (error, stdout, stderr) => {