mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Updated to put just the domain rather than the whole url in snarfer replies.
This commit is contained in:
parent
c101fd121a
commit
941d4e1523
@ -87,11 +87,6 @@ conf.registerChannelValue(conf.supybot.plugins.URL.tinyurlSnarfer,
|
|||||||
conf.registerChannelValue(conf.supybot.plugins.URL, 'titleSnarfer',
|
conf.registerChannelValue(conf.supybot.plugins.URL, 'titleSnarfer',
|
||||||
registry.Boolean(False, """Determines whether the bot will output the HTML
|
registry.Boolean(False, """Determines whether the bot will output the HTML
|
||||||
title of URLs it sees in the channel."""))
|
title of URLs it sees in the channel."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.URL.titleSnarfer,
|
|
||||||
'includesUrl',
|
|
||||||
registry.Boolean(True, """Determines whether the bot will include the
|
|
||||||
snarfed URL in its message. This is particularly useful when people have a
|
|
||||||
habit of putting multiple URLs in a message."""))
|
|
||||||
conf.registerChannelValue(conf.supybot.plugins.URL, 'nonSnarfingRegexp',
|
conf.registerChannelValue(conf.supybot.plugins.URL, 'nonSnarfingRegexp',
|
||||||
registry.Regexp(None, """Determines what URLs are to be snarfed and stored
|
registry.Regexp(None, """Determines what URLs are to be snarfed and stored
|
||||||
in the database in the channel; URLs matchin the regexp given will not be
|
in the database in the channel; URLs matchin the regexp given will not be
|
||||||
@ -188,7 +183,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
|
|||||||
return
|
return
|
||||||
elif updateDb:
|
elif updateDb:
|
||||||
self._updateTinyDb(url, tinyurl, channel)
|
self._updateTinyDb(url, tinyurl, channel)
|
||||||
s = '%s (was <%s>)' % (ircutils.bold(tinyurl), url)
|
domain = webutils.getDomain(url)
|
||||||
|
s = '%s (at %s)' % (ircutils.bold(tinyurl), domain)
|
||||||
irc.reply(s, prefixName=False)
|
irc.reply(s, prefixName=False)
|
||||||
tinyurlSnarfer = privmsgs.urlSnarfer(tinyurlSnarfer)
|
tinyurlSnarfer = privmsgs.urlSnarfer(tinyurlSnarfer)
|
||||||
|
|
||||||
@ -202,9 +198,9 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
|
|||||||
text = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
|
text = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
|
||||||
m = self._titleRe.search(text)
|
m = self._titleRe.search(text)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
s = 'Title: %s' % utils.htmlToText(m.group(1).strip())
|
domain = webutils.getDomain(url)
|
||||||
if self.registryValue('titleSnarfer.includesUrl', channel):
|
title = utils.htmlToText(m.group(1).strip())
|
||||||
s += ' (<%s>)' % url
|
s = 'Title: %s (at %s)' % (title, domain)
|
||||||
irc.reply(s, prefixName=False)
|
irc.reply(s, prefixName=False)
|
||||||
titleSnarfer = privmsgs.urlSnarfer(titleSnarfer)
|
titleSnarfer = privmsgs.urlSnarfer(titleSnarfer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user