临时调整权限模块,备份

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

@@ -151,6 +151,10 @@ class QL:
class JDTokenPlugin(MessagePluginInterface):
"""京东签到Token设置插件"""
# 功能权限常量
FEATURE_KEY = "JD_TOKEN"
FEATURE_DESCRIPTION = "🔑 京东签到Token设置 [设置京东]"
@property
def name(self) -> str:
@@ -176,8 +180,18 @@ class JDTokenPlugin(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__()
# 注册功能权限
self.feature = self.register_feature()
def initialize(self, context: Dict[str, Any]) -> bool:
"""初始化插件"""
@@ -221,9 +235,12 @@ class JDTokenPlugin(MessagePluginInterface):
return False
content = str(message.get("content", "")).strip()
command = content.split(" ")[0]
roomid = message.get("roomid", "")
return command in self._commands
if GroupBotManager.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
return False
return True
@plugin_stats_decorator(plugin_name="京东签到Token设置")
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]: