summaryrefslogtreecommitdiff
path: root/crocoite
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-01-27 11:18:16 +0100
committerLars-Dominik Braun <lars@6xq.net>2019-01-27 11:24:25 +0100
commit668cc5e10c7097d51ba4e4fcae02f55d89283923 (patch)
tree4f21f0b601bbfcfe5f5179c546fc07048c4762a6 /crocoite
parent51d7fa07c5db9a1015ef210089a911c19796bd79 (diff)
downloadcrocoite-668cc5e10c7097d51ba4e4fcae02f55d89283923.tar.gz
crocoite-668cc5e10c7097d51ba4e4fcae02f55d89283923.tar.bz2
crocoite-668cc5e10c7097d51ba4e4fcae02f55d89283923.zip
irc: Switch configuration to JSON
Diffstat (limited to 'crocoite')
-rw-r--r--crocoite/cli.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/crocoite/cli.py b/crocoite/cli.py
index a8de73b..b73051b 100644
--- a/crocoite/cli.py
+++ b/crocoite/cli.py
@@ -132,30 +132,30 @@ def recursive ():
return 0
def irc ():
- from configparser import ConfigParser
+ import json
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')
+ parser.add_argument('--config', '-c', help='Config file location', metavar='PATH', default='chromebot.json')
args = parser.parse_args ()
- config = ConfigParser ()
- config.read (args.config)
+ with open (args.config) as fd:
+ config = json.load (fd)
s = config['irc']
loop = asyncio.get_event_loop()
bot = Chromebot (
- host=s.get ('host'),
- port=s.getint ('port'),
- ssl=s.getboolean ('ssl'),
- nick=s.get ('nick'),
- channels=[s.get ('channel')],
- tempdir=s.get ('tempdir'),
- destdir=s.get ('destdir'),
- processLimit=s.getint ('process_limit'),
+ host=s['host'],
+ port=s['port'],
+ ssl=s['ssl'],
+ nick=s['nick'],
+ channels=s['channels'],
+ tempdir=config['tempdir'],
+ destdir=config['destdir'],
+ processLimit=config['process_limit'],
logger=logger,
loop=loop)
stop = lambda signum: bot.cancel ()