aboutsummaryrefslogtreecommitdiff
path: root/Database.py
diff options
context:
space:
mode:
Diffstat (limited to 'Database.py')
-rw-r--r--Database.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/Database.py b/Database.py
index b9490af9..c315d801 100644
--- a/Database.py
+++ b/Database.py
@@ -112,24 +112,10 @@ class ServerSettings(Table):
[server_id, setting.lower()])
class ChannelSettings(Table):
- def jsonKeys2int(self, x):
- if isinstance(x, dict):
- hold = {}
- for k, v in x.items():
- key = int(k) if k.isdigit() else k
- val = int(v) if v.isdigit() else v
-
- hold[key] = val
- return hold
- else:
- return x
-
def set(self, channel_id, setting, value):
- converted_json = self.jsonKeys2int(value)
-
self.database.execute(
"INSERT OR REPLACE INTO channel_settings VALUES (?, ?, ?)",
- [channel_id, setting.lower(), converted_json])
+ [channel_id, setting.lower(), json.dumps(value)])
def get(self, channel_id, setting, default=None):
value = self.database.execute_fetchone(
"""SELECT value FROM channel_settings WHERE
@@ -368,4 +354,4 @@ class Database(object):
DELETE CASCADE, PRIMARY KEY (user_id, channel_id,
setting))""")
self.execute("""CREATE INDEX user_channel_settings_index
- ON user_channel_settings (user_id, channel_id, setting)""")
+ ON user_channel_settings (user_id, channel_id, setting)""") \ No newline at end of file