tag: fix `.tag <tag>` searching

This commit is contained in:
Ryan Hitchman 2013-12-20 15:38:08 -08:00
parent 87a11881a4
commit bb3f418aa3
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ def munge(inp, munge_count=0):
def winnow(inputs, limit=400): def winnow(inputs, limit=400):
"remove random elements from the list until it's short enough" "remove random elements from the list until it's short enough"
combiner = lambda l: ', '.join(l) combiner = lambda l: u', '.join(l)
suffix = '' suffix = ''
while len(combiner(inputs)) >= limit: while len(combiner(inputs)) >= limit:
inputs.pop(random.randint(0, len(inputs) - 1)) inputs.pop(random.randint(0, len(inputs) - 1))
@ -122,7 +122,7 @@ def tag(inp, chan='', db=None):
tags = get_tags_by_nick(db, chan, inp) tags = get_tags_by_nick(db, chan, inp)
if not tags: if not tags:
return get_nicks_by_tag(db, chan, inp) return get_nicks_by_tagset(db, chan, inp)
else: else:
return 'tags for "%s": ' % munge(inp, 1) + winnow([ return 'tags for "%s": ' % munge(inp, 1) + winnow([
tag[0] for tag in tags]) tag[0] for tag in tags])