zhenxun_bot/zhenxun/builtin_plugins/hooks/__init__.py
HibiKier e7f3c210df
修复并发时数据库超时 (#2063)
* 🔧 修复和优化:调整超时设置,重构检查逻辑,简化代码结构

- 在 `chkdsk_hook.py` 中重构 `check` 方法,提取公共逻辑
- 更新 `CacheManager` 中的超时设置,使用新的 `CACHE_TIMEOUT`
- 在 `utils.py` 中添加缓存逻辑,记录数据库操作的执行情况

*  feat(auth): 添加并发控制,优化权限检查逻辑

* Update utils.py

* 🚨 auto fix by pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-09 08:46:08 +08:00

72 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pathlib import Path
import nonebot
from zhenxun.configs.config import Config
Config.add_plugin_config(
"hook",
"CHECK_NOTICE_INFO_CD",
300,
help="群检测个人权限检测等各种检测提示信息cd",
default_value=300,
type=int,
)
Config.add_plugin_config(
"hook",
"MALICIOUS_BAN_TIME",
30,
help="恶意命令触发检测触发后ban的时长分钟",
default_value=30,
type=int,
)
Config.add_plugin_config(
"hook",
"MALICIOUS_CHECK_TIME",
5,
help="恶意命令触发检测规定时间内(秒)",
default_value=5,
type=int,
)
Config.add_plugin_config(
"hook",
"MALICIOUS_BAN_COUNT",
6,
help="恶意命令触发检测最大触发次数",
default_value=6,
type=int,
)
Config.add_plugin_config(
"hook",
"IS_SEND_TIP_MESSAGE",
True,
help="是否发送阻断时提示消息",
default_value=True,
type=bool,
)
Config.add_plugin_config(
"hook",
"RECORD_BOT_SENT_MESSAGES",
True,
help="记录bot消息发送",
default_value=True,
type=bool,
)
Config.add_plugin_config(
"hook",
"AUTH_HOOKS_CONCURRENCY_LIMIT",
5,
help="同步进入权限钩子最大并发数",
default_value=5,
type=int,
)
nonebot.load_plugins(str(Path(__file__).parent.resolve()))