From 0af80da0b506a06593c81d3686e91b8b82a4f3ba Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 27 Jan 2019 11:36:29 +0100 Subject: irc: Add URL blacklist --- crocoite/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crocoite/cli.py') diff --git a/crocoite/cli.py b/crocoite/cli.py index b73051b..be3538a 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -132,7 +132,7 @@ def recursive (): return 0 def irc (): - import json + import json, re from .irc import Chromebot logger = Logger (consumer=[DatetimeConsumer (), JsonPrintConsumer ()]) @@ -145,6 +145,7 @@ def irc (): with open (args.config) as fd: config = json.load (fd) s = config['irc'] + blacklist = dict (map (lambda x: (re.compile (x[0], re.I), x[1]), config['blacklist'].items ())) loop = asyncio.get_event_loop() bot = Chromebot ( @@ -157,6 +158,7 @@ def irc (): destdir=config['destdir'], processLimit=config['process_limit'], logger=logger, + blacklist=blacklist, loop=loop) stop = lambda signum: bot.cancel () loop.add_signal_handler (signal.SIGINT, stop, signal.SIGINT) -- cgit v1.2.3