From cbf4900c5c3b1de65e55ce480d4b453091528e84 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sun, 11 Apr 2021 15:03:35 +0800 Subject: =?UTF-8?q?=F0=9F=9A=80=E2=9C=A8=E2=9A=A1=EF=B8=8F=F0=9F=8E=A8?= =?UTF-8?q?=F0=9F=90=9B=20=E6=AD=A3=E5=BC=8F=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/rich/__init__.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'ATRI/plugins/rich') diff --git a/ATRI/plugins/rich/__init__.py b/ATRI/plugins/rich/__init__.py index 8404da6..9d5d6a9 100644 --- a/ATRI/plugins/rich/__init__.py +++ b/ATRI/plugins/rich/__init__.py @@ -6,10 +6,6 @@ from nonebot.adapters.cqhttp import Bot, MessageEvent from ATRI.service import Service as sv from ATRI.utils.request import get_bytes from ATRI.utils.list import count_list, del_list_aim -from ATRI.rule import ( - is_block, - is_in_dormant, -) from .data_source import dec @@ -17,10 +13,7 @@ from .data_source import dec temp_list = [] -bilibili_rich = sv.on_message( - rule=is_block() & is_in_dormant() -) -sv.manual_reg_service("监听b站小程序") +bilibili_rich = sv.on_message() @bilibili_rich.handle() async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: @@ -30,7 +23,10 @@ async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: if "qqdocurl" not in msg: if "av" in msg: - av = re.findall(r"(av\d+)", msg)[0].replace('av', '') + try: + av = re.findall(r"(av\d+)", msg)[0].replace('av', '') + except: + return else: try: bv = re.findall(r"(BV\w+)", msg) @@ -49,7 +45,10 @@ async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: if not bv: if "av" in msg: - av = re.findall(r"(av\d+)", msg)[0].replace('av', '') + try: + av = re.findall(r"(av\d+)", msg)[0].replace('av', '') + except: + return else: return -- cgit v1.2.3