From 69d58eede2e9bf83aa1ed1d8fcf956efde494726 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 3 Oct 2018 13:22:37 +0100 Subject: Move src/Utils.py in to src/utils/, splitting functionality out in to modules of related functionality --- modules/check_urls.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/check_urls.py') diff --git a/modules/check_urls.py b/modules/check_urls.py index 356fc13b..f63ac902 100644 --- a/modules/check_urls.py +++ b/modules/check_urls.py @@ -1,28 +1,28 @@ #--require-config virustotal-api-key import re -from src import ModuleManager, Utils +from src import ModuleManager, utils URL_VIRUSTOTAL = "https://www.virustotal.com/vtapi/v2/url/report" RE_URL = re.compile(r"https?://\S+", re.I) -@Utils.export("channelset", {"setting": "check-urls", +@utils.export("channelset", {"setting": "check-urls", "help": "Enable/Disable automatically checking for malicious URLs", - "validate": Utils.bool_or_none}) -@Utils.export("serverset", {"setting": "check-urls", + "validate": utils.bool_or_none}) +@utils.export("serverset", {"setting": "check-urls", "help": "Enable/Disable automatically checking for malicious URLs", - "validate": Utils.bool_or_none}) -@Utils.export("channelset", {"setting": "check-urls-kick", + "validate": utils.bool_or_none}) +@utils.export("channelset", {"setting": "check-urls-kick", "help": "Enable/Disable automatically kicking users that " - "send malicious URLs", "validate": Utils.bool_or_none}) + "send malicious URLs", "validate": utils.bool_or_none}) class Module(ModuleManager.BaseModule): - @Utils.hook("received.message.channel") + @utils.hook("received.message.channel") def message(self, event): match = RE_URL.search(event["message"]) if match and event["channel"].get_setting("check-urls", event["server"].get_setting("check-urls", False)): url = match.group(0) - page = Utils.get_url(URL_VIRUSTOTAL, get_params={ + page = utils.http.get_url(URL_VIRUSTOTAL, get_params={ "apikey": self.bot.config["virustotal-api-key"], "resource": url}, json=True) -- cgit v1.3.1-10-gc9f91