装饰器处理
This commit is contained in:
@@ -8,6 +8,7 @@ from message_summary.compress_chat_data import compress_chat_data
|
||||
from message_summary.markdown_to_image import convert_md_str_to_image
|
||||
from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
from plugins.stats_collector.decorators import plugin_stats_decorator
|
||||
from robot_cmd.robot_command import GroupBotManager, Feature, PermissionStatus
|
||||
|
||||
|
||||
@@ -40,8 +41,6 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# 在初始化时动态应用装饰器
|
||||
self.process_message = plugin_stats_decorator(plugin_name=self.name)(self.process_message)
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -73,6 +72,7 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
self.LOG.info(f"{self.name} 插件已停止")
|
||||
return True
|
||||
|
||||
@plugin_stats_decorator(plugin_name="群聊总结")
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
try:
|
||||
|
||||
@@ -40,8 +40,6 @@ class MusicPlugin(MessagePluginInterface):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# 在初始化时动态应用装饰器
|
||||
self.process_message = plugin_stats_decorator(plugin_name=self.name)(self.process_message)
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -82,6 +80,7 @@ class MusicPlugin(MessagePluginInterface):
|
||||
|
||||
return command in self._commands
|
||||
|
||||
@plugin_stats_decorator(plugin_name="音乐点播")
|
||||
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