This project is a simple Telegram bot built with Python for the resume purpose.
1.1K
This project is a simple Telegram bot built with Python. The bot responds to user commands and provides information about the creator, Priyanshu K Sharma. It is containerized using Docker for easy deployment.
/start with a welcome message/help provides a list of available commands and their descriptions/content shares information about the creator/contact provides contact links (LinkedIn, GitHub)| Command | Description |
|---|---|
| /start | Start a conversation with the bot |
| /help | List available commands and their usage |
| /content | Information about Priyanshu K Sharma |
| /contact | Contact information (LinkedIn, GitHub) |
Clone the repository:
git clone <repo-url>
cd Telegram_Bot
Set up virtual environment:
# Install venv if not available
sudo apt install python3.12-venv
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
Install dependencies:
pip install -r requirement.txt
Set up environment variables:
.env file in the project root:
TOKEN=your_telegram_bot_token_here
Run the bot:
python tele-bot.py
You can run the bot inside a Docker container:
Build the Docker image:
docker build -t telegram_bot:latest .
Run the container:
docker run --env-file .env telegram_bot:latest
.
├── Dockerfile
├── README.md
├── requirement.txt
├── tele-bot.py
└── telegram_bot/
└── README.md
If you encounter a ValueError: 'token' or 'bot' must be passed error when running the bot in Docker, ensure the following:
.env file contains your token as TOKEN=your_token_here (no quotes)..env or code:
docker build -t telegram_bot .
docker run --env-file .env telegram_bot
os.environ.get("TOKEN") (not load_dotenv()) to read the token. This ensures the token is read from Docker's environment variables.If you need to update your code, make sure to remove or comment out any load_dotenv() lines and use only os.environ.get("TOKEN") for reading the token.
Created by Priyanshu K Sharma
Feel free to contribute or raise issues!
Content type
Image
Digest
sha256:8fee4fa2b…
Size
47.3 MB
Last updated
10 months ago
docker pull priyanshuksharma/telegram_bot