Description
Implement two new Discord slash commands to enhance user control over bot presence and session lifecycle:
-
/leave [target]
- Function: Instructs the bot to leave a thread.
- Parameters: An optional target parameter (Channel picker) to specify a different thread. If omitted, the bot leaves the current thread.
- Background Logic: Upon leaving, the bot should also clear its internal BotTurnTracker and session metadata for that specific thread to
ensure a clean slate if it's reinvited later.
-
/threads
- Function: Returns an ephemeral list of all active threads/sessions the bot is currently participating in within the current Server
(Guild).
- Benefit: Helps users discover where the bot is "working" and allows them to manage runaway sessions easily.
Use Case
-
Case 1: Resetting a Conversation
* User: "The bot is stuck in a loop or the context is too messy. I want it to start fresh."
* Action: User types /leave in the thread. The bot exits. User then mentions the bot in the main channel to start a brand new, clean thread.
-
Case 2: Remote Management
* User: "I know the bot is active in a private thread somewhere, but I can't remember which one."
* Action: User types /threads in any channel. The bot provides a list of links to active threads. User follows the link or uses /leave
target:#thread-name to shut it down remotely.
-
Case 3: Resource Optimization
* Admin: "The bot is hitting its maximum session limit."
* Action: Admin uses /threads to see idle or unnecessary active threads and uses /leave to free up session slots for other users.
Technical Notes
- Commands should be registered as Guild commands for immediate availability.
- Responses to these management commands should be ephemeral (only visible to the user) to avoid cluttering the chat.
- SessionPool needs a way to expose active keys filtered by the Discord platform and Guild ID.
Proposed Solution
No response
Description
Implement two new Discord slash commands to enhance user control over bot presence and session lifecycle:
/leave [target]
ensure a clean slate if it's reinvited later.
/threads
(Guild).
Use Case
Case 1: Resetting a Conversation
* User: "The bot is stuck in a loop or the context is too messy. I want it to start fresh."
* Action: User types /leave in the thread. The bot exits. User then mentions the bot in the main channel to start a brand new, clean thread.
Case 2: Remote Management
* User: "I know the bot is active in a private thread somewhere, but I can't remember which one."
* Action: User types /threads in any channel. The bot provides a list of links to active threads. User follows the link or uses /leave
target:#thread-name to shut it down remotely.
Case 3: Resource Optimization
* Admin: "The bot is hitting its maximum session limit."
* Action: Admin uses /threads to see idle or unnecessary active threads and uses /leave to free up session slots for other users.
Technical Notes
Proposed Solution
No response