mirror of
https://github.com/Xtao-Labs/misskey2telegram.git
synced 2024-11-29 07:57:03 +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():
|
async def init_misskey_bot():
|
||||||
await sqlite.create_db_and_tables()
|
await sqlite.create_db_and_tables()
|
||||||
count = 0
|
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)
|
mid = await test_token(user.host, user.token)
|
||||||
if not mid:
|
if not mid:
|
||||||
logs.warning(f"{user.user_id} Token 失效")
|
logs.warning(f"{user.user_id} Token 失效")
|
||||||
|
@ -41,7 +41,7 @@ class RevokeAction:
|
|||||||
keys = []
|
keys = []
|
||||||
async for key in cache.scan(f"sub:{uid}:*"):
|
async for key in cache.scan(f"sub:{uid}:*"):
|
||||||
key: str
|
key: str
|
||||||
keys.append(key[4:])
|
keys.append(key.split(":")[-1])
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -49,12 +49,11 @@ class UserAction:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@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:
|
async with sqlite.session() as session:
|
||||||
session = cast(AsyncSession, session)
|
session = cast(AsyncSession, session)
|
||||||
statement = (
|
statement = (
|
||||||
select(User)
|
select(User)
|
||||||
.where(User.status == TokenStatusEnum.STATUS_SUCCESS)
|
|
||||||
.where(User.token != "")
|
.where(User.token != "")
|
||||||
.where(User.host != "")
|
.where(User.host != "")
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user