From 833e266a1f95ae91034795b8835a17675fab5eb7 Mon Sep 17 00:00:00 2001 From: yajiwa <839790708@qq.com> Date: Wed, 6 Jul 2022 04:59:54 +0800 Subject: [PATCH 1/4] update wbtop --- plugins/wbtop/__init__.py | 42 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/plugins/wbtop/__init__.py b/plugins/wbtop/__init__.py index 34eb2ba4..f6a13cf6 100644 --- a/plugins/wbtop/__init__.py +++ b/plugins/wbtop/__init__.py @@ -40,28 +40,30 @@ wbtop_data = [] async def _(event: MessageEvent, arg: Message = CommandArg()): global wbtop_data msg = arg.extract_plain_text().strip() - if not wbtop_data or not msg: - if wbtop_data: - now_time = datetime.datetime.now() - if now_time > wbtop_data["time"] + datetime.timedelta(minutes=5): - data, code = await get_wbtop(wbtop_url) - if code != 200: - await wbtop.finish(data, at_sender=True) - wbtop_data = data - else: + if wbtop_data: + now_time = datetime.datetime.now() + if now_time > wbtop_data["time"] + datetime.timedelta(minutes=5): data, code = await get_wbtop(wbtop_url) if code != 200: await wbtop.finish(data, at_sender=True) + else: + wbtop_data = data + else: + data, code = await get_wbtop(wbtop_url) + if code != 200: + await wbtop.finish(data, at_sender=True) + else: wbtop_data = data - if not msg: - img = await asyncio.get_event_loop().run_in_executor( - None, gen_wbtop_pic, wbtop_data["data"] - ) - await wbtop.send(img) - logger.info( - f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})" - f" 查询微博热搜" - ) + + if not msg: + img = await asyncio.get_event_loop().run_in_executor( + None, gen_wbtop_pic, wbtop_data["data"] + ) + await wbtop.send(img) + logger.info( + f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})" + f" 查询微博热搜" + ) if is_number(msg) and 0 < int(msg) <= 50: url = wbtop_data["data"][int(msg) - 1]["url"] await wbtop.send("开始截取数据...") @@ -72,7 +74,7 @@ async def _(event: MessageEvent, arg: Message = CommandArg()): wait_time=12 ) if img: - await wbtop.send(img) + await wbtop.finish(img) else: - await wbtop.send("发生了一些错误.....") + await wbtop.finish("发生了一些错误.....") From 5794c82a2d0854bd7e742789cb5f551bda6d2ec4 Mon Sep 17 00:00:00 2001 From: yajiwa <839790708@qq.com> Date: Thu, 28 Jul 2022 16:48:45 +0800 Subject: [PATCH 2/4] update coser --- plugins/coser/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/coser/__init__.py b/plugins/coser/__init__.py index 5d44b0f5..1b35fc82 100755 --- a/plugins/coser/__init__.py +++ b/plugins/coser/__init__.py @@ -1,6 +1,6 @@ from typing import Tuple, Any -from nonebot import on_regex +from nonebot import on_regex, on_command from nonebot.params import RegexGroup from nonebot.typing import T_State from nonebot.adapters.onebot.v11 import Bot, MessageEvent @@ -36,10 +36,11 @@ __plugin_configs__ = { }, } -coser = on_regex(r"^(\d)连?(cos|COS|coser|括丝)$", priority=5, block=True) +coser = on_regex(r"^(\d?)连?(cos|COS|coser|括丝)$", priority=5, block=True) - -url = "https://api.iyk0.com/cos" +# 纯cos,较慢:https://picture.yinux.workers.dev +# 比较杂,有福利姬,较快:https://api.jrsgslb.cn/cos/url.php?return=img +url = "https://picture.yinux.workers.dev/" @coser.handle() From db39612c54a751c18f588e086f062c173f641a80 Mon Sep 17 00:00:00 2001 From: yajiwa <839790708@qq.com> Date: Thu, 28 Jul 2022 16:49:28 +0800 Subject: [PATCH 3/4] update bt --- plugins/bt/data_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bt/data_source.py b/plugins/bt/data_source.py index 5984e8fb..8644cfd0 100755 --- a/plugins/bt/data_source.py +++ b/plugins/bt/data_source.py @@ -9,7 +9,7 @@ import platform # asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -url = "http://www.eclzz.zone/" +url = "http://www.eclzz.plus" async def get_bt_info(keyword: str, page: int): From 9189fd411ef51771f35a18c557f20bc168332dfa Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:50:21 +0800 Subject: [PATCH 4/4] Update __init__.py --- plugins/coser/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coser/__init__.py b/plugins/coser/__init__.py index 1b35fc82..cb8c98ff 100755 --- a/plugins/coser/__init__.py +++ b/plugins/coser/__init__.py @@ -1,6 +1,6 @@ from typing import Tuple, Any -from nonebot import on_regex, on_command +from nonebot import on_regex from nonebot.params import RegexGroup from nonebot.typing import T_State from nonebot.adapters.onebot.v11 import Bot, MessageEvent