mud_server.db.chat_repo
Chat repository operations for the SQLite backend.
This module isolates room/whisper chat persistence from the compatibility
facade in mud_server.db.database.
Functions
|
Insert a chat message row for room chat or whispers. |
|
Delete chat messages older than max_age_hours. |
|
Return recent room messages with whisper visibility filtering. |
Module Contents
- mud_server.db.chat_repo.add_chat_message(character_name, message, room, recipient_character_name=None, recipient=None, *, world_id)[source]
Insert a chat message row for room chat or whispers.
Compatibility behavior: -
recipientalias is still accepted and mapped torecipient_character_name.Sender and recipient names require explicit character identities.
- mud_server.db.chat_repo.prune_chat_messages(max_age_hours, *, world_id=None, room=None)[source]
Delete chat messages older than max_age_hours.
- Parameters:
- Returns:
Number of rows deleted.
- Raises:
ValueError – If max_age_hours < 1 or room is provided without world_id.
DatabaseWriteError – On SQLite failure.
- Return type:
- mud_server.db.chat_repo.get_room_messages(room, *, limit=50, character_name=None, username=None, world_id)[source]
Return recent room messages with whisper visibility filtering.
When a character identity is provided, this returns: - public messages in the room, - whispers to that character, - whispers sent by that character.