mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Aka: Use automatic incrementation when adding an alias.
This commit is contained in:
parent
5aa0c8cfbd
commit
e4ce7356c6
@ -147,12 +147,9 @@ if sqlite3:
|
|||||||
if isinstance(alias, str):
|
if isinstance(alias, str):
|
||||||
alias = alias.decode('utf8')
|
alias = alias.decode('utf8')
|
||||||
db = self.get_db(channel)
|
db = self.get_db(channel)
|
||||||
cursor = db.cursor().execute('SELECT MAX(id) FROM aliases;')
|
cursor = db.cursor()
|
||||||
max_id = cursor.fetchone()[0]
|
|
||||||
if max_id is None:
|
|
||||||
max_id = 0
|
|
||||||
cursor.execute("""INSERT INTO aliases VALUES (
|
cursor.execute("""INSERT INTO aliases VALUES (
|
||||||
?, ?, ?, 0, NULL, NULL);""", (str(max_id+1), name, alias))
|
NULL, ?, ?, 0, NULL, NULL);""", (name, alias))
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def remove_aka(self, channel, name):
|
def remove_aka(self, channel, name):
|
||||||
|
Loading…
Reference in New Issue
Block a user