plugins/seen: don't use LIKE (SQL wildcards confuse people), compare lowercase nicks instead

This commit is contained in:
Ryan Hitchman 2013-09-20 13:12:07 -07:00
parent e0518f6c2a
commit 80548ca8f9
1 changed files with 6 additions and 4 deletions

View File

@ -26,17 +26,19 @@ def seeninput(paraml, input=None, db=None, bot=None):
def seen(inp, nick='', chan='', db=None, input=None):
".seen <nick> -- Tell when a nickname was last in active in irc"
if input.conn.nick.lower() == inp.lower():
inp = inp.lower()
if input.conn.nick.lower() == inp:
# user is looking for us, being a smartass
return "You need to get your eyes checked."
if inp.lower() == nick.lower():
if inp == nick.lower():
return "Have you looked in a mirror lately?"
db_init(db)
last_seen = db.execute("select name, time, quote from seen where name"
" like ? and chan = ?", (inp, chan)).fetchone()
last_seen = db.execute("select name, time, quote from seen where"
" name = ? and chan = ?", (inp, chan)).fetchone()
if last_seen:
reltime = timesince.timesince(last_seen[1])