From 3a93b06a7672d1e73a78c9bdb68c722e45e9046b Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Thu, 14 Dec 2023 04:55:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=B8=BA`Bot.receive=5Fresp()`?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E5=A4=9A=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/bot.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/gsuid_core/bot.py b/gsuid_core/bot.py index bba42b4..1065e5d 100644 --- a/gsuid_core/bot.py +++ b/gsuid_core/bot.py @@ -139,7 +139,9 @@ class Bot: ] = None, unsuported_platform: bool = False, timeout: float = 60, - sep: str = ' / ', + sep: str = '\n', + command_tips: str = '请输入以下命令之一:', + command_start_text: str = '', ): return await self.receive_resp( reply, @@ -149,6 +151,8 @@ class Bot: True, timeout, sep=sep, + command_tips=command_tips, + command_start_text=command_start_text, ) async def send_option( @@ -160,10 +164,19 @@ class Bot: Union[List[str], List[Button], List[List[str]], List[List[Button]]] ] = None, unsuported_platform: bool = False, - sep: str = ' / ', + sep: str = '\n', + command_tips: str = '请输入以下命令之一:', + command_start_text: str = '', ): return await self.receive_resp( - reply, option_list, unsuported_platform, False, False, sep=sep + reply, + option_list, + unsuported_platform, + False, + False, + sep=sep, + command_tips=command_tips, + command_start_text=command_start_text, ) async def receive_resp( @@ -178,7 +191,9 @@ class Bot: is_mutiply: bool = False, is_recive: bool = True, timeout: float = 60, - sep: str = ' / ', + sep: str = '\n', + command_tips: str = '请输入以下命令之一:', + command_start_text: str = '', ) -> Optional[Event]: if option_list: if reply is None: @@ -249,7 +264,12 @@ class Bot: _options.append(option) _reply.append( - MessageSegment.text('\n请输入以下命令之一:\n' + sep.join(_options)) + MessageSegment.text( + f'\n{command_tips}\n' + + sep.join( + [f'{command_start_text}{op}' for op in _options] + ) + ) ) await self.send(_reply)