diff options
| author | 2018-08-31 05:48:53 +0100 | |
|---|---|---|
| committer | 2018-08-31 05:48:53 +0100 | |
| commit | 301d3cb45adb687f924b176dd6b9840395b83d24 (patch) | |
| tree | 008ce4407ade529632e50e96d273b82a3edfce65 /Database.py | |
| parent | Apparently i auto-reformatted the code. Either way I fixed ducks spawning end... (diff) | |
| signature | ||
Revert the god awful database edits I made and make ducks.py convert to int. Might be an idea to make a make_int function?
Diffstat (limited to 'Database.py')
| -rw-r--r-- | Database.py | 18 |
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 |
