Created leaderboard
This commit is contained in:
@@ -43,8 +43,8 @@ class DatabaseConnection:
|
||||
def get_db(self):
|
||||
return self.mydb
|
||||
|
||||
def get_cursor(self):
|
||||
return self.cursor
|
||||
def get_cursor(self, dictionary=False):
|
||||
return self.mydb.cursor(dictionary=dictionary)
|
||||
|
||||
def close(self):
|
||||
self.mydb.close()
|
||||
@@ -202,6 +202,21 @@ class PlayerDBLinker:
|
||||
else:
|
||||
raise PlayerNotLinked()
|
||||
|
||||
#Broken
|
||||
#Deaths
|
||||
#kills
|
||||
#level
|
||||
#placed
|
||||
#playedtime/onlinetime
|
||||
#sailed
|
||||
#walked
|
||||
def get_stats(self, categorie, limit = 20):
|
||||
serverdb_cursor = self.serverdbconn.get_cursor(dictionary=True)
|
||||
sql = f"SELECT playerName, {categorie} as stat FROM playerprofiles ORDER BY {categorie} DESC LIMIT {str(limit)}"
|
||||
serverdb_cursor.execute(sql)
|
||||
return list(serverdb_cursor.fetchall())
|
||||
|
||||
|
||||
def close(self):
|
||||
self.discorddbconn.close()
|
||||
self.serverdbconn.close()
|
||||
|
||||
Reference in New Issue
Block a user