OmegaBot can chat with users using an LLM (OpenAI or Anthropic Claude), with conversation memory so it remembers the last 20 messages per user. It is tuned for friendly, supportive catch-up style conversation, but it is not a therapist or crisis service. This doc explains how it works and how it’s stored.
- How to Chat
- Conversation Threads (Keys)
- Persistence (SQLite)
- History Limit & Trimming
- Clearing a Conversation ("New Chat")
- Chat Modes
- Supportive / Mental Health Guardrails
- LLM Provider & Env
- Message Content Intent (Discord)
- Summary
Users can start or continue a conversation in three ways:
- DM the bot – Any message you send the bot in a direct message is treated as chat. The bot replies in the same DM.
- @mention the bot in a channel – In a server channel, mention the bot (e.g.
@OmegaBot what’s the weather?). The bot replies in that channel. The part of your message after the mention is the prompt. Messages that include@everyoneor@hereare ignored so the bot does not join mass callouts. /fun utility chat– Slash command tools that use the same conversation thread as DM or @mention for that context (see below).
Common slash chat actions:
action:send– Normal message in the same threadaction:checkin– Ask the bot to lead a gentle emotional check-inaction:recap– Get a recap of saved context and recent turnsaction:remember– Save a note for future catch-ups in that conversationaction:forget– Clear saved context for that conversation
No slash command is required for normal chat; messaging the bot is enough.
Conversations are scoped so that:
- DMs – One thread per user. Key:
dm:<userId>. - Channels – One thread per user per channel. Key:
ch:<channelId>:<userId>.
So if you DM the bot, that’s one thread. If you @mention it in #general, that’s a separate thread for you in that channel. If you use /fun utility chat in #general, it uses the same thread as @mentioning the bot in #general.
Each conversation also has a lightweight profile with:
- preferred mode (
supportive,casual,practical,grounding) - optional saved context notes
- memory enabled/disabled state
Conversation history is stored in SQLite, not in memory. It survives bot restarts.
- Table:
chat_messages - Columns:
id,conversation_key,role(user|assistant),content,created_at - Table:
chat_profiles - Columns:
conversation_key,preferred_mode,memory_summary,memory_enabled,updated_at - Migration:
migrations/007_chat_messages.sql(applied on startup)
Each message is one row. When you send a message and the bot replies, two rows are added (user + assistant). Older messages beyond the limit are trimmed (see below).
- Only the last 20 messages per conversation key are used as context for the LLM.
- When new messages are appended, any older messages for that key are deleted so the table doesn’t grow forever.
- When you clear a conversation (see below), all rows for that key are deleted.
If the user says any of the following (case-insensitive, at the start of the message), the bot clears that conversation and replies with something like “Started a new conversation”:
new chatclearresetstart overclear conversationforget all
Clearing deletes all chat_messages rows for that conversation key.
It also clears saved mode/context for that conversation.
The slash chat command can set a preferred mode per conversation:
- supportive – warm, reflective, gentle follow-up questions
- casual – lighter, more relaxed conversation
- practical – concrete next steps and problem-solving
- grounding – calmer tone, grounding and stabilization style replies
If you set a mode in one conversation, that mode is reused in the same thread until you change it or reset the conversation.
OmegaBot can be more helpful for supportive conversations, catch-ups, and emotional check-ins, but:
- it is not a therapist
- it should not be treated as medical or psychiatric advice
- it uses stronger safety guidance when messages suggest distress or crisis
For higher-risk messages, the bot is instructed to respond with empathy, encourage reaching out to trusted people or local crisis/professional support, and avoid harmful detail.
- OpenAI (preferred when set): Uses
OPENAI_API_KEYandOPENAI_MODEL(defaultgpt-4o-mini) from.env. Same token as used for/fun utility chatand summaries whenSUMMARY_MODE=llm. - Anthropic (fallback): If
OPENAI_API_KEYis not set, usesANTHROPIC_API_KEYfor Claude.
If neither key is set, message-based chat is disabled (the handler is not registered). /fun utility chat (and DM/@mention) will reply that chat isn’t available and the server admin needs to set up an API key.
See Environment Setup and .env.example for where to get API keys.
To read DM and channel message content, the bot needs the Message Content privileged intent. Enable it in the Discord Developer Portal under your app → Bot → Privileged Gateway Intents, then set DISCORD_ENABLE_MESSAGE_CONTENT_INTENT=true in .env. See Discord Bot Setup.
| What | Where / How |
|---|---|
| Start chatting | DM the bot, @mention it, or /fun utility chat |
| Threads | One per user in DMs; one per user per channel |
| Storage | SQLite table chat_messages |
| Profile | Per-thread mode + saved context in chat_profiles |
| Limit | Last 20 messages per thread |
| Clear | Say “new chat”, “clear”, “reset”, etc. |
| Provider | OpenAI if OPENAI_API_KEY set, else Anthropic |