Update planeClass.py

This commit is contained in:
b0nz 2022-03-29 23:02:55 -03:00 committed by GitHub
parent 57615d98d9
commit 12c4f9b442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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)
self.recent_ra_types.pop(ra_type)