I wrote pretty much the same thing a few days ago. Checking for disconnect, restarting everything (bot included), etc. It's pretty much completely self-sufficient at this point
Not sure why you wouldn't wanna share your ~200 lines of code with the public. Yes, it's quite messy and not clean at all, but it does its job, so who cares?
Cheers=)
PS:
You might wanna add a check to see whether or not the host's internet is currently working before doing the restarts.