From 133616655fd7bf39f0eea422b5057612cb3cccaa Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Tue, 4 Aug 2020 23:58:43 +0800 Subject: =?UTF-8?q?[Fix]=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/hbook.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ATRI/plugins/hbook.py') diff --git a/ATRI/plugins/hbook.py b/ATRI/plugins/hbook.py index b0733f8..d1a79bc 100644 --- a/ATRI/plugins/hbook.py +++ b/ATRI/plugins/hbook.py @@ -1,5 +1,6 @@ # -*- coding:utf-8 -*- import re +import time import json from nonebot import on_command, CommandSession @@ -8,10 +9,11 @@ from ATRI.modules import response # type: ignore @on_command('hbook', aliases = ['本子', '本子搜索', '本子查询'], only_to_me = False) async def _(session: CommandSession): - with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f: + with open('ATRI/plugins/switch/switch.json', 'r') as f: data = json.load(f) if data["hbook"] == 0: + start = time.perf_counter() h_msg = session.current_arg.strip() if not h_msg: @@ -50,6 +52,10 @@ async def _(session: CommandSession): for i in range(n): msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i])) msg += msg0 + end = time.perf_counter() + msg0 = f'\n——————————\n耗时: {round(end - start, 3)}s' + msg += msg0 + await session.send(message=msg) else: -- cgit v1.2.3