临时调整权限模块,备份

This commit is contained in:
liuwei
2025-06-09 14:12:31 +08:00
parent cedab1cefd
commit 9d15bf965b
30 changed files with 882 additions and 138 deletions

View File

@@ -37,6 +37,14 @@ class PluginManagerPlugin(MessagePluginInterface):
def commands(self) -> List[str]:
return self._commands
@property
def feature_key(self) -> Optional[str]:
return "PLUGIN_MANAGER"
@property
def feature_description(self) -> Optional[str]:
return "🔧 插件管理功能 [插件管理]"
def start(self) -> bool:
"""启动插件"""
self.LOG.info(f"[{self.name}] 插件已启动")
@@ -52,6 +60,8 @@ class PluginManagerPlugin(MessagePluginInterface):
def __init__(self):
super().__init__()
self.bot: WechatAPIClient = None
# 注册功能权限
self.feature = self.register_feature()
def initialize(self, context: Dict[str, Any]) -> bool:
"""初始化插件"""
@@ -93,6 +103,10 @@ class PluginManagerPlugin(MessagePluginInterface):
self.LOG.error("WechatAPIClient 未初始化")
return False, "Bot 未初始化"
# 检查功能权限
if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
return False, "没有权限"
# 检查命令格式
parts = content.split(" ")
if len(parts) == 1:
@@ -103,7 +117,7 @@ class PluginManagerPlugin(MessagePluginInterface):
self.plugin_registry = PluginRegistry()
self.plugin_manager = PluginManager().get_instance()
# 检查权限 (只允许管理员操作)
# 检查管理员权限
if not self._is_admin(sender, gbm):
await self.bot.send_at_message(target, f"❌权限不足,只有管理员可以管理插件", [sender])
return True, "权限不足"