From ee64bfc5fcabb12473eb7e7ca205487a77a9680a Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 8 Oct 2019 15:56:25 +0100 Subject: [PATCH] look back in logs for URL when non is provided to !isup --- modules/isup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/isup.py b/modules/isup.py index 55f00479..3c52dc77 100644 --- a/modules/isup.py +++ b/modules/isup.py @@ -5,11 +5,19 @@ class Module(ModuleManager.BaseModule): _name = "isup" @utils.hook("received.command.isup") - @utils.kwarg("min_args", 1) @utils.kwarg("help", "Check if a given URL is up or not") @utils.kwarg("usage", "") def isup(self, event): - url = event["args_split"][0] + url = None + if event["args"]: + url = event["args_split"][0] + else: + match = event["target"].buffer.find(utils.http.REGEX_URL) + if match: + url = match.match + + if not url: + raise utils.EventError("No URL provided/found.") response = None try: