Fixes to the perpetual restart mechanism

This has the perpetual restart mechanism implemented properly, I failed to add the part that actually prevents the thread from dieing when an exception is thrown. Also made it so that exceptions thrown in handlers won't bring the entire bot down.