fix:全面移除reply_to,并且非必须

This commit is contained in:
SengokuCola
2025-08-11 20:25:13 +08:00
parent 5299a6e628
commit bad2be2bdc
8 changed files with 66 additions and 95 deletions

View File

@@ -2,7 +2,7 @@ import time
import asyncio
from abc import ABC, abstractmethod
from typing import Tuple, Optional
from typing import Tuple, Optional, Dict, Any
from src.common.logger import get_logger
from src.chat.message_receive.chat_stream import ChatStream
@@ -208,7 +208,7 @@ class BaseAction(ABC):
return False, f"等待新消息失败: {str(e)}"
async def send_text(
self, content: str, reply_to: str = "", typing: bool = False
self, content: str, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None, typing: bool = False
) -> bool:
"""发送文本消息
@@ -226,12 +226,12 @@ class BaseAction(ABC):
return await send_api.text_to_stream(
text=content,
stream_id=self.chat_id,
reply_to=reply_to,
set_reply=set_reply,
reply_message=reply_message,
typing=typing,
reply_to_message=self.action_message,
)
async def send_emoji(self, emoji_base64: str) -> bool:
async def send_emoji(self, emoji_base64: str, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
"""发送表情包
Args:
@@ -244,9 +244,9 @@ class BaseAction(ABC):
logger.error(f"{self.log_prefix} 缺少聊天ID")
return False
return await send_api.emoji_to_stream(emoji_base64, self.chat_id,reply_to_message=self.action_message)
return await send_api.emoji_to_stream(emoji_base64, self.chat_id,set_reply=set_reply,reply_message=reply_message)
async def send_image(self, image_base64: str) -> bool:
async def send_image(self, image_base64: str, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
"""发送图片
Args:
@@ -259,9 +259,9 @@ class BaseAction(ABC):
logger.error(f"{self.log_prefix} 缺少聊天ID")
return False
return await send_api.image_to_stream(image_base64, self.chat_id,reply_to_message=self.action_message)
return await send_api.image_to_stream(image_base64, self.chat_id,set_reply=set_reply,reply_message=reply_message)
async def send_custom(self, message_type: str, content: str, typing: bool = False, reply_to: str = "") -> bool:
async def send_custom(self, message_type: str, content: str, typing: bool = False, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
"""发送自定义类型消息
Args:
@@ -282,8 +282,8 @@ class BaseAction(ABC):
content=content,
stream_id=self.chat_id,
typing=typing,
reply_to=reply_to,
reply_to_message=self.action_message,
set_reply=set_reply,
reply_message=reply_message,
)
async def store_action_info(
@@ -310,7 +310,7 @@ class BaseAction(ABC):
)
async def send_command(
self, command_name: str, args: Optional[dict] = None, display_message: str = "", storage_message: bool = True
self, command_name: str, args: Optional[dict] = None, display_message: str = "", storage_message: bool = True,set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None
) -> bool:
"""发送命令消息
@@ -338,7 +338,8 @@ class BaseAction(ABC):
stream_id=self.chat_id,
storage_message=storage_message,
display_message=display_message,
reply_to_message=self.action_message,
set_reply=set_reply,
reply_message=reply_message,
)
if success: