summaryrefslogtreecommitdiff
path: root/crocoite/cli.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-10-02 19:23:09 +0200
committerLars-Dominik Braun <lars@6xq.net>2018-10-02 19:24:40 +0200
commit0867960b134680205946bdc05713d07f89f47785 (patch)
tree4cde89e5a4475031b6f46e736281fb911a73d3b2 /crocoite/cli.py
parent07c34b2d004f16798c17ed479679a511c6bd2f29 (diff)
downloadcrocoite-0867960b134680205946bdc05713d07f89f47785.tar.gz
crocoite-0867960b134680205946bdc05713d07f89f47785.tar.bz2
crocoite-0867960b134680205946bdc05713d07f89f47785.zip
irc: Refactoring/beautification
Add logging, split bot into abstract bot implementation and actual chromebot implementation, move some reusable checks into decorators.
Diffstat (limited to 'crocoite/cli.py')
-rw-r--r--crocoite/cli.py9
1 files changed, 6 insertions, 3 deletions
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()