Goodbye Tool
The <goodbye> tool is a specialized renderer that gives RapBotRito control over the user’s browser session. It displays a countdown and then forces a hard page reload.
Purpose & Strategic Role
This is not just a UI effect; it is a mechanism for enforcing consequences.
The RitoSwap chat modal is protected by a Token Gate. Access requires an active, “unused” Colored Key NFT. In high-stakes interactions—specifically Rap Battles—losing has a material cost:
- The Loss: If the user loses the battle, the chatbot calls an MCP tool to mark their NFT as “used” on-chain (or in the database).
- The Lockout: The chatbot immediately emits the
<goodbye>tag. - The Consequence: The page reloads. Because the user’s NFT is now marked “used,” the Token Gate rejects their re-entry. They are effectively locked out until they acquire a fresh key.
Usage
The bot emits this tag when it decides the conversation is over (usually after a defeat).
<!-- Default 10s countdown -->
<goodbye />
<!-- Custom duration and size -->
<goodbye seconds="5" width="400" />Architecture
The Renderer
File: dapp/components/chatBot/ChatMessages/renderers/GoodbyeRenderer.tsx
The component implements a “point of no return” logic:
- Irreversibility: Once mounted, it sets a
sessionStorageflag (ritoGoodbyeHardReloadAt) with the target timestamp. - Persistence: Even if the user tries to close the chat or unmount the component, the reload timer is checked against
sessionStorageon re-mount. - Hard Reload: It calls
window.location.reload(), which forces the app to re-run all authentication and token gate checks.
Related Systems
Understanding how the gate verifies NFT status on page load.
gateToken Gate Architecture(Coming Soon) The tool that updates the NFT status before the reload fires.
🛠️Mark Key Used (MCP)Security Note: This relies on client-side behavior for the experience, but the actual security comes from the Token Gate. The reload just forces the user to face the gate again. If they somehow blocked the reload, they would still be unable to perform any gated actions because their key is already invalidated on the backend.