Added automatic reconnection code

Bot will now attempt to reconnect if it loses connection.