A simple service for connecting Telegram Bot
to the Open AI API
.
-
Temporary in-memory message history. User can view it and clear it.
-
Flexible rules stored in SQLite database for managing access:
2.1 General rule for all users (a quota of 50 requests or 65 536 tokens).
2.2 User-specific rules.
2.3 Unlimited access.
-
Supported commands
/message
- Send a message to bot./jailbreak
- Inject jailbreak prompt to the message (Not implemented yet)./clear
- Clear message history./history
- Get message history./remaining
- Check remaining resources./unlimited
- Get unlimited access./id
- Get your Telegram Id.
- .NET 7
- Docker (if you want to run in Docker container)
-
Specify environment variables in
launchSettings.json
"environmentVariables": { "DOTNET_ENVIRONMENT": "Development", "TELEGRAM_TOKEN": "", "OPENAI_API_KEY": "", "DBPATH": "./database/local.sqlite", "BOT_NAME": "" }
-
Execute
dotnet run
-
Specify environment variables in
docker-compose-yaml
# other content here services: openai-bot: container_name: openai-bot image: openai-bot:latest environment: - TELEGRAM_TOKEN=TOKEN - OPENAI_API_KEY=KEY - DBPATH=/app/data/local.sqlite - BOT_NAME=NAME volumes: - ./database/:/app/data # other content here
-
Execute the following commands
docker build . -t openai-bot docker compose up