# Botbot *Botbot, your not so friendly Bot* A Matrix chat bot that listens to specified rooms, records conversations, leverages OpenAI for AI-driven summaries, and assists with answering questions. ## Future Objectives - Enhance discussion summaries to capture actionable items, deadlines, and decisions. - Support additional AI backends beyond OpenAI (e.g., local LLMs, alternative APIs). - Refine unanswered-question detection with customizable thresholds and notifications. - Integrate with project management tools (e.g., Jira, Trello) for seamless task creation. - Offer scheduled summary reports (daily, weekly) and export capabilities. ## Current Features - **Auto-join Rooms**: Automatically joins rooms when invited. - **Message Callbacks**: Responds to basic commands: - `!ping` → `Pong!` - `hello botbot` → Greeting - **Conversation Recording**: Persists room sync tokens and history to support summaries. - **AI Summaries**: Uses OpenAI to generate summaries of discussions, extracting projects, subjects, schedules, etc. - **Unanswered Question Handling**: Monitors messages and attempts to answer questions left unanswered after a configurable delay or when @botname is mentioned. ## Prerequisites - Docker & Docker Compose (or Python 3.8+) - A Matrix account for the bot - OpenAI API key ## Installation 1. **Clone the repository** ```bash git clone https://gitea.alluna.pt/jfig/botbot.git cd botbot ``` 2. **Configure environment variables** Copy the example file and edit it: ```bash cp .env.example .env ``` Then open `.env` and set: ```ini LOG_LEVEL=INFO HOMESERVER_URL=https://matrix.org USER_ID=@botbot_user:matrix.org PASSWORD=your_matrix_password OPENAI_API_KEY=your_openai_api_key ``` ## Usage ### Using Docker Compose (development/hot-reload) ```bash docker-compose up --build ``` ### Building and Running Manually (production) ```bash # Build container docker build -t botbot . # Run container docker run -d --env-file .env \ -v matrix_data:/app/data \ --restart unless-stopped \ botbot ``` ## Configuration Options - `LOG_LEVEL`: One of `CRITICAL`, `ERROR`, `WARNING`, `INFO`, `DEBUG`, `NOTSET`. - `HOMESERVER_URL`: Matrix homeserver endpoint (e.g., `https://matrix.org`). - `USER_ID`: Bot's full Matrix user ID (e.g., `@botbot_user:matrix.org`). - `PASSWORD`: Password for the bot account. - `OPENAI_API_KEY`: API key for OpenAI usage. ## How It Works 1. **Startup**: Loads environment and logs into the Matrix homeserver. 2. **Callbacks**: - `message_callback`: Handles text messages and triggers AI logic. - `invite_cb`: Joins rooms on invitation. 3. **AI Integration**: Future development will: - Pull recent chat history. - Call OpenAI endpoints to generate summaries or answers. ## Contributing 1. Fork the repository. 2. Create a feature branch (`git checkout -b feature/xyz`). 3. Commit changes and push (`git push origin feature/xyz`). 4. Open a pull request with a description of your changes. ## License This project is licensed under the [MIT License](LICENSE).