diff options
| author | 2018-09-27 12:08:07 +0100 | |
|---|---|---|
| committer | 2018-09-27 12:08:07 +0100 | |
| commit | 6eb8b1ba6d9aaaf7df42f3d705149f02b6a1b871 (patch) | |
| tree | ece91b1c4d871d5d2b9a3f6319598e33aa13f93f /modules/check_urls.py | |
| parent | Use ModuleManager.BaseModule in more modules (diff) | |
Move all exports to @Utils.export calls
Diffstat (limited to 'modules/check_urls.py')
| -rw-r--r-- | modules/check_urls.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/modules/check_urls.py b/modules/check_urls.py index b0438ec8..356fc13b 100644 --- a/modules/check_urls.py +++ b/modules/check_urls.py @@ -1,25 +1,21 @@ #--require-config virustotal-api-key import re -from src import 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) -class Module(object): - def __init__(self, bot, events, exports): - self.bot = bot - self.events = events - exports.add("channelset", {"setting": "check-urls", - "help": "Enable/Disable automatically checking for " - "malicious URLs", "validate": Utils.bool_or_none}) - exports.add("serverset", {"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}) - +@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", + "help": "Enable/Disable automatically checking for malicious URLs", + "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}) +class Module(ModuleManager.BaseModule): @Utils.hook("received.message.channel") def message(self, event): match = RE_URL.search(event["message"]) |
