临时调整权限模块,备份
This commit is contained in:
@@ -24,6 +24,10 @@ from wechat_ipad import WechatAPIClient
|
||||
class MessageSummaryPlugin(MessagePluginInterface):
|
||||
"""消息总结插件,用于生成群聊消息总结"""
|
||||
|
||||
# 功能权限常量
|
||||
FEATURE_KEY = "SUMMARY_CAPABILITY"
|
||||
FEATURE_DESCRIPTION = "📝 群聊总结功能 [总结]"
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "群聊总结"
|
||||
@@ -46,12 +50,24 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
|
||||
@property
|
||||
def commands(self) -> List[str]:
|
||||
return ["总结", "summary"]
|
||||
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.bot: WechatAPIClient = None
|
||||
self.revoke: MessageAutoRevoke = None
|
||||
self._commands = []
|
||||
self.message_storage = None
|
||||
self.revoke = None
|
||||
self.bot = None
|
||||
# 注册功能权限
|
||||
self.feature = self.register_feature()
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -242,3 +258,14 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
except Exception as e:
|
||||
self.LOG.error(f"处理总结时出现未知错误: {e}")
|
||||
return f"生成总结时出现未知错误: {str(e)}", None
|
||||
|
||||
def can_process(self, message: Dict[str, Any]) -> bool:
|
||||
"""检查是否可以处理该消息"""
|
||||
if not self.enable:
|
||||
return False
|
||||
|
||||
content = str(message.get("content", "")).strip()
|
||||
roomid = message.get("roomid", "")
|
||||
|
||||
if GroupBotManager.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user