event doesn't exist in _get_title

This commit is contained in:
jesopo 2019-06-25 18:04:36 +01:00
parent 12181bfec6
commit 19755778b6

View file

@ -20,7 +20,7 @@ class Module(ModuleManager.BaseModule):
return "sha256:%s" % hashlib.sha256(url.lower().encode("utf8") return "sha256:%s" % hashlib.sha256(url.lower().encode("utf8")
).hexdigest() ).hexdigest()
def _get_title(self, channel, url): def _get_title(self, server, channel, url):
if not urllib.parse.urlparse(url).scheme: if not urllib.parse.urlparse(url).scheme:
url = "http://%s" % url url = "http://%s" % url
@ -41,8 +41,7 @@ class Module(ModuleManager.BaseModule):
"\r", "").replace(" ", " ").strip() "\r", "").replace(" ", " ").strip()
if channel.get_setting("title-shorten", False): if channel.get_setting("title-shorten", False):
short_url = self.exports.get_one("shorturl")( short_url = self.exports.get_one("shorturl")(server, url)
event["server"], url)
return "%s - %s" % (title, short_url) return "%s - %s" % (title, short_url)
return title return title
else: else:
@ -58,7 +57,8 @@ class Module(ModuleManager.BaseModule):
if event["target"].get_setting("auto-title", False): if event["target"].get_setting("auto-title", False):
event.eat() event.eat()
url = event["match"].group(0) url = event["match"].group(0)
title = self._get_title(event["target"], event["match"].group(0)) title = self._get_title(event["server"], event["target"],
event["match"].group(0))
if title: if title:
message = title message = title
@ -95,7 +95,7 @@ class Module(ModuleManager.BaseModule):
if not url: if not url:
raise utils.EventError("No URL provided/found.") raise utils.EventError("No URL provided/found.")
title = self._get_title(event["target"], url) title = self._get_title(event["server"], event["target"], url)
if title: if title:
event["stdout"].write(title) event["stdout"].write(title)