tools.wipe_game_data moduleο
Wipe all game data for a channel β session, history, memories, assets.
# ππ₯ NUCLEAR GAME RESET
- async tools.wipe_game_data.run(confirm=False, ctx=None, **_kw)[source]ο
Irreversibly wipe every trace of game state for the current channel.
Admin-only nuclear reset used to recover a channel whose game data was corrupted by an older version or when the user explicitly wants a clean slate. It tears down the in-memory session, the persisted Redis session and history, and the gameβs memories, assets and index entry in one pass, requiring an explicit
confirm=Trueso it cannot fire by accident.Interactions: gates on
tools.alter_privileges.has_privilegewith theUNSANDBOXED_EXECprivilege (readingctx.redis,ctx.configandctx.user_id). Resolves the channel fromctx.channel_idand a Redis client fromctx.redis(falling back toctx.config.redis). Callsgame_session.get_session/game_session.remove_sessionto drop the live session, then deletes the Redis keysgame:session:{channel_id}and its:historycompanion, thegame:mem:basic:{game_id},game:mem:channel:{game_id}andgame:assets:{game_id}keys, and thegame_idfield of thegame:indexhash. Logs a summary line on completion. Per-step errors are collected rather than aborting the wipe.Called by the tool-dispatch layer:
tool_loader.pyregisters this module via itsTOOL_NAME/runcontract and the registry invokesrunwith the parsed arguments andctx; there are no direct internal callers.- Parameters:
- Returns:
A JSON string. On success
{"success": True, "channel_id": ..., "game_id": ..., "game_name": ..., "deleted": [...]}(plus anerrorslist when any individual step failed). On refusal or setup problems an{"error": ...}/{"success": False, "error": ...}object (missing context, missing privilege, unsetconfirm, missingchannel_id, or no Redis connection).- Return type: