This commit is contained in:
Windpicker-owo
2025-09-09 14:54:30 +08:00
parent cb41a98fc2
commit 460a1319ce
2 changed files with 4 additions and 23 deletions

3
.gitignore vendored
View File

@@ -338,3 +338,6 @@ MaiBot.code-workspace
.kilocode/rules/MoFox.md .kilocode/rules/MoFox.md
src/chat/planner_actions/planner (2).py src/chat/planner_actions/planner (2).py
rust_video/Cargo.lock rust_video/Cargo.lock
.claude/settings.local.json
package-lock.json
package.json

View File

@@ -8,7 +8,7 @@ from typing import Tuple, Optional, List
import re import re
from src.common.logger import get_logger from src.common.logger import get_logger
from src.plugin_system.base.component_types import CommandInfo, PlusCommandInfo, ComponentType, ChatType from src.plugin_system.base.component_types import PlusCommandInfo, ComponentType, ChatType
from src.chat.message_receive.message import MessageRecv from src.chat.message_receive.message import MessageRecv
from src.plugin_system.apis import send_api from src.plugin_system.apis import send_api
from src.plugin_system.base.command_args import CommandArgs from src.plugin_system.base.command_args import CommandArgs
@@ -288,28 +288,6 @@ class PlusCommand(ABC):
return await send_api.image_to_stream(image_base64, chat_stream.stream_id) return await send_api.image_to_stream(image_base64, chat_stream.stream_id)
@classmethod
def get_command_info(cls) -> "CommandInfo":
"""从类属性生成CommandInfo
Returns:
CommandInfo: 生成的命令信息对象
"""
if "." in cls.command_name:
logger.error(f"命令名称 '{cls.command_name}' 包含非法字符 '.',请使用下划线替代")
raise ValueError(f"命令名称 '{cls.command_name}' 包含非法字符 '.',请使用下划线替代")
# 生成正则表达式模式来匹配命令
command_pattern = cls._generate_command_pattern()
return CommandInfo(
name=cls.command_name,
component_type=ComponentType.COMMAND,
description=cls.command_description,
command_pattern=command_pattern,
chat_type_allow=getattr(cls, "chat_type_allow", ChatType.ALL),
)
@classmethod @classmethod
def get_plus_command_info(cls) -> "PlusCommandInfo": def get_plus_command_info(cls) -> "PlusCommandInfo":
"""从类属性生成PlusCommandInfo """从类属性生成PlusCommandInfo