aboutsummaryrefslogtreecommitdiff
path: root/modules/check_urls.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-02 19:54:45 +0100
committerGravatar jesopo2018-09-02 19:54:45 +0100
commit8c6ab17e579cf8f4e510ec324fc98b010ff01cb0 (patch)
treec0437f76bbe9dea31f5f4599450ed5b492eedcd6 /modules/check_urls.py
parentIRCLogging -> Logging (diff)
signature
give an Exports object (actually, ExportsContex object) to each module, to
facilitate things like !set and !channelset without using the events system
Diffstat (limited to 'modules/check_urls.py')
-rw-r--r--modules/check_urls.py17
1 files changed, 8 insertions, 9 deletions
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"])