This bot uses simple auth via private Telegram group - bot will not work with users that are not members of some private group.
- Register at https://platform.openai.com/
- Create new API key: https://platform.openai.com/account/api-keys. Save it somewhere.
- Create telegram bot via message to https://t.me/BotFather. Save bot token somewhere.
- Create private group and add bot to it. Save somewhere ID of the group (ex. '-123456789'). You can find group ID in Telegram Web by opening the group and get ID from URL - like https://web.telegram.org/k/#-123456789, where ID is
-123456789
- Add trusted users to private group you created.
- (optional) Create .env file with variables you need.
You can set TELEGRAM_AUTH_GROUP_ID
, TELEGRAM_BOT_TOKEN
, OPENAI_API_KEY
in your env.
Or you can pass it to node directly.
TELEGRAM_AUTH_GROUP_ID='...' TELEGRAM_BOT_TOKEN='...' OPENAI_API_KEY='...' node server.js
env name | default | description |
---|---|---|
TELEGRAM_AUTH_GROUP_ID (required) |
undefined | id of private telegram group. Ex. '-123456789' |
TELEGRAM_BOT_TOKEN (required) |
undefined | telegram bot token |
OPENAI_API_KEY (required) |
undefined | |
TELEGRAM_BOT_ALIAS | undefined | telegram bot username. Ex. '@your_bot_username' |
TELEGRAM_ADMIN_NICKNAME | undefined | Ex. '@your_user' |
MAX_MODEL_TOKENS | 100 | |
MAX_RESPONSE_TOKENS | 500 | |
THROTTLE_INTERVAL | 20 | |
CONVERSATIONS_TIMEOUT | 604800000 | timeout before conversation will be cleaned, in ms |
docker run --rm -d \
-e TELEGRAM_AUTH_GROUP_ID='...' \
-e TELEGRAM_BOT_TOKEN='...' \
-e OPENAI_API_KEY='...'\
kemmor/chatgpt-telegram-bot:latest
The MIT License (MIT)