Skip to content
Snippets Groups Projects
Commit 64a6fe16 authored by Iori Ichinose's avatar Iori Ichinose :speech_balloon:
Browse files

remove b30

parent f830e788
No related branches found
No related tags found
No related merge requests found
......@@ -22,19 +22,18 @@ async def fetch_api(
data = await conn.recv()
if isinstance(data, str) and data == 'bye':
break
elif isinstance(data, (bytes, bytearray)):
if isinstance(data, (bytes, bytearray)):
message = json.loads(brotli.decompress(data))
print(message)
print(message['cmd'])
if message['cmd'] == query_type:
if type(message['data']) is list:
for item in message['data']:
ret.append(item)
else:
ret.append(message['data'])
print(ret)
return ret
if __name__ == '__main__':
import asyncio
asyncio.run(fetch_api('295917349', 'userinfo'))
\ No newline at end of file
asyncio.run(fetch_api('295917349', 'scores'))
\ No newline at end of file
......@@ -69,7 +69,7 @@ async def fetch_b30_list(user_code: str) -> list[Song]:
async def fetch_userinfo(user_code: str) -> User:
info = await fetch_api(user_code, 'userinfo', start=8, end=12)
info = await fetch_api(user_code, 'userinfo')
if len(info) == 0:
raise RuntimeError
return User(info[0])
......@@ -153,8 +153,12 @@ async def set_arc(event: Event, params: tuple[int]) -> str:
async def fetch_b30(event: Event, params) -> MessageSegment:
return CQGen.face('kk') + CQGen.text('b30功能坏掉惹')
user_id = event.dict()['user_id']
user_code = users[str(user_id)]
kid = str(user_id)
if kid not in users:
return CQGen.face('daisuke') + "椰叶还没有绑定好友码哦"
user_code = users[kid]
try:
songs = await fetch_b30_list(user_code=user_code)
ret = handle_songs(songs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment