From 8e191531d0b1dd768b751c26671ea087ce9254c2 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sun, 27 Mar 2022 15:03:41 -0400 Subject: [PATCH] Reads profiles without noisegate sensitivity value --- bot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index c428758..9d92e30 100644 --- a/bot.py +++ b/bot.py @@ -540,8 +540,12 @@ class Bot(commands.Bot): for section in config.sections(): message_body += f"\nProfile Name: {section}:\n" \ f"\tMode:\t\t\t\t\t{config[section]['Mode']}\n" \ - f"\tFrequency:\t\t\t{config[section]['Frequency']}\n" \ - f"\tNoisegate Sensitivity:\t{config[section]['Noisegate Sensitivity']}" \ - f"\tSquelch:\t\t\t\t{config[section]['Squelch']}\n" + f"\tFrequency:\t\t\t{config[section]['Frequency']}\n" + try: + message_body += f"\tNoisegate Sensitivity:\t{config[section]['Noisegate Sensitivity']}" + except KeyError: + print(f"Config does not contain a 'noisegate sensitivity' value. Please load the profile") + + message_body += f"\tSquelch:\t\t\t\t{config[section]['Squelch']}\n" return message_body