tools.set_conversation_choices module
Structured flavor-choice buttons for normal conversation (non-game).
Stores choice rows in Redis for the Discord send pipeline. Unlike
set_game_choices, this does not touch game session state or the
game:choices: Redis key.
- async tools.set_conversation_choices.run(choices, ctx=None)[source]
Persist non-game flavor choices for the outbound Discord renderer.
Backs the
set_conversation_choicestool: it lets the bot attach a few gray secondary buttons under an ordinary chat reply without involving any game session or starting a countdown. Each incoming choice is validated – the list is capped at 10, the emoji is normalized against a unicode-emoji regex (with a fallback so a malformed emoji never blocks the button), and the label is truncated to 70 characters. The cleaned list is then stored as JSON under the per-channel Redis keyconversation:choices:{channel_id}with a 300-second TTL; a Redis failure is logged but does not fail the call. The outbound renderer ingame_ui/components.pylater reads that key (and deletes it after consuming) to draw the buttons, deliberately keeping it separate from thegame:choices:key used byset_game_choices.Registered via this module’s
TOOL_NAME/TOOL_DESCRIPTION/TOOL_PARAMETERSmetadata and exposed as the module-levelrunhandler; dispatched by name from the inference worker’s tool loop, not called directly elsewhere in the repo.- Parameters:
- Return type:
- Returns:
A JSON string with
successtrue, the keptchoices_count, and an instruction note, or a JSON error object when there is no context, no input, or nothing survives validation.