# Matrix ChatGPT Bot ![License](https://img.shields.io/badge/license-MIT-blue) ![LiberaPay](https://img.shields.io/liberapay/receives/braydofficial) This is a simple Bot written in Python to bring ChatGPT directly into Python. ## Disclaimer This bot is not suited for the use in big channels or by many users. Your OpenAI API Key *will* get rate limited, if many requests are made to the bot in a short period of time. See this bot primarly for something for personal use or in small groups with your friends or family. I'll maybe add the option to whitelist specific users who are allowed to use the bot via a config or similar in the future. **Attention:** If you push your changes to this repository DO NOT push your login credentials or API Keys. If you accidentally do, change them immediately! ## Setup 1. Install Python3 and pip3 2. Follow the README.md of the [libolm repository](https://gitlab.matrix.org/matrix-org/olm) to install libolm 3 or newer. You will need this for the bot to work in addition to the requirements.txt! 3. Install e2e support for matrix-nio by running: ```bash pip3 install "matrix-nio[e2e]" ``` 4. Clone this repo using: ```bash git clone https://code.braydmedia.de/brayd/matrix-chatgpt-bot.git ``` 5. Install requirements from requirements.txt using: ```bash pip3 install -r requirements.txt ``` 6. Create a bot account on your Matrix server 7. Logout of your Matrix client with the bot account (if you haven't created it via a Synapse command or the AdminAPI), so the session will be cancelled 8. Open main.py with a text editor (for e.g. nano, vim or neovim) and edit: ```python creds = botlib.Creds("https://matrix.example.com", "bot_user_name", "password") ``` with your Matrix Homeserver URL, your bot username (without the @) and your bot accounts password. Also edit: ```python openai.api_key = "OPENAI TOKEN HERE" ``` with your OpenAI Token which you can get in your account settings directly from OpenAI. 9. Save the edited main.py file 10. Start the bot using: ```bash python3 main.py ``` You can now start a chat with your bot and type your request like for e.g.: ``` ! Tell me something about the Matrix Protocol ```