From a5dd272767beb28a05c21e7ee9eb5b2fe4bda567 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Thu, 17 Apr 2014 22:27:15 -0700 Subject: [PATCH] rename "tagged?" to "is" so it actually works (command names match \w+) --- plugins/tag.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/plugins/tag.py b/plugins/tag.py index f20698b..4b076a6 100644 --- a/plugins/tag.py +++ b/plugins/tag.py @@ -135,19 +135,10 @@ def get_nicks_by_tagset(db, chan, tagset): return 'no nicks found with tags "%s"' % tagset return 'nicks tagged "%s": ' % tagset + winnow(nicks) -def get_is_nick_tagged(db, chan, nick, tag): - found = db.execute("select 1 from tag" - " where lower(nick)=lower(?)" - " and lower(subject)=lower(?)" - " and chan=?", (nick, tag, chan)).fetchone() - if found: - return '%s has been tagged "%s"' % (nick, tag) - else: - return '%s has not been tagged "%s"' % (nick, tag) @hook.command def tag(inp, chan='', db=None): - '.tag -- marks as {related: .untag, .tags, .tagged, .tagged?}' + '.tag -- marks as {related: .untag, .tags, .tagged, .is}' db.execute('create table if not exists tag(chan, subject, nick)') @@ -170,7 +161,7 @@ def tag(inp, chan='', db=None): @hook.command def untag(inp, chan='', db=None): - '.untag -- unmarks as {related: .tag, .tags, .tagged, .tagged?}' + '.untag -- unmarks as {related: .tag, .tags, .tagged, .is}' delete = re.match(r'(\S+) (.+)$', inp) @@ -183,7 +174,7 @@ def untag(inp, chan='', db=None): @hook.command def tags(inp, chan='', db=None): - '.tags /list -- get list of tags for , or a list of tags {related: .tag, .untag, .tagged, .tagged?}' + '.tags /list -- get list of tags for , or a list of tags {related: .tag, .untag, .tagged, .is}' if inp == 'list': return get_tag_counts_by_chan(db, chan) @@ -196,20 +187,26 @@ def tags(inp, chan='', db=None): @hook.command def tagged(inp, chan='', db=None): - '.tagged [& tag...] -- get nicks marked as (separate multiple tags with &) {related: .tag, .untag, .tags, .tagged?}' + '.tagged [& tag...] -- get nicks marked as (separate multiple tags with &) {related: .tag, .untag, .tags, .is}' return get_nicks_by_tagset(db, chan, inp) -@hook.command('tagged?') +@hook.command('is') def is_tagged(inp, chan='', db=None): - '.tagged? -- checks if has been marked as {related: .tag, .untag, .tags, .tagged}' + '.is -- checks if has been marked as {related: .tag, .untag, .tags, .tagged}' args = re.match(r'(\S+) (.+)$', inp) if args: nick, tag = args.groups() - return get_is_nick_tagged(db, chan, nick, tag) - + found = db.execute("select 1 from tag" + " where lower(nick)=lower(?)" + " and lower(subject)=lower(?)" + " and chan=?", (nick, tag, chan)).fetchone() + if found: + return 'yes' + else: + return 'no' else: return is_tagged.__doc__