-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c2a521
commit aea3533
Showing
4 changed files
with
54 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/%SystemDrive%/ProgramData/Microsoft/Windows/Caches/cversions.2.db | ||
/%SystemDrive%/ProgramData/Microsoft/Windows/Caches/{6AF0698E-D558-4F6E-9B3C-3716689AF493}.2.ver0x0000000000000001.db | ||
/%SystemDrive%/ProgramData/Microsoft/Windows/Caches/{9315FC40-D984-4247-A2C7-1C70F63EF486}.2.ver0x0000000000000001.db | ||
/%SystemDrive%/ProgramData/Microsoft/Windows/Caches/{DDF571F2-BE98-426D-8288-1A9A39C3FDA2}.2.ver0x0000000000000001.db | ||
/%SystemDrive%/ProgramData/Microsoft/Windows/Caches/{F219A7FD-A3BE-48BD-A541-FA063C25677B}.2.ver0x0000000000000001.db | ||
__pycache__/eolymp.cpython-39.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sqlite3 | ||
|
||
|
||
class BotDB: | ||
def __init__(self, db_file): | ||
print("opening") | ||
self.conn = sqlite3.connect(db_file) | ||
self.cursor = self.conn.cursor() | ||
|
||
def leaderboard(self, discord_group_id, out): | ||
result = self.cursor.execute( | ||
"SELECT `eolymp_nickname`, `discord_user_id` FROM `users` WHERE `discord_group_id` = ?", | ||
(discord_group_id,), | ||
) | ||
bd_users_output = result.fetchall() | ||
if out: | ||
users = [] | ||
for user in bd_users_output: | ||
users.append(user[0]) | ||
return users | ||
else: | ||
return bd_users_output | ||
|
||
def close(self): | ||
"""Закрываем соединение с БД""" | ||
print("closing") | ||
self.conn.close() | ||
|
||
|
||
botDB_ = BotDB("eolymp_users.db") | ||
print(botDB_.leaderboard(909078994568228865, True)) | ||
botDB_.close() |
Binary file not shown.