Made a set of the dbs that responded so each db only gets listed once.

This commit is contained in:
Jeremy Fincher 2003-09-04 17:17:03 +00:00
parent 9a2f80ae7b
commit fff4a7d864

View File

@ -805,12 +805,13 @@ class FunCommands(callbacks.Privmsg):
dictionary = '*' dictionary = '*'
conn = dictclient.Connection('dict.org') conn = dictclient.Connection('dict.org')
definitions = conn.define(dictionary, word) definitions = conn.define(dictionary, word)
dbs = [ircutils.bold(d.getdb().getname()) for d in definitions] dbs = sets.Set()
if not definitions: if not definitions:
irc.reply(msg, 'No definition for %r could be found.' % word) irc.reply(msg, 'No definition for %r could be found.' % word)
return return
L = [] L = []
for d in definitions: for d in definitions:
dbs.add(ircutils.bold(d.getdb().getname()))
(db, s) = (d.getdb().getname(), d.getdefstr()) (db, s) = (d.getdb().getname(), d.getdefstr())
db = ircutils.bold(db) db = ircutils.bold(db)
s = utils.normalizeWhitespace(s).rstrip(';.,') s = utils.normalizeWhitespace(s).rstrip(';.,')