Again lower() bug lel
This commit is contained in:
parent
0e1a92f1fd
commit
a029c47a61
11
bot/seen.py
11
bot/seen.py
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user