made in-memory seendb case insensitive

This commit is contained in:
iou1name 2018-05-25 07:22:56 -04:00
parent 864dc8d39a
commit bad47e346e

View File

@ -8,6 +8,8 @@ import threading
from datetime import datetime from datetime import datetime
from sqlite3 import OperationalError from sqlite3 import OperationalError
from requests.structures import CaseInsensitiveDict
from tools.time import relativeTime from tools.time import relativeTime
from module import commands, example, hook, require_chanmsg from module import commands, example, hook, require_chanmsg
@ -17,11 +19,11 @@ def load_database(bot):
Loads all entries from the 'seen' table in the bot's database and Loads all entries from the 'seen' table in the bot's database and
returns them. returns them.
""" """
data = {} data = CaseInsensitiveDict()
seens = bot.db.execute("SELECT * FROM seen").fetchall() seens = bot.db.execute("SELECT * FROM seen").fetchall()
for seen in seens: for seen in seens:
nick, seen = seen[0], seen[1:] nick, seen = seen[0].lower(), seen[1:]
data[nick] = seen data[nick] = seen
return data return data