diff options
Diffstat (limited to 'ATRI/plugins/rich/__init__.py')
-rw-r--r-- | ATRI/plugins/rich/__init__.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ATRI/plugins/rich/__init__.py b/ATRI/plugins/rich/__init__.py index 6bea2ff..d20a234 100644 --- a/ATRI/plugins/rich/__init__.py +++ b/ATRI/plugins/rich/__init__.py @@ -5,19 +5,36 @@ from aiohttp.client import ClientSession from nonebot.adapters.cqhttp import Bot, MessageEvent from nonebot.plugin import on_message -from ATRI.rule import is_in_banlist, is_in_dormant from ATRI.utils.request import get_bytes +from ATRI.utils.list import count_list, del_list_aim +from ATRI.rule import ( + is_in_banlist, + is_in_dormant, +) + from .data_source import dec + +waiting_list = [] + + bilibili_rich = on_message( rule=is_in_banlist() & is_in_dormant() ) @bilibili_rich.handle() async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: + global waiting_list msg = str(event.raw_message) + user = event.user_id bv = False + if count_list(waiting_list, user) == 5: + waiting_list = del_list_aim(waiting_list, user) + return + + waiting_list.append(user) + if "qqdocurl" not in msg: if "av" in msg: av = re.findall(r"(av\d+)", msg)[0].replace('av', '') @@ -58,4 +75,3 @@ async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: "にまねげぴのTencent rich!" ) await bilibili_rich.finish(repo) -
\ No newline at end of file |