mirror of https://github.com/Mikaela/Limnoria.git
Update to use irc.replies so that people can take advantage of
conf.supybot.reply.oneToOne
This commit is contained in:
parent
e69f086b51
commit
23f4dc2d0f
|
@ -95,6 +95,7 @@ class Geekquote(callbacks.PrivmsgCommandAndRegexp):
|
|||
except webutils.WebError, e:
|
||||
irc.error(str(e))
|
||||
|
||||
_joiner = ' // '
|
||||
_qdbReString = r'<tr><td bgcolor="#(?:ffffff|e8e8e8)"><a href="/\d*?">'\
|
||||
r'#\d*?</a>.*?<p>(?P<text>.*?)</p></td></tr>'
|
||||
_gkREDict = {'bash.org':re.compile(r'<p class="qt">(?P<text>.*?)</p>',
|
||||
|
@ -122,7 +123,7 @@ class Geekquote(callbacks.PrivmsgCommandAndRegexp):
|
|||
quote = self._gkFetchData(site, id, random=True)
|
||||
else:
|
||||
quote = self._gkFetchData(site, id)
|
||||
irc.reply(quote)
|
||||
irc.replies(quote.split(self._joiner), joiner=self._joiner)
|
||||
|
||||
def _gkFetchData(self, site, id, random=False):
|
||||
html = ''
|
||||
|
@ -131,10 +132,9 @@ class Geekquote(callbacks.PrivmsgCommandAndRegexp):
|
|||
except webutils.WebError, e:
|
||||
self.log.info('%s server returned the error: %s' % \
|
||||
(site, webutils.strError(e)))
|
||||
s = ''
|
||||
for item in self._gkREDict[site].finditer(html):
|
||||
s = item.groupdict()['text']
|
||||
s = ' // '.join(s.splitlines())
|
||||
s = self._joiner.join(s.splitlines())
|
||||
s = utils.htmlToText(s)
|
||||
if random and s:
|
||||
if s not in self.randomData[site]:
|
||||
|
|
Loading…
Reference in New Issue