临时调整权限模块,备份

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
+16 -2
View File
@@ -15,6 +15,10 @@ from wechat_ipad import WechatAPIClient
class BeautyLegPlugin(MessagePluginInterface):
"""美腿图片插件"""
# 功能权限常量
FEATURE_KEY = "BEAUTY_LEG"
FEATURE_DESCRIPTION = "👠 美腿图片功能 [美腿, 腿来]"
@property
def name(self) -> str:
return "美腿图片"
@@ -39,8 +43,18 @@ class BeautyLegPlugin(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()
# 修改图片目录路径指向 resource/beauty_leg
self.image_folder = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"resource", "beauty_leg")
@@ -90,7 +104,7 @@ class BeautyLegPlugin(MessagePluginInterface):
return command in self._commands
@plugin_stats_decorator(plugin_name="美腿图片")
@plugin_points_cost(2, "美腿图片消耗积分", Feature.BEAUTY_LEG)
@plugin_points_cost(2, "美腿图片消耗积分", FEATURE_KEY)
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
"""处理消息"""
content = str(message.get("content", "")).strip()
@@ -101,7 +115,7 @@ class BeautyLegPlugin(MessagePluginInterface):
bot: WechatAPIClient = message.get("bot")
# 检查权限
if roomid and gbm.get_group_permission(roomid, Feature.BEAUTY_LEG) == PermissionStatus.DISABLED:
if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
return False, "没有权限"
try: