修复Action没有reply_to_message的问题
This commit is contained in:
@@ -273,6 +273,29 @@ class PersonInfo(BaseModel):
|
||||
table_name = "person_info"
|
||||
|
||||
|
||||
class GroupInfo(BaseModel):
|
||||
"""
|
||||
用于存储群组信息数据的模型。
|
||||
"""
|
||||
|
||||
group_id = TextField(unique=True, index=True) # 群组唯一ID
|
||||
group_name = TextField(null=True) # 群组名称 (允许为空)
|
||||
platform = TextField() # 平台
|
||||
group_number = TextField(index=True) # 群号
|
||||
group_impression = TextField(null=True) # 群组印象
|
||||
short_impression = TextField(null=True) # 群组印象的简短描述
|
||||
member_list = TextField(null=True) # 群成员列表 (JSON格式)
|
||||
group_info = TextField(null=True) # 群组基本信息
|
||||
|
||||
create_time = FloatField(null=True) # 创建时间 (时间戳)
|
||||
last_active = FloatField(null=True) # 最后活跃时间
|
||||
member_count = IntegerField(null=True, default=0) # 成员数量
|
||||
|
||||
class Meta:
|
||||
# database = db # 继承自 BaseModel
|
||||
table_name = "group_info"
|
||||
|
||||
|
||||
class Memory(BaseModel):
|
||||
memory_id = TextField(index=True)
|
||||
chat_id = TextField(null=True)
|
||||
|
||||
@@ -236,7 +236,7 @@ async def text_to_stream(
|
||||
)
|
||||
|
||||
|
||||
async def emoji_to_stream(emoji_base64: str, stream_id: str, storage_message: bool = True, set_reply: bool = False) -> bool:
|
||||
async def emoji_to_stream(emoji_base64: str, stream_id: str, storage_message: bool = True, set_reply: bool = False,reply_to_message: Optional[Dict[str, Any]] = None) -> bool:
|
||||
"""向指定流发送表情包
|
||||
|
||||
Args:
|
||||
@@ -247,10 +247,10 @@ async def emoji_to_stream(emoji_base64: str, stream_id: str, storage_message: bo
|
||||
Returns:
|
||||
bool: 是否发送成功
|
||||
"""
|
||||
return await _send_to_target("emoji", emoji_base64, stream_id, "", typing=False, storage_message=storage_message, set_reply=set_reply)
|
||||
return await _send_to_target("emoji", emoji_base64, stream_id, "", typing=False, storage_message=storage_message, set_reply=set_reply,reply_to_message=reply_to_message)
|
||||
|
||||
|
||||
async def image_to_stream(image_base64: str, stream_id: str, storage_message: bool = True, set_reply: bool = False) -> bool:
|
||||
async def image_to_stream(image_base64: str, stream_id: str, storage_message: bool = True, set_reply: bool = False,reply_to_message: Optional[Dict[str, Any]] = None) -> bool:
|
||||
"""向指定流发送图片
|
||||
|
||||
Args:
|
||||
@@ -261,11 +261,11 @@ async def image_to_stream(image_base64: str, stream_id: str, storage_message: bo
|
||||
Returns:
|
||||
bool: 是否发送成功
|
||||
"""
|
||||
return await _send_to_target("image", image_base64, stream_id, "", typing=False, storage_message=storage_message, set_reply=set_reply)
|
||||
return await _send_to_target("image", image_base64, stream_id, "", typing=False, storage_message=storage_message, set_reply=set_reply,reply_to_message=reply_to_message)
|
||||
|
||||
|
||||
async def command_to_stream(
|
||||
command: Union[str, dict], stream_id: str, storage_message: bool = True, display_message: str = "", set_reply: bool = False
|
||||
command: Union[str, dict], stream_id: str, storage_message: bool = True, display_message: str = "", set_reply: bool = False,reply_to_message: Optional[Dict[str, Any]] = None
|
||||
) -> bool:
|
||||
"""向指定流发送命令
|
||||
|
||||
@@ -278,7 +278,7 @@ async def command_to_stream(
|
||||
bool: 是否发送成功
|
||||
"""
|
||||
return await _send_to_target(
|
||||
"command", command, stream_id, display_message, typing=False, storage_message=storage_message, set_reply=set_reply
|
||||
"command", command, stream_id, display_message, typing=False, storage_message=storage_message, set_reply=set_reply,reply_to_message=reply_to_message
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ class BaseAction(ABC):
|
||||
stream_id=self.chat_id,
|
||||
reply_to=reply_to,
|
||||
typing=typing,
|
||||
reply_to_message=self.action_message,
|
||||
)
|
||||
|
||||
async def send_emoji(self, emoji_base64: str) -> bool:
|
||||
@@ -243,7 +244,7 @@ class BaseAction(ABC):
|
||||
logger.error(f"{self.log_prefix} 缺少聊天ID")
|
||||
return False
|
||||
|
||||
return await send_api.emoji_to_stream(emoji_base64, self.chat_id)
|
||||
return await send_api.emoji_to_stream(emoji_base64, self.chat_id,reply_to_message=self.action_message)
|
||||
|
||||
async def send_image(self, image_base64: str) -> bool:
|
||||
"""发送图片
|
||||
@@ -258,7 +259,7 @@ class BaseAction(ABC):
|
||||
logger.error(f"{self.log_prefix} 缺少聊天ID")
|
||||
return False
|
||||
|
||||
return await send_api.image_to_stream(image_base64, self.chat_id)
|
||||
return await send_api.image_to_stream(image_base64, self.chat_id,reply_to_message=self.action_message)
|
||||
|
||||
async def send_custom(self, message_type: str, content: str, typing: bool = False, reply_to: str = "") -> bool:
|
||||
"""发送自定义类型消息
|
||||
@@ -282,6 +283,7 @@ class BaseAction(ABC):
|
||||
stream_id=self.chat_id,
|
||||
typing=typing,
|
||||
reply_to=reply_to,
|
||||
reply_to_message=self.action_message,
|
||||
)
|
||||
|
||||
async def store_action_info(
|
||||
@@ -336,6 +338,7 @@ class BaseAction(ABC):
|
||||
stream_id=self.chat_id,
|
||||
storage_message=storage_message,
|
||||
display_message=display_message,
|
||||
reply_to_message=self.action_message,
|
||||
)
|
||||
|
||||
if success:
|
||||
|
||||
@@ -100,7 +100,7 @@ class BaseCommand(ABC):
|
||||
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
|
||||
return False
|
||||
|
||||
return await send_api.text_to_stream(text=content, stream_id=chat_stream.stream_id, reply_to=reply_to)
|
||||
return await send_api.text_to_stream(text=content, stream_id=chat_stream.stream_id, reply_to=reply_to,reply_to_message=self.message)
|
||||
|
||||
async def send_type(
|
||||
self, message_type: str, content: str, display_message: str = "", typing: bool = False, reply_to: str = ""
|
||||
@@ -130,6 +130,7 @@ class BaseCommand(ABC):
|
||||
display_message=display_message,
|
||||
typing=typing,
|
||||
reply_to=reply_to,
|
||||
reply_to_message=self.message,
|
||||
)
|
||||
|
||||
async def send_command(
|
||||
@@ -161,6 +162,7 @@ class BaseCommand(ABC):
|
||||
stream_id=chat_stream.stream_id,
|
||||
storage_message=storage_message,
|
||||
display_message=display_message,
|
||||
reply_to_message=self.message,
|
||||
)
|
||||
|
||||
if success:
|
||||
@@ -188,7 +190,7 @@ class BaseCommand(ABC):
|
||||
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
|
||||
return False
|
||||
|
||||
return await send_api.emoji_to_stream(emoji_base64, chat_stream.stream_id)
|
||||
return await send_api.emoji_to_stream(emoji_base64, chat_stream.stream_id,reply_to_message=self.message)
|
||||
|
||||
async def send_image(self, image_base64: str) -> bool:
|
||||
"""发送图片
|
||||
@@ -204,7 +206,7 @@ class BaseCommand(ABC):
|
||||
logger.error(f"{self.log_prefix} 缺少聊天流或stream_id")
|
||||
return False
|
||||
|
||||
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,reply_to_message=self.message)
|
||||
|
||||
@classmethod
|
||||
def get_command_info(cls) -> "CommandInfo":
|
||||
|
||||
Reference in New Issue
Block a user