diff --git a/planeClass.py b/planeClass.py index 0dd495a..ff82f4b 100644 --- a/planeClass.py +++ b/planeClass.py @@ -408,7 +408,7 @@ class Plane: else: raise ValueError("Map option not set correctly in this planes conf") #Telegram - if self.config.getboolean('TELEGRAM', 'ENABLE'): + if self.config.has_section('TELEGRAM') and self.config.getboolean('TELEGRAM', 'ENABLE'): from defTelegram import sendTeleg photo = open(self.map_file_name, "rb") sendTeleg(photo, message, self.config) @@ -442,7 +442,7 @@ class Plane: if route_to != None: print(route_to) #Telegram - if self.config.getboolean('TELEGRAM', 'ENABLE'): + if self.config.has_section('TELEGRAM') and self.config.getboolean('TELEGRAM', 'ENABLE'): message = f"{self.dis_title} {route_to}".strip() photo = open(self.map_file_name, "rb") sendTeleg(photo, message, self.config) @@ -574,7 +574,7 @@ class Plane: message = f"Circling {round(nearest_airport_dict['distance_mi'], 2)}mi {cardinal} of {nearest_airport_dict['icao']}, {nearest_airport_dict['name']} at {self.alt_ft}ft" print(message) #Telegram - if self.config.getboolean('TELEGRAM', 'ENABLE'): + if self.config.has_section('TELEGRAM') and self.config.getboolean('TELEGRAM', 'ENABLE'): photo = open(self.map_file_name, "rb") sendTeleg(photo, message, self.config) if self.config.getboolean('DISCORD', 'ENABLE'): @@ -651,4 +651,4 @@ class Plane: print(time_since_ra) if time_since_ra.seconds >= 600: print(ra_type) - self.recent_ra_types.pop(ra_type) \ No newline at end of file + self.recent_ra_types.pop(ra_type)