测试auth动态化
This commit is contained in:
@@ -19,6 +19,10 @@ from wechat_ipad.models.appmsg_xml import MUSIC_XML
|
||||
class MusicPlugin(MessagePluginInterface):
|
||||
"""音乐点播插件"""
|
||||
|
||||
# 功能权限常量
|
||||
FEATURE_KEY = "MUSIC"
|
||||
FEATURE_DESCRIPTION = "🎵 点歌功能 [点歌, 音乐, 音乐点播, 点播音乐, 音乐点歌]"
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "音乐点播"
|
||||
@@ -45,6 +49,7 @@ class MusicPlugin(MessagePluginInterface):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.feature = self.register_feature()
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -84,7 +89,7 @@ class MusicPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="音乐点播")
|
||||
@plugin_points_cost(2, "音乐点播消耗积分", Feature.MUSIC)
|
||||
@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()
|
||||
@@ -102,7 +107,7 @@ class MusicPlugin(MessagePluginInterface):
|
||||
return False, "命令格式错误"
|
||||
|
||||
# 检查权限
|
||||
if roomid and gbm.get_group_permission(roomid, Feature.MUSIC) == PermissionStatus.DISABLED:
|
||||
if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
|
||||
return False, "没有权限"
|
||||
|
||||
# 提取歌曲名
|
||||
|
||||
Reference in New Issue
Block a user