From e4ce7356c622aaf83f9aa220a29f34a8a61da9dc Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 22 Jan 2014 16:44:17 +0100 Subject: [PATCH] Aka: Use automatic incrementation when adding an alias. --- plugins/Aka/plugin.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index a83489b95..464b52dd8 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -147,12 +147,9 @@ if sqlite3: if isinstance(alias, str): alias = alias.decode('utf8') db = self.get_db(channel) - cursor = db.cursor().execute('SELECT MAX(id) FROM aliases;') - max_id = cursor.fetchone()[0] - if max_id is None: - max_id = 0 + cursor = db.cursor() cursor.execute("""INSERT INTO aliases VALUES ( - ?, ?, ?, 0, NULL, NULL);""", (str(max_id+1), name, alias)) + NULL, ?, ?, 0, NULL, NULL);""", (name, alias)) db.commit() def remove_aka(self, channel, name):