add Database.users.by_id()
This commit is contained in:
parent
f52a824ffb
commit
c0af477373
1 changed files with 4 additions and 0 deletions
|
@ -90,6 +90,10 @@ class Users(Table):
|
||||||
"SELECT user_id FROM users WHERE server_id=? and nickname=?",
|
"SELECT user_id FROM users WHERE server_id=? and nickname=?",
|
||||||
[server_id, nickname])
|
[server_id, nickname])
|
||||||
return value if value == None else value[0]
|
return value if value == None else value[0]
|
||||||
|
def by_id(self, user_id: int):
|
||||||
|
return self.database.execute_fetchone(
|
||||||
|
"SELECT server_id, nickname FROM users WHERE user_id=?",
|
||||||
|
[user_id])
|
||||||
def get_nickname(self, server_id: int, user_id: int):
|
def get_nickname(self, server_id: int, user_id: int):
|
||||||
value = self.database.execute_fetchone(
|
value = self.database.execute_fetchone(
|
||||||
"SELECT nickname FROM users WHERe server_id=? AND user_id=?",
|
"SELECT nickname FROM users WHERe server_id=? AND user_id=?",
|
||||||
|
|
Loading…
Reference in a new issue