🤖 自动格式化代码 [skip ci]

This commit is contained in:
github-actions[bot]
2025-06-19 15:24:29 +00:00
parent d153887b8a
commit 2bc0451f62
4 changed files with 20 additions and 21 deletions

View File

@@ -1,7 +1,12 @@
from typing import List, Tuple, Type from typing import List, Tuple, Type
from src.plugin_system import ( from src.plugin_system import (
BasePlugin, register_plugin, BaseAction, BaseCommand, BasePlugin,
ComponentInfo, ActionActivationType, ConfigField register_plugin,
BaseAction,
BaseCommand,
ComponentInfo,
ActionActivationType,
ConfigField,
) )
# ===== Action组件 ===== # ===== Action组件 =====

View File

@@ -5,16 +5,16 @@
使用方式: 使用方式:
from src.plugin_system.apis import send_api from src.plugin_system.apis import send_api
# 方式1直接使用stream_id推荐 # 方式1直接使用stream_id推荐
await send_api.text_to_stream("hello", stream_id) await send_api.text_to_stream("hello", stream_id)
await send_api.emoji_to_stream(emoji_base64, stream_id) await send_api.emoji_to_stream(emoji_base64, stream_id)
await send_api.custom_to_stream("video", video_data, stream_id) await send_api.custom_to_stream("video", video_data, stream_id)
# 方式2使用群聊/私聊指定函数 # 方式2使用群聊/私聊指定函数
await send_api.text_to_group("hello", "123456") await send_api.text_to_group("hello", "123456")
await send_api.text_to_user("hello", "987654") await send_api.text_to_user("hello", "987654")
# 方式3使用通用custom_message函数 # 方式3使用通用custom_message函数
await send_api.custom_message("video", video_data, "123456", True) await send_api.custom_message("video", video_data, "123456", True)
""" """

View File

@@ -213,11 +213,7 @@ class BaseAction(ABC):
logger.error(f"{self.log_prefix} 缺少聊天ID") logger.error(f"{self.log_prefix} 缺少聊天ID")
return False return False
return await send_api.text_to_stream( return await send_api.text_to_stream(text=content, stream_id=self.chat_id, reply_to=reply_to)
text=content,
stream_id=self.chat_id,
reply_to=reply_to
)
async def send_emoji(self, emoji_base64: str) -> bool: async def send_emoji(self, emoji_base64: str) -> bool:
"""发送表情包 """发送表情包

View File

@@ -98,15 +98,11 @@ class BaseCommand(ABC):
""" """
# 获取聊天流信息 # 获取聊天流信息
chat_stream = self.message.chat_stream chat_stream = self.message.chat_stream
if not chat_stream or not hasattr(chat_stream, 'stream_id'): if not chat_stream or not hasattr(chat_stream, "stream_id"):
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id") logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
return False return False
return await send_api.text_to_stream( return await send_api.text_to_stream(text=content, stream_id=chat_stream.stream_id, reply_to=reply_to)
text=content,
stream_id=chat_stream.stream_id,
reply_to=reply_to
)
async def send_type( async def send_type(
self, message_type: str, content: str, display_message: str = "", typing: bool = False, reply_to: str = "" self, message_type: str, content: str, display_message: str = "", typing: bool = False, reply_to: str = ""
@@ -125,7 +121,7 @@ class BaseCommand(ABC):
""" """
# 获取聊天流信息 # 获取聊天流信息
chat_stream = self.message.chat_stream chat_stream = self.message.chat_stream
if not chat_stream or not hasattr(chat_stream, 'stream_id'): if not chat_stream or not hasattr(chat_stream, "stream_id"):
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id") logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
return False return False
@@ -138,7 +134,9 @@ class BaseCommand(ABC):
reply_to=reply_to, reply_to=reply_to,
) )
async def send_command(self, command_name: str, args: dict = None, display_message: str = "", storage_message: bool = True) -> bool: async def send_command(
self, command_name: str, args: dict = None, display_message: str = "", storage_message: bool = True
) -> bool:
"""发送命令消息 """发送命令消息
Args: Args:
@@ -153,7 +151,7 @@ class BaseCommand(ABC):
try: try:
# 获取聊天流信息 # 获取聊天流信息
chat_stream = self.message.chat_stream chat_stream = self.message.chat_stream
if not chat_stream or not hasattr(chat_stream, 'stream_id'): if not chat_stream or not hasattr(chat_stream, "stream_id"):
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id") logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
return False return False
@@ -187,7 +185,7 @@ class BaseCommand(ABC):
bool: 是否发送成功 bool: 是否发送成功
""" """
chat_stream = self.message.chat_stream chat_stream = self.message.chat_stream
if not chat_stream or not hasattr(chat_stream, 'stream_id'): if not chat_stream or not hasattr(chat_stream, "stream_id"):
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id") logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
return False return False
@@ -203,7 +201,7 @@ class BaseCommand(ABC):
bool: 是否发送成功 bool: 是否发送成功
""" """
chat_stream = self.message.chat_stream chat_stream = self.message.chat_stream
if not chat_stream or not hasattr(chat_stream, 'stream_id'): if not chat_stream or not hasattr(chat_stream, "stream_id"):
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id") logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
return False return False