From 26b82925641f49dc26d8239384df64b920bec9ef Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 21 Oct 2017 13:19:31 -0700 Subject: [PATCH] relay_clientbot: handle errors if the relay: or clientbot_styles: blocks are empty --- plugins/relay_clientbot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/relay_clientbot.py b/plugins/relay_clientbot.py index aa6e90e..b4eea42 100644 --- a/plugins/relay_clientbot.py +++ b/plugins/relay_clientbot.py @@ -47,7 +47,7 @@ def cb_relay_core(irc, source, command, args): except KeyError: # User has left due to /quit sourcename = args['userdata'].nick - relay_conf = conf.conf.get('relay', {}) + relay_conf = conf.conf.get('relay') or {} # Be less floody on startup: don't relay non-PRIVMSGs for the first X seconds after connect. startup_delay = relay_conf.get('clientbot_startup_delay', 20) @@ -80,8 +80,8 @@ def cb_relay_core(irc, source, command, args): # Try to fetch the format for the given command from the relay:clientbot_styles:$command # key, falling back to one defined in default_styles above, and then nothing if not found # there. - text_template = relay_conf.get('clientbot_styles', {}).get(real_command, - default_styles.get(real_command, '')) + text_template = (relay_conf.get('clientbot_styles') or {}).get(real_command, + default_styles.get(real_command, '')) text_template = string.Template(text_template) if text_template: