diff --git a/modules/handlers/drive.py b/modules/handlers/drive.py index 75ddcc9..5ba64b8 100644 --- a/modules/handlers/drive.py +++ b/modules/handlers/drive.py @@ -9,7 +9,7 @@ import subprocess from modules.client import tg_bot, onedrive from modules.env import tg_user_name -from modules.utils import check_in_group, check_tg_login, cmd_parser, CMDException +from modules.utils import check_in_group, check_tg_login, cmd_parser from modules.handlers.auth import od_auth @@ -96,7 +96,8 @@ async def drive_handler(event): raise events.StopPropagation if index < len(users): - should_show_current_user = onedrive.logout(users[index]) + should_show_current_user = True if users[index] == onedrive.session.username else False + onedrive.logout(users[index]) if should_show_current_user: current_user = onedrive.session.current_user logout_res = f"OneDrive logout successfully.\nCurrent account is {current_user}" diff --git a/modules/onedrive/database.py b/modules/onedrive/database.py index 8a6c233..50cc842 100644 --- a/modules/onedrive/database.py +++ b/modules/onedrive/database.py @@ -118,6 +118,7 @@ def set_current_user(self, username): insert into current_user(user_id) values(?); ''' self.execute(command, params=(user_id,)) + self.commit() def get_user_id(self, username): command = ''' diff --git a/modules/onedrive/session.py b/modules/onedrive/session.py index 5d6ecdd..2c6fcbc 100644 --- a/modules/onedrive/session.py +++ b/modules/onedrive/session.py @@ -168,8 +168,8 @@ def logout(self, username=''): else: self.db.delete_user(username) - # don't show current user - return False + # has other users + return True def change_user(self, username): record = self.db.get_user(username)