mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-09 13:50:00 +08:00
bugfix:修复notice事件扩散问题 (#2132)
* bugfix:修复notice事件扩散问题 * 优化并发调度 * bugfix:修复签到样式 * bugfix:功能调用统计修复 * bugfix:修复私聊时功能调用统计显示已退群问题 * 提高插件适配兼容性 * 优化发送队列 * 修改权限检查设计 * 继续修改权限检查设计 * 完善权限检查设计 * 优化sqlite配置 * 优化数据库初始化 * 代码整理,无用代码清理 * bugfix:修复启动时数据库校验问题 * bugfix:修复预算裁剪过于激进问题
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import contextlib
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot_plugin_alconna import UniMsg
|
||||
@@ -31,6 +31,9 @@ EVENT_CACHE = (
|
||||
else None
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from zhenxun.builtin_plugins.hooks.auth_side_effect import SideEffectCommit
|
||||
|
||||
|
||||
@dataclass
|
||||
class EventContext:
|
||||
@@ -62,6 +65,7 @@ class EventContext:
|
||||
class PermissionSideEffectCache:
|
||||
auth_results: dict[str, tuple[bool, str | None]] = field(default_factory=dict)
|
||||
module_locks: dict[str, asyncio.Lock] = field(default_factory=dict)
|
||||
commits: dict[str, "SideEffectCommit"] = field(default_factory=dict)
|
||||
|
||||
def lock_for(self, module: str) -> asyncio.Lock:
|
||||
lock = self.module_locks.get(module)
|
||||
|
||||
Reference in New Issue
Block a user