临时调整权限模块,备份
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Dict, Any, List, Optional, Tuple
|
||||
from base.plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from base.plugin_common.plugin_interface import PluginStatus
|
||||
from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
from utils.robot_cmd.robot_command import GroupBotManager
|
||||
from utils.robot_cmd.robot_command import GroupBotManager, PermissionStatus
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
from wechat_ipad import WechatAPIClient
|
||||
|
||||
@@ -13,6 +13,10 @@ from wechat_ipad import WechatAPIClient
|
||||
class GroupAutoInvitePlugin(MessagePluginInterface):
|
||||
"""自动加群功能插件"""
|
||||
|
||||
# 功能权限常量
|
||||
FEATURE_KEY = "GROUP_AUTO_INVITE"
|
||||
FEATURE_DESCRIPTION = "🤝 自动加群功能 [#加群配置, #加群]"
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "自动加群功能"
|
||||
@@ -37,12 +41,22 @@ class GroupAutoInvitePlugin(MessagePluginInterface):
|
||||
def commands(self) -> List[str]:
|
||||
return self._commands
|
||||
|
||||
@property
|
||||
def feature_key(self) -> Optional[str]:
|
||||
return self.FEATURE_KEY
|
||||
|
||||
@property
|
||||
def feature_description(self) -> Optional[str]:
|
||||
return self.FEATURE_DESCRIPTION
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# Redis 中存储群组映射的前缀
|
||||
self.mapping_prefix = "group:group_mapping:"
|
||||
self._commands = []
|
||||
self.bot: WechatAPIClient = None
|
||||
# 注册功能权限
|
||||
self.feature = self.register_feature()
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -86,6 +100,9 @@ class GroupAutoInvitePlugin(MessagePluginInterface):
|
||||
content = str(message.get("content", "")).strip()
|
||||
roomid = message.get("roomid", "")
|
||||
|
||||
if GroupBotManager.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
|
||||
return False
|
||||
|
||||
# 处理加群配置命令
|
||||
if content.startswith("#加群配置|"):
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user