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