SpiffyTitles: utils.web._httpUrlRe -> urlRegularExpression

This commit is contained in:
oddluck 2020-06-26 02:21:13 +00:00
parent e2da04d81b
commit 2bb455e3c3
3 changed files with 4 additions and 3 deletions

View File

@ -37,7 +37,7 @@ import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "2020.06.06+git"
__version__ = "2020.06.25+git"
# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author("butterscotchstallion", "butterscotchstallion", "")

View File

@ -70,8 +70,7 @@ conf.registerChannelValue(
SpiffyTitles,
"urlRegularExpression",
registry.String(
r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+",
_("""This regular expression will be used to match URLs"""),
r"", _("""If set, this regular expression will be used to match URLs"""),
),
)

View File

@ -560,6 +560,8 @@ class SpiffyTitles(callbacks.Plugin):
Find the first string that looks like a URL from the message
"""
url_re = self.registryValue("urlRegularExpression", channel)
if not url_re:
url_re = utils.web._httpUrlRe
matches = re.findall(url_re, input)
return matches