diff --git a/SpiffyTitles/__init__.py b/SpiffyTitles/__init__.py index 23947d7..ac5812a 100644 --- a/SpiffyTitles/__init__.py +++ b/SpiffyTitles/__init__.py @@ -60,6 +60,7 @@ from imp import reload # In case we're being reloaded. reload(plugin) +reload(config) # Add more reloads here if you add third-party modules and want them to be # reloaded when this plugin is reloaded. Don't forget to import them as well! diff --git a/SpiffyTitles/config.py b/SpiffyTitles/config.py index 34c5766..288f8fb 100644 --- a/SpiffyTitles/config.py +++ b/SpiffyTitles/config.py @@ -66,7 +66,7 @@ conf.registerGlobalValue( ) # URL regex -conf.registerGlobalValue( +conf.registerChannelValue( SpiffyTitles, "urlRegularExpression", registry.String( @@ -137,7 +137,7 @@ conf.registerGlobalValue( False, _( """ - Keep link cache globally. This will use default values for all link templates + Keep link cache globally. This will use global values for all link templates. """ ), ), diff --git a/SpiffyTitles/plugin.py b/SpiffyTitles/plugin.py index 0881ac3..962c472 100644 --- a/SpiffyTitles/plugin.py +++ b/SpiffyTitles/plugin.py @@ -35,7 +35,7 @@ import supybot.utils as utils import supybot.ircdb as ircdb import supybot.log as log import re, sys, random, time, json, unicodedata, datetime -from urllib.parse import urlparse, parse_qsl +from urllib.parse import urlparse, parse_qsl, quote from bs4 import BeautifulSoup from jinja2 import Template import requests @@ -171,7 +171,7 @@ class SpiffyTitles(callbacks.Plugin): % (channel) ) return - urls = self.get_urls_from_message(message) + urls = self.get_urls_from_message(message, channel) if not urls: return for url in urls: @@ -559,11 +559,11 @@ class SpiffyTitles(callbacks.Plugin): ) return match - def get_urls_from_message(self, input): + def get_urls_from_message(self, input, channel): """ Find the first string that looks like a URL from the message """ - url_re = self.registryValue("urlRegularExpression") + url_re = self.registryValue("urlRegularExpression", channel) matches = re.findall(url_re, input) return matches