Again lower() bug lel

This commit is contained in:
mrhanky 2017-09-05 19:55:41 +02:00
parent 0e1a92f1fd
commit a029c47a61
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -25,11 +25,11 @@ class Seen(DatabasePlugin):
# Fetch seen from database
self.cur.execute('''
SELECT
*
seen_at, message, channel
FROM
seens
WHERE
lower(nick) = lower(%s)
nick = lower(%s)
''', [nick])
seen = self.cur.fetchone()
@ -38,10 +38,11 @@ class Seen(DatabasePlugin):
return 'I\'ve never seen {}'.format(nick)
# Return result
return '{nick} was last seen {delta} saying: {message}'.format(
nick=seen['nick'],
return '{nick} was last seen {delta} in {channel} saying: {message}'.format(
nick=nick,
# TODO: relative string delta?
delta=seen['seen_at'],
channel=seen['channel'],
message=re.sub(r'\x01ACTION (.*)\x01', r'/me \1', seen['message']),
)
@ -53,7 +54,7 @@ class Seen(DatabasePlugin):
INSERT INTO
seens (nick, host, channel, message)
VALUES
(%s, %s, %s, %s)
(lower(%s), %s, %s, %s)
ON CONFLICT (nick) DO UPDATE SET
host = excluded.host,
channel = excluded.channel,