diff --git a/misskey_init.py b/misskey_init.py index af36995..64ba570 100644 --- a/misskey_init.py +++ b/misskey_init.py @@ -189,7 +189,7 @@ async def rerun_misskey_bot(user_id: int) -> bool: async def init_misskey_bot(): await sqlite.create_db_and_tables() count = 0 - for user in await UserAction.get_all_token_ok_users(): + for user in await UserAction.get_all_have_token_users(): mid = await test_token(user.host, user.token) if not mid: logs.warning(f"{user.user_id} Token 失效") diff --git a/models/services/revoke.py b/models/services/revoke.py index 5bbc282..05f5c20 100644 --- a/models/services/revoke.py +++ b/models/services/revoke.py @@ -41,7 +41,7 @@ class RevokeAction: keys = [] async for key in cache.scan(f"sub:{uid}:*"): key: str - keys.append(key[4:]) + keys.append(key.split(":")[-1]) return keys @staticmethod diff --git a/models/services/user.py b/models/services/user.py index ad5d4f9..a71b4a4 100644 --- a/models/services/user.py +++ b/models/services/user.py @@ -49,12 +49,11 @@ class UserAction: return None @staticmethod - async def get_all_token_ok_users() -> list[User]: + async def get_all_have_token_users() -> list[User]: async with sqlite.session() as session: session = cast(AsyncSession, session) statement = ( select(User) - .where(User.status == TokenStatusEnum.STATUS_SUCCESS) .where(User.token != "") .where(User.host != "") )