dmcallejo / ASFBot

Control your ArchiSteamFarm with Telegram

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic shutdown of the bot when any Python error occurs.

lzrdblzzrd opened this issue · comments

If any error occurs related to the bot code, the .py file is automatically turned off, after which you need to enter python bot.py --token....

This causes a problem if the bot is running on Heroku or any other cloud.

This would make it much easier to work on cloud services, because the bot would always be running and you wouldn't have to restart it after any error.

It would be better if, for example, when a user writes !status to a bot in a telegram, the console says "ASF is not running" or "Unable to connect to the specified host" and waited for the new command. Instead, the bot just crashes with an error Failed to estabilish a new connection: The connection is not established because the destination computer rejected the connection request and you have to run it again.

That's fair. The bot is barely coded against errors, I'll take a look and see if I can protect it from termination on runtime.

This is going to take me a little because of how polling works in the bot library I use.
I will directly treat the exception when the bot loses connection to the ASF instance, but I'm not sure about errors that may not be recoverable.

Any updates?

@lzrdblzzrd Hello, sorry.
I've not been in the mood for programming in my free time because life, but I'm addressing it now and I hope to have it fixed before the end of next week.

Hello.
Wow, thank you. I really periodically went to this repository and looked for any new updates. I'm glad that you decided to return to the development of this script.

Hello @lzrdblzzrd
I have pushed to develop several changes that should address your issues. If you could see if it's enough to close the issue that would be great.
The script needs a full refactor because right now is kind of a mess. It was intended to be a quick solution to access ASF from telegram, but when they changed the API it was kind of a mess.