tighten xiaoniu reply triggers for direct mentions only

This commit is contained in:
liuwei
2026-04-07 11:50:30 +08:00
parent 8476149a2d
commit d6abb1cc23
2 changed files with 17 additions and 1 deletions
+8
View File
@@ -124,6 +124,8 @@ class AIAutoResponsePlugin(MessagePluginInterface):
return False
if self._should_ignore(content):
return False
if self._is_targeting_other_user(message):
return False
return True
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
@@ -299,6 +301,12 @@ class AIAutoResponsePlugin(MessagePluginInterface):
return True
return any(content.startswith(prefix) for prefix in self.filters.get("ignore_prefixes", []))
def _is_targeting_other_user(self, message: Dict[str, Any]) -> bool:
if message.get("is_at", False):
return False
raw_content = str(message.get("content", "") or "")
return "@" in raw_content
def _get_sender_name(self, room_id: str, sender: str) -> str:
try:
members = ContactManager.get_instance().get_group_members(room_id)