aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-08 15:56:25 +0100
committerGravatar jesopo2019-10-08 15:56:25 +0100
commitee64bfc5fcabb12473eb7e7ca205487a77a9680a (patch)
tree625e6ed291d30d7680ead688ee71819acdebb459 /modules
parentadd !isupraw - to check if a tcp connection is possible to a target (diff)
signature
look back in logs for URL when non is provided to !isup
Diffstat (limited to 'modules')
-rw-r--r--modules/isup.py12
1 files 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", "<url>")
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: