Like ChatGPT but in Telegram
A Telegram bot that uses OpenAI's chat completion API in the backend. That is the same backend as ChatGPT.
Set your Telegram bot token with TELOXIDE_TOKEN
and your OpenAI API key with OPENAI_API_KEY
. Access to gpt-4
is required.
Optionally you can store the dialogs using a Redis or SQLite. This prevents your conversations to wipe when the bot is restarted.
To setup Redis use REDIS_URL
and to setup SQLite use SQLITE_FILE
. Redis has priority over SQLite. If none is set memory storage is used.
Rename .env.template
to .env
and fill in with your secrets. Launch the bot with cargo run
. If you don't have rust, you need to install Rust.
Arguably, the easiest way to get it running is to use Docker. This does not require rust to be installed, but you need Docker engine and (optionally) docker compose.
Even simpler would be to deploy on cloud, but it might cost you money. A fly.io config file is provided, you can also deploy a Redis over there. Free tier works jut fine for a few users.
The bot will answer to private messages as you would expect. On groups it will only answer to reply messages, it has no access to any other messages. Start a new conversation with /start
.