tighten xiaoniu reply triggers for direct mentions only
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user