From cd9e512c0f0f815401fe62bfb31ee724b6a265f8 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Sun, 9 Mar 2014 09:57:13 -0400 Subject: [PATCH] check for configuration problems on load --- chanlogs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chanlogs.py b/chanlogs.py index c292176b9f..eb38819d00 100644 --- a/chanlogs.py +++ b/chanlogs.py @@ -9,6 +9,7 @@ from datetime import datetime import willie.module import willie.tools +from willie.config import ConfigurationError MESSAGE_TPL = "{datetime} <{origin.nick}> {message}" ACTION_TPL = "{datetime} * {origin.nick} {message}" @@ -65,6 +66,11 @@ def _format_template(tpl, bot, **kwargs): def setup(bot): + if not getattr(bot.config, "chanlogs", None): + raise ConfigurationError("Channel logs are not configured") + if not getattr(bot.config.chanlogs, "dir", None): + raise ConfigurationError("Channel log storage directory is not defined") + # ensure log directory exists basedir = os.path.expanduser(bot.config.chanlogs.dir) if not os.path.exists(basedir):