mirror of
https://github.com/Xtao-Labs/misskey2telegram.git
synced 2024-11-28 23:55:17 +00:00
fix: token user sometimes invaild
This commit is contained in:
parent
13877ebe41
commit
f801953a1f
@ -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 失效")
|
||||
|
@ -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
|
||||
|
@ -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 != "")
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user