You can automate various types of check-ins using client.sign_growth() for growth level check-ins and client.sign_forums() for a one-click forum check-in. For individual forums, you can iterate through your followed forums using client.get_self_follow_forums(pn) and call client.sign_forum(fname) for each unsigned forum.
import asyncio
import aiotieba as tb
async def sign(BDUSS_key: str, *, retry_times: int = 0):
async with tb.Client(BDUSS_key) as client:
# Growth level check-in
for _ in range(retry_times):
await asyncio.sleep(1.0)
if await client.sign_growth():
break
# Forum check-in
await client.sign_forums() # One-click check-in
retry_list: list[str] = []
for pn in range(1, 9999):
forums = await client.get_self_follow_forums(pn)
retry_list += [forum.fname for forum in forums if not forum.is_signed]
if not forums.has_more:
break
# Individual forum check-in with retries
for _ in range(retry_times + 1):
new_retry_list: list[str] = []
for fname in retry_list:
ret = await client.sign_forum(fname)
if ret.err is not None and ret.err.code not in [160002, 340006]:
new_retry_list.append(fname)
await asyncio.sleep(1.0)
if not new_retry_list:
break
retry_list = new_retry_list
async def main():
await sign("YOUR_BDUSS", retry_times=3)
asyncio.run(main())