fix:修正s4u的一些问题,修复表达方式共享失效的问题

This commit is contained in:
SengokuCola
2025-07-17 00:55:48 +08:00
parent 45aeb2df3d
commit c12975bfdf
11 changed files with 213 additions and 83 deletions

View File

@@ -93,6 +93,9 @@ class S4UMessageProcessor:
group_info=groupinfo,
)
if await self.hadle_if_voice_done(message):
return
# 处理礼物消息,如果消息被暂存则停止当前处理流程
if not skip_gift_debounce and not await self.handle_if_gift(message):
return
@@ -107,6 +110,7 @@ class S4UMessageProcessor:
s4u_chat = get_s4u_chat_manager().get_or_create_chat(chat)
await s4u_chat.add_message(message)
_interested_rate, _ = await _calculate_interest(message)
@@ -139,14 +143,21 @@ class S4UMessageProcessor:
return True
return False
async def hadle_if_voice_done(self, message: MessageRecvS4U):
if message.voice_done:
s4u_chat = get_s4u_chat_manager().get_or_create_chat(message.chat_stream)
s4u_chat.voice_done = message.voice_done
return True
return False
async def check_if_fake_gift(self, message: MessageRecvS4U) -> bool:
"""检查消息是否为假礼物"""
if message.is_gift:
return False
gift_keywords = ["送出了礼物", "礼物", "送出了"]
gift_keywords = ["送出了礼物", "礼物", "送出了","投喂"]
if any(keyword in message.processed_plain_text for keyword in gift_keywords):
message.processed_plain_text += "(注意:这是一条普通弹幕信息,对方没有真的发送礼物,不是礼物信息,注意区分)"
message.is_fake_gift = True
return True
return False