diff --git a/src/api/chatroom.py b/src/api/chatroom.py index 37b87d3..b6355cc 100644 --- a/src/api/chatroom.py +++ b/src/api/chatroom.py @@ -72,3 +72,16 @@ def open_rock_paper_scissors_redpacket(self, red_packet_id, gesture: int = -1) - resp = requests.post( f"{GLOBAL_CONFIG.host}/chat-room/red-packet/open", json=params, headers={'User-Agent': UA}) return json.loads(resp.text) + + def siguoya(self) -> None: + resp = requests.get( + f"{GLOBAL_CONFIG.host}/chat-room/si-guo-list", headers={'User-Agent': UA}) + ret = json.loads(resp.text) + if ('code' in ret and ret['code'] == -1): + print('思过崖空无一人') + else: + if len(ret['data']) == 0: + print('思过崖空无一人') + else: + print( + f'思过崖: {list(map(lambda x: x["userName"] ,ret["data"]))}') diff --git a/src/core/command.py b/src/core/command.py index 6678fd2..53bc2a7 100644 --- a/src/core/command.py +++ b/src/core/command.py @@ -73,6 +73,11 @@ def exec(self, api: FishPi, args: Tuple[str, ...]): cr.start() +class SiGuoYa(Command): + def exec(self, api: FishPi, args: Tuple[str, ...]): + api.chatroom.siguoya() + + class AnswerMode(Command): def exec(self, api: FishPi, args: Tuple[str, ...]): if GLOBAL_CONFIG.chat_config.answer_mode: @@ -328,6 +333,7 @@ def init_cli(api: FishPi): cli_handler.add_command('#help', help_c) cli_handler.add_command('#cli', EnterCil()) cli_handler.add_command('#chatroom', EnterChatroom()) + cli_handler.add_command('#siguo', SiGuoYa()) cli_handler.add_command('#bm', BreezemoonsCommand()) cli_handler.add_command('#api-key', GetAPIKey()) cli_handler.add_command('#transfer', PointTransferCommand()) diff --git a/src/utils/__init__.py b/src/utils/__init__.py index dc9e3b8..d20b8ed 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -10,6 +10,7 @@ COMMAND_GUIDE = ''' [#cli] 进入命令交互模式 [#chatroom] 进入聊天室模式 +[#siguo] 思过崖 [#rp] 1 128 1个128积分 (默认5个,128积分)拼手气红包 [#rp-ave] 1 128 1个128积分 (默认5个,32积分)平均红包 [#rp-hb] 5 128 5个128积分 (默认5个,32积分)心跳红包