fix: Update escape sequence documentation for consistency

- Revised `config.ini.example` and `README.md` to clarify the usage of escape sequences for newlines, changing from double backslashes (`\\n`) to single backslashes (`\n`).
- Enhanced comments in `CommandManager` and `GreeterCommand` to reflect the updated escape sequence behavior, ensuring accurate processing of newline characters and literal backslashes.
- Improved logging in `GreeterCommand` for better debugging of mesh info formatting.
This commit is contained in:
Adam Gessaman
2026-01-13 10:55:59 -08:00
parent 89ecc34ef6
commit c04ecd9ffd
4 changed files with 47 additions and 20 deletions
+6 -1
View File
@@ -181,7 +181,11 @@ class CommandManager:
"""Decode escape sequences in config strings.
Processes common escape sequences like \\n (newline), \\t (tab), \\\\ (backslash).
This allows users to add newlines in keyword responses using \\n.
This allows users to add newlines in keyword responses using \n (single backslash).
Behavior:
- \n in config file → newline character
- \\n in config file → literal backslash + n
Args:
text: The text string to process.
@@ -191,6 +195,7 @@ class CommandManager:
"""
# Replace escape sequences
# Order matters: \\ must be processed first to avoid double-processing
# This preserves literal backslashes (\\n becomes \n, not a newline)
text = text.replace('\\\\', '\x00') # Temporary placeholder for backslash
text = text.replace('\\n', '\n') # Newline
text = text.replace('\\t', '\t') # Tab