855 协议版本-调整完毕内容
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
from typing import Dict, Any, Tuple, Optional, List
|
||||
from plugin_common.plugin_interface import PluginInterface
|
||||
|
||||
|
||||
class MessagePluginInterface(PluginInterface):
|
||||
"""消息处理插件接口"""
|
||||
|
||||
|
||||
@property
|
||||
def command_prefix(self) -> Optional[str]:
|
||||
"""命令前缀,如 '/'"""
|
||||
return None
|
||||
|
||||
|
||||
@property
|
||||
def commands(self) -> List[str]:
|
||||
"""支持的命令列表"""
|
||||
return []
|
||||
|
||||
|
||||
def can_process(self, message: Dict[str, Any]) -> bool:
|
||||
"""
|
||||
检查插件是否可以处理该消息
|
||||
@@ -31,7 +32,7 @@ class MessagePluginInterface(PluginInterface):
|
||||
command = content[len(self.command_prefix):].split()[0]
|
||||
return command in self.commands
|
||||
return False
|
||||
|
||||
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""
|
||||
处理消息
|
||||
@@ -44,4 +45,4 @@ class MessagePluginInterface(PluginInterface):
|
||||
Returns:
|
||||
(是否已处理, 处理结果)
|
||||
"""
|
||||
raise NotImplementedError("子类必须实现此方法")
|
||||
raise NotImplementedError("子类必须实现此方法")
|
||||
|
||||
Reference in New Issue
Block a user