临时调整权限模块,备份

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

@@ -19,6 +19,18 @@ import json
class GameTaskPlugin(MessagePluginInterface):
"""游戏任务插件"""
# 功能权限常量
FEATURE_KEY = "TASK_GAME"
FEATURE_DESCRIPTION = "🎮 百科问答功能 [/t, /a, /s, /r, /l, /h]"
@property
def feature_key(self) -> Optional[str]:
return self.FEATURE_KEY
@property
def feature_description(self) -> Optional[str]:
return self.FEATURE_DESCRIPTION
@property
def name(self) -> str:
return "百科问答"
@@ -46,6 +58,8 @@ class GameTaskPlugin(MessagePluginInterface):
def __init__(self):
super().__init__()
self.LOG = logger
# 注册功能权限
self.feature = self.register_feature()
async_job.at_times(["17:58"])(self.run_random_task_assignment)
def initialize(self, context: Dict[str, Any]) -> bool:
@@ -123,7 +137,7 @@ class GameTaskPlugin(MessagePluginInterface):
self.LOG.debug(f"插件执行: {self.name}{content}")
# 检查权限
if roomid and gbm.get_group_permission(roomid, Feature.TASK_GAME) == PermissionStatus.DISABLED:
if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
return False, "没有权限"
try: