mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
DDG: actually, return a list of tuples in search_core()
This abstraction makes it easier for depending plugins to filter out the data they actually need.
From: 4915b7713b
This commit is contained in:
parent
828112eaa1
commit
f5a53a1965
@ -127,8 +127,9 @@ class DDG(callbacks.Plugin):
|
|||||||
else:
|
else:
|
||||||
self.log.debug("DDG: expanded result URL from %s to %s", origlink, link)
|
self.log.debug("DDG: expanded result URL from %s to %s", origlink, link)
|
||||||
|
|
||||||
s = format("%s - %s %u", ircutils.bold(title), snippet, link)
|
# Return a list of tuples in the form (link title, snippet text, link)
|
||||||
results.append(s)
|
results.append((title, snippet, link))
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
return results[:maxr]
|
return results[:maxr]
|
||||||
@ -142,7 +143,8 @@ class DDG(callbacks.Plugin):
|
|||||||
if not results:
|
if not results:
|
||||||
irc.error("No results found.")
|
irc.error("No results found.")
|
||||||
else:
|
else:
|
||||||
irc.reply(', '.join(results))
|
strings = [format("%s - %s %u", ircutils.bold(res[0]), res[1], res[2]) for res in results]
|
||||||
|
irc.reply(', '.join(strings))
|
||||||
|
|
||||||
@wrap(['text'])
|
@wrap(['text'])
|
||||||
def zeroclick(self, irc, msg, args, text):
|
def zeroclick(self, irc, msg, args, text):
|
||||||
|
Loading…
Reference in New Issue
Block a user