FKLC / WhatsAppToDiscord

WhatsAppToDiscord is a Discord bot that uses WhatsApp Web as a bridge between Discord and WhatsApp.
https://fklc.github.io/WhatsAppToDiscord/
MIT License
252 stars 74 forks source link

Starting as systemd service #103

Closed Max-Trueby closed 2 years ago

Max-Trueby commented 2 years ago

Hi, I have the following issue: I'm trying to make the bot to autostart on boot. But then it always crashes, since you need to enter the Token in the commandline manually. And after I run the bot normally, then the token doesn't save in the db. Is there a option that I can save the token, so I can start the bot on boot with sytemd?

Max

FKLC commented 2 years ago

I mean I guess you can manually create the database, but it would be time consuming, and if it can't save to db, your chats will disappear (will be moved out of the category) after running the bot. (EDIT: now that I think about it, you would also need to save the whatsapp session by logging the session details which would require you to modify the code and run it, so this option is even less viable.) You can try sending your logs. Also, make sure the bot has writing permission. For example on Heroku this is an issue.

magadan commented 2 years ago

Options:

1 - Use "supervisord" for a compiled version to start.

2 - If you use a source version with npm install, you can use pm2

npm install pm2 -g

Go to the dist compiled directory and

pm2 start . --name WhatsAppToDiscord

pm2 save

pm2 startup

See logs:

pm2 logs

See status:

pm2 status

KungFuCookie commented 2 years ago

Hey I used pm2 start with the compiled Linux version