Return new user's id in Database.users.add
This commit is contained in:
parent
8fc7a7652a
commit
66643a1bd8
2 changed files with 4 additions and 1 deletions
|
@ -36,6 +36,8 @@ class Channels(Table):
|
||||||
self.database.execute("""INSERT OR IGNORE INTO channels
|
self.database.execute("""INSERT OR IGNORE INTO channels
|
||||||
(server_id, name) VALUES (?, ?)""",
|
(server_id, name) VALUES (?, ?)""",
|
||||||
[server_id, name.lower()])
|
[server_id, name.lower()])
|
||||||
|
return self.database.execute_fetchone(
|
||||||
|
"SELECT user_id FROM users ORDER BY user_id DESC LIMIT 1")[0]
|
||||||
def delete(self, channel_id: int):
|
def delete(self, channel_id: int):
|
||||||
self.database.execute("DELETE FROM channels WHERE channel_id=?",
|
self.database.execute("DELETE FROM channels WHERE channel_id=?",
|
||||||
[channel_id])
|
[channel_id])
|
||||||
|
|
|
@ -16,5 +16,6 @@ def add_server(database: Database.Database):
|
||||||
realname = input("realname: ")
|
realname = input("realname: ")
|
||||||
bindhost = input("bindhost?: ")
|
bindhost = input("bindhost?: ")
|
||||||
admin = input("admin nickname: ")
|
admin = input("admin nickname: ")
|
||||||
id = database.servers.add(alias, hostname, port, password, ipv4, tls,
|
|
||||||
|
server_id = database.servers.add(alias, hostname, port, password, ipv4, tls,
|
||||||
bindhost, nickname, username, realname)
|
bindhost, nickname, username, realname)
|
||||||
|
|
Loading…
Reference in a new issue