From 0867960b134680205946bdc05713d07f89f47785 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 2 Oct 2018 19:23:09 +0200 Subject: irc: Refactoring/beautification Add logging, split bot into abstract bot implementation and actual chromebot implementation, move some reusable checks into decorators. --- crocoite/cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crocoite/cli.py') diff --git a/crocoite/cli.py b/crocoite/cli.py index 63199c9..0319dc9 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -109,7 +109,9 @@ def recursive (): def irc (): from configparser import ConfigParser - from .irc import Bot + from .irc import Chromebot + + logger = Logger (consumer=[DatetimeConsumer (), JsonPrintConsumer ()]) parser = argparse.ArgumentParser(description='IRC bot.') parser.add_argument('--config', '-c', help='Config file location', metavar='PATH', default='chromebot.ini') @@ -120,7 +122,7 @@ def irc (): config.read (args.config) s = config['irc'] - bot = Bot ( + bot = Chromebot ( host=s.get ('host'), port=s.getint ('port'), ssl=s.getboolean ('ssl'), @@ -128,7 +130,8 @@ def irc (): channels=[s.get ('channel')], tempdir=s.get ('tempdir'), destdir=s.get ('destdir'), - processLimit=s.getint ('process_limit')) + processLimit=s.getint ('process_limit'), + logger=logger) bot.loop.create_task(bot.connect()) bot.loop.run_forever() -- cgit v1.2.3