From 8c6ab17e579cf8f4e510ec324fc98b010ff01cb0 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 2 Sep 2018 19:54:45 +0100 Subject: give an Exports object (actually, ExportsContex object) to each module, to facilitate things like !set and !channelset without using the events system --- modules/check_urls.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'modules/check_urls.py') diff --git a/modules/check_urls.py b/modules/check_urls.py index 7d39294e..e53437b7 100644 --- a/modules/check_urls.py +++ b/modules/check_urls.py @@ -7,18 +7,17 @@ URL_VIRUSTOTAL = "https://www.virustotal.com/vtapi/v2/url/report" RE_URL = re.compile(r"https?://\S+", re.I) class Module(object): - def __init__(self, bot, events): + def __init__(self, bot, events, exports): self.bot = bot self.events = events events.on("received.message.channel").hook(self.message) - events.on("postboot").on("configure").on( - "channelset").assure_call(setting="check-urls", - help="Enable/Disable automatically checking for malicious URLs", - validate=Utils.bool_or_none) - events.on("postboot").on("configure").on( - "channelset").assure_call(setting="check-urls-kick", - help="Enable/Disable automatically kicking users that send " - "malicious URLs", validate=Utils.bool_or_none) + + exports.add("channelset", {"setting": "check-urls", + "help": "Enable/Disable automatically checking for " + "malicious URLs", "validate": Utils.bool_or_none}) + exports.add("channelset", {"setting": "check-urls-kick", + "help": "Enable/Disable automatically kicking users that " + "send malicious URLs", "validate": Utils.bool_or_none}) def message(self, event): match = RE_URL.search(event["message"]) -- cgit v1.3.1-10-gc9f91