Files
QQbot/tests/test_message_dedup.py
Mimikko-zeus a754e7843f Refactor configuration and enhance AI capabilities
Updated .env.example to improve clarity and added new configuration options for memory and reliability settings. Refactored main.py to streamline the bot's entry point and improved error handling. Enhanced README to reflect new features and command structure. Removed deprecated cmd_zip_skill and skills_creator modules to clean up the codebase. Updated AIClient and MemorySystem for better performance and flexibility in handling user interactions.
2026-03-03 21:56:33 +08:00

23 lines
808 B
Python

from types import SimpleNamespace
from src.handlers.message_handler_ai import MessageHandler
def _build_handler() -> MessageHandler:
fake_bot = SimpleNamespace(robot=SimpleNamespace(id="bot_1", name="TestBot"))
return MessageHandler(fake_bot)
def test_message_dedup_by_message_id():
handler = _build_handler()
msg = SimpleNamespace(id="m1", content="hello", author=SimpleNamespace(id="u1"))
assert handler._is_duplicate_message(msg) is False
assert handler._is_duplicate_message(msg) is True
def test_message_dedup_fallback_without_message_id():
handler = _build_handler()
msg = SimpleNamespace(content="hello", author=SimpleNamespace(id="u1"), group_id="g1")
assert handler._is_duplicate_message(msg) is False
assert handler._is_duplicate_message(msg) is True