From 19157be9f23c434c7e2e5f90220c884f9572c98d Mon Sep 17 00:00:00 2001 From: ShiXui Date: Wed, 5 Oct 2022 13:06:55 +0800 Subject: [PATCH] =?UTF-8?q?#=E8=A7=84=E8=8C=83=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_dialectlist/__init__.py | 3 ++- nonebot_plugin_dialectlist/config.py | 4 ++-- nonebot_plugin_dialectlist/function.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nonebot_plugin_dialectlist/__init__.py b/nonebot_plugin_dialectlist/__init__.py index becd63b..213e39c 100644 --- a/nonebot_plugin_dialectlist/__init__.py +++ b/nonebot_plugin_dialectlist/__init__.py @@ -201,5 +201,6 @@ async def handle_message( await rankings.send(msg) await asyncio.sleep(1) #让图片先发出来 - await rankings.finish(plugin_config.dialectlist_string_suffix_format.format(timeCost=time.time()-st-1)) + if plugin_config.dialectlist_string_suffix_format: + await rankings.finish(plugin_config.dialectlist_string_suffix_format.format(timecost=time.time()-st-1)) diff --git a/nonebot_plugin_dialectlist/config.py b/nonebot_plugin_dialectlist/config.py index 8e44f81..d90bb98 100644 --- a/nonebot_plugin_dialectlist/config.py +++ b/nonebot_plugin_dialectlist/config.py @@ -6,8 +6,8 @@ from pydantic import BaseModel, Extra class Config(BaseModel, extra=Extra.ignore): timezone: Optional[str] - dialectlist_string_format: str = '第{index}名:\n{nickname},{chatDataNum}条消息\n' #消息格式 - dialectlist_string_suffix_format: str = '你们的职业是水群吗?————MYX\n计算花费时间:{timeCost}秒' #消息后缀格式 + dialectlist_string_format: str = '第{index}名:\n{nickname},{chatdatanum}条消息\n' #消息格式 + dialectlist_string_suffix_format: Optional[str] = '你们的职业是水群吗?————MYX\n计算花费时间:{timecost}秒' #消息后缀格式 dialectlist_get_num:int = 10 #获取人数数量 dialectlist_visualization:bool = True #是否可视化 dialectlist_visualization_type:Literal['饼图','圆环图','柱状图'] = '圆环图' #可视化方案 diff --git a/nonebot_plugin_dialectlist/function.py b/nonebot_plugin_dialectlist/function.py index 227dc7b..b7e52d9 100644 --- a/nonebot_plugin_dialectlist/function.py +++ b/nonebot_plugin_dialectlist/function.py @@ -183,7 +183,7 @@ async def msg_list2msg( for i in range(got_num): index = i+1 nickname,chatdatanum = ranking[i] - str_example = plugin_config.dialectlist_string_format.format(index=index,nickname=nickname,chatDataNum=chatdatanum) + str_example = plugin_config.dialectlist_string_format.format(index=index,nickname=nickname,chatdatanum=chatdatanum) out = out + str_example logger.debug(out)