SpiffyTitles: Add snarfMultipleUrls Config Option (#42)

* SpiffyTitles: Add snarfMultipleUrls Config Option

* SpiffyTitles: Add snarfMultipleUrls Config Option
This commit is contained in:
Gordon Shumway 2021-08-22 04:05:09 -04:00 committed by GitHub
parent c4f666efe7
commit 211bddc1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -167,6 +167,20 @@ conf.registerChannelValue(
),
)
conf.registerChannelValue(
SpiffyTitles,
"snarfMultipleUrls",
registry.Boolean(
True,
_(
"""
Determines whether SpiffyTitles will query all URLs in a message,
or only the first one.
"""
),
),
)
conf.registerChannelValue(
SpiffyTitles,
"requireCapability",

View File

@ -184,7 +184,10 @@ class SpiffyTitles(callbacks.Plugin):
% (channel)
)
return
urls = self.get_urls_from_message(message, channel)
if self.registryValue("snarfMultipleUrls", channel=channel):
urls = self.get_urls_from_message(message, channel)
else:
urls = self.get_urls_from_message(message, channel)[0]
if not urls:
return
for url in urls: