3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

relay_clientbot: handle errors if the relay: or clientbot_styles: blocks are empty

This commit is contained in:
James Lu 2017-10-21 13:19:31 -07:00
parent 472b73cf65
commit 26b8292564

View File

@ -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,7 +80,7 @@ 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,
text_template = (relay_conf.get('clientbot_styles') or {}).get(real_command,
default_styles.get(real_command, ''))
text_template = string.Template(text_template)