加入权限判断
This commit is contained in:
@@ -42,8 +42,9 @@ class BeautyLegPlugin(MessagePluginInterface):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# 修改图片目录路径指向 resource/beauty_leg
|
||||
self.image_folder = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
|
||||
"beautyleg", "download_dir")
|
||||
"resource", "beauty_leg")
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -91,7 +92,7 @@ class BeautyLegPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="美腿图片")
|
||||
@plugin_points_cost(1, "美腿图片消耗积分")
|
||||
@plugin_points_cost(1, "美腿图片消耗积分", Feature.BEAUTY_LEG)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -104,7 +104,7 @@ class DifyPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="Dify聊天")
|
||||
@plugin_points_cost(2, "AI聊天消耗积分")
|
||||
@plugin_points_cost(2, "AI聊天消耗积分",Feature.AI_CAPABILITY)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -249,7 +249,7 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
sender
|
||||
)
|
||||
|
||||
@points_reward_decorator(calculate_game_points, "game", "百科答题奖励")
|
||||
@points_reward_decorator(calculate_game_points, "game", "百科答题奖励", Feature.TASK_GAME)
|
||||
def _handle_submit_answer(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理提交答案请求"""
|
||||
try:
|
||||
|
||||
@@ -180,7 +180,7 @@ class MessageSignPlugin(MessagePluginInterface):
|
||||
|
||||
# 修改process_message方法,使用装饰器
|
||||
@plugin_stats_decorator(plugin_name="签到系统")
|
||||
@points_reward_decorator(calculate_sign_in_points, "checkin", "每日签到奖励")
|
||||
@points_reward_decorator(calculate_sign_in_points, "checkin", "每日签到奖励",Feature.SIGNIN)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -74,7 +74,7 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
return True
|
||||
|
||||
@plugin_stats_decorator(plugin_name="群聊总结")
|
||||
@plugin_points_cost(10, "群聊总结消耗积分")
|
||||
@plugin_points_cost(10, "群聊总结消耗积分",Feature.SUMMARY_CAPABILITY)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
try:
|
||||
|
||||
@@ -82,7 +82,7 @@ class MusicPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="音乐点播")
|
||||
@plugin_points_cost(1, "音乐点播消耗积分")
|
||||
@plugin_points_cost(1, "音乐点播消耗积分", Feature.MUSIC)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -89,7 +89,7 @@ class VideoPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="视频插件")
|
||||
@plugin_points_cost(1, "视频插件消耗积分")
|
||||
@plugin_points_cost(1, "视频插件消耗积分", Feature.VIDEO)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -90,7 +90,7 @@ class VideoManPlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="猛男视频")
|
||||
@plugin_points_cost(1, "猛男视频消耗积分")
|
||||
@plugin_points_cost(1, "猛男视频消耗积分", Feature.VIDEO_MAN)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
@@ -88,7 +88,7 @@ class XiurenImagePlugin(MessagePluginInterface):
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="秀人图片")
|
||||
@plugin_points_cost(1, "秀人图片消耗积分")
|
||||
@plugin_points_cost(1, "秀人图片消耗积分", Feature.PIC)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
|
||||
Reference in New Issue
Block a user