From f4a6acfbd4b7fce775a5f103cbe5fcb6d80750b9 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 14 Feb 2025 18:20:52 +0800 Subject: [PATCH] =?UTF-8?q?:adhesive=5Fbandage:=20API=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=9D=E5=A4=96=E9=94=99=E8=AF=AF=E6=8D=95?= =?UTF-8?q?=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/hooks/ban_hook.py | 8 +++++++- zhenxun/utils/decorator/retry.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/zhenxun/builtin_plugins/hooks/ban_hook.py b/zhenxun/builtin_plugins/hooks/ban_hook.py index d9030527..66dfb11c 100644 --- a/zhenxun/builtin_plugins/hooks/ban_hook.py +++ b/zhenxun/builtin_plugins/hooks/ban_hook.py @@ -29,6 +29,7 @@ _flmt = FreqLimiter(300) async def _( matcher: Matcher, bot: Bot, event: Event, state: T_State, session: EventSession ): + extra = {} if plugin := matcher.plugin: if metadata := plugin.metadata: extra = metadata.extra @@ -66,7 +67,12 @@ async def _( time_str = f"{hours} 小时 {minute}分钟" else: time_str = f"{minute} 分钟" - if time != -1 and ban_result and _flmt.check(user_id): + if ( + not extra.get("ignore_prompt") + and time != -1 + and ban_result + and _flmt.check(user_id) + ): _flmt.start_cd(user_id) await MessageUtils.build_message( [ diff --git a/zhenxun/utils/decorator/retry.py b/zhenxun/utils/decorator/retry.py index 2a6cc757..657cfa7b 100644 --- a/zhenxun/utils/decorator/retry.py +++ b/zhenxun/utils/decorator/retry.py @@ -1,3 +1,4 @@ +from anyio import EndOfStream from httpx import ConnectError, HTTPStatusError, TimeoutException from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed @@ -11,6 +12,6 @@ class Retry: stop=stop_after_attempt(3), wait=wait_fixed(1), retry=retry_if_exception_type( - (TimeoutException, ConnectError, HTTPStatusError) + (TimeoutException, ConnectError, HTTPStatusError, EndOfStream) ), )