Commit graph

1 commit

Author SHA1 Message Date
BruceChen
967f67190c Add FileInputBot for non-interactive debugging and fix NbtToString crash
FileInputBot (ChatBots/FileInputBot.cs):
- New ChatBot that monitors a text file (default: mcc_input.txt) for
  commands, enabling MCC control from Cursor Shell or any non-interactive
  environment where stdin is not available
- Activated by setting MCC_FILE_INPUT env var (e.g. MCC_FILE_INPUT=1)
- Polls every ~500ms for new lines appended to the file
- Lines starting with "/" are sent as server chat/commands
- Other lines are executed as MCC internal commands (same as console input)
- File path overridable via MCC_INPUT_FILE env var

McClient.cs:
- Load FileInputBot when MCC_FILE_INPUT environment variable is set

ChatParser.cs - NbtToString:
- Fix InvalidCastException when NBT "text" or nameless root tag values
  are Int32 instead of String (happens with 1.20.6 SystemChat packets
  containing numeric values in the chat component tree)
- Replace direct (string) casts with ?.ToString() ?? string.Empty

Made-with: Cursor
2026-03-19 00:45:51 +08:00