Skip to content

Commit

Permalink
check for configuration problems on load
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Mar 17, 2014
1 parent 36cabad commit cd9e512
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chanlogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit cd9e512

Please sign in to comment.