Anonymous Telegram bot connecting users with support members. Complete anonymity maintained - users see "HeaRHtfelt Member", support members see "RHesident #1234".eaRHtfelt Companion Bot
Anonymous Telegram bot connecting users with support members. Complete anonymity maintained - users see "Heartfelt Member", support members see "Anonymous User #1234".
- Anonymous queue system with admin channel management
- Optional MongoDB storage for conversation history
- Queue cancellation and session management
- Graceful fallback to memory-only mode
-
Install:
pip3 install -r requirements.txt cp .env.example .env
-
Configure:
- Add
BOT_TOKENandADMIN_CHANNEL_IDto.env - Optionally add
MONGODB_URIfor persistent storage (enables dynamic admin updates) - (Optional) Update
DEFAULT_HEARTFELT_MEMBERSinconfig.pyas a fallback list when MongoDB is unavailable. Runtime admin updates happen via MongoDB, so you no longer need to edit the file or restart the bot.
- Add
-
Run:
python3 main.py
Telegram Bot: Create via @BotFather, add token to .env
Admin Channel: Private channel, add bot as admin with send/edit/delete permissions
Members: Add support member Telegram IDs to the heartfelt_members MongoDB collection (via python3 -m src.database.utils admins --action add --telegram-id ...) and ensure they are in the admin channel
Users: /help → describe issue → wait in queue → anonymous chat → /end
Support Members: Monitor admin channel → click "Claim" → anonymous chat → /end
Commands: /start /help /status /cancel /end
.env file:
BOT_TOKEN=your_bot_token_here
ADMIN_CHANNEL_ID=-1001234567890
MONGODB_URI=mongodb://localhost:27017/heartfelt_bot # Optionalconfig.py:
DEFAULT_HEARTFELT_MEMBERS = [1522275008, 9876543210]
# Runtime authorized members are synced from the MongoDB `heartfelt_members` collection.Stores conversation history and analytics. Works without it (memory-only mode).
Usage:
python3 -m src.database.utils stats # Session statistics
python3 -m src.database.utils monthly # This month's sessions
python3 -m src.database.utils transcript --session-id # Full conversation
python3 -m src.database.utils admins --action list # View Heartfelt admins
python3 -m src.database.utils admins --action add --telegram-id 123456789
python3 -m src.database.utils admins --action remove --telegram-id 123456789When the bot is running inside Docker, execute the same commands in the container:
docker exec heartfelt-bot python3 -m src.database.utils admins --action list
docker exec heartfelt-bot python3 -m src.database.utils admins --action add --telegram-id 123456789
docker exec heartfelt-bot python3 -m src.database.utils admins --action remove --telegram-id 123456789Replace heartfelt-bot with your container name if it differs. Changes propagate automatically within the refresh interval configured by AUTHORIZED_MEMBER_REFRESH_SECONDS (default 60 seconds).
- Ensure Docker Desktop/Engine is running and you are logged into your container registry (e.g. Docker Hub):
docker login
- Create an amd64-compatible image from the project root (works on both Apple Silicon and x86 hosts):
# Build with a version tag (example v1.0.0). Replace USERNAME and VERSION as needed. docker buildx build --platform linux/amd64 -t USERNAME/heartfelt-bot:v1.0.0 --load .
- Tag the image for your registry account (replace
USERNAMEandVERSIONwith your values):# Tag the versioned image and also create a 'latest' tag docker tag USERNAME/heartfelt-bot:v1.0.0 USERNAME/heartfelt-bot:latest - Push the image so the droplet can pull it:
# Push both the versioned tag and the 'latest' tag docker push USERNAME/heartfelt-bot:v1.0.0 docker push USERNAME/heartfelt-bot:latest
Simple one-liner: Build & push in one go (recommended for CI / multi-arch)
# Build and push a multi-arch image with a version tag and 'latest'.
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t USERNAME/heartfelt-bot:1.0.0 \
-t USERNAME/heartfelt-bot:latest \
--push .-
SSH into DigitalOcean droplet (raffleshalldevs@gmail.com) as root
ssh root@<DROPLET_IP>
-
Log in to your container registry (if the repo is private):
docker login
-
Pull the newest image (replace
USERNAMEwith your handle):docker pull USERNAME/heartfelt-bot:latest
-
Stop and remove the old container (this does not touch your image or
.env):docker stop heartfelt-bot docker rm heartfelt-bot
-
Run the updated container, wiring in your existing
~/heartfelt-bot/.env:docker run -d \ --name heartfelt-bot \ --restart unless-stopped \ --env-file ~/heartfelt-bot/.env \ felixlmao/heartfelt-bot:latest -
View logs
docker logs heartfelt-bot
python3 test_db_integration.py # Test MongoDB integration
python3 main.py # Start bot and test user flowTest flow: User sends /help → describe issue → check admin channel → claim → chat → /end
We value your privacy. Please review our full privacy policy here:
Hearhtfelt Companion Privacy Policy