Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
software-project-WS25
Telegram Team
Commits
8c427f7a
Commit
8c427f7a
authored
Oct 29, 2025
by
Pranav
Browse files
Merge branch 'main' of
https://github.com/pranav-1804/TelegramBot
parents
089b3a22
70c8e8b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
8c427f7a
...
...
@@ -71,9 +71,70 @@ pip install -r requirements.txt
Ensure the virtual environment is activated
Confirm .env is present with correct values
Run the program script
python services/telegram_listener.py
Verify the Bot Is Running
Check console output for post messages (new and historical)
Confirm CSV file is created/updated with captured post data
Confirm CSV file is created/updated with captured post data.
**🐳 Running the Telegram Listener in Docker**
1.
Prerequisites
Make sure you have:
Docker and Docker Compose installed
A valid Telegram API ID and API Hash
A session_name.session file generated by running the script locally once
2.
Project Setup
Create a .env file in the project root (Skip if already created) :
API_ID=your_api_id
API_HASH=your_api_hash
SESSION=session_name
Ensure your project contains:
Dockerfile
docker-compose.yaml
session_name.session file (from your local run)
3.
Build the Docker Image
docker-compose build
4.
Start the Container
5.
docker-compose up
The container will:
Load environment variables from .env
Use the existing session_name.session file for authentication
Start fetching data from Telegram immediately
5.
Stop the Container
To stop gracefully (Telethon disconnects cleanly):
docker-compose down
or:
docker stop telegram_bot
6.
Logs
View logs in real-time:
docker logs -f telegram_bot
7.
Notes
Don’t add session_name.session to .dockerignore
Keep session_name.session in .gitignore (never commit it)
The container will auto-restart if it crashes (restart: always)
The Telethon-based Telegram listener is now fully Dockerized and production-ready.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment