This guide provides detailed instructions on how to set up, configure, and deploy QRBot.
Before you begin, ensure you have the following installed:
- Python 3.9 or higher
- Git
- A Telegram account and a Bot Token (Get one from @BotFather)
- libzbar: Required for reading QR codes (see OS-specific instructions below).
-
Clone the Repository
git clone https://github.com/zis3c/QRBot.git cd QRBot
-
Create a Virtual Environment (Recommended)
python -m venv venv .\venv\Scripts\Activate -
Install Dependencies
pip install -r requirements.txtNote: On Windows, the
pyzbarlibrary usually includes the necessary DLLs. If you encounter errors, you may need to install the Visual C++ Redistributable. -
Configure Environment See the Configuration section.
-
Run the Bot
python bot.py
-
Install System Dependencies
sudo apt-get update sudo apt-get install libzbar0
-
Clone and Setup
git clone https://github.com/zis3c/QRBot.git cd QRBot python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Run
python bot.py
-
Install zbar via Homebrew
brew install zbar
-
Clone and Setup
git clone https://github.com/zis3c/QRBot.git cd QRBot python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
QRBot uses environment variables for configuration. You can set these in your terminal or use a .env file (if you install python-dotenv).
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Your Telegram Bot API Token obtained from @BotFather. |
| Variable | Description | Default |
|---|---|---|
ADMIN_IDS |
Comma-separated list of Telegram User IDs for admin access. | None |
PORT |
Web server port (for checking keep-alive status). | 10000 |
- Create a file named
.envin the root directory. - Add your variables:
TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIjkLmnOpQrStUvWxYz ADMIN_IDS=12345678,87654321
Docker is the easiest way to run QRBot in a consistent environment.
-
Build the Image
docker build -t qrbot . -
Run the Container
docker run -d \ -e TELEGRAM_BOT_TOKEN="your_token_here" \ -e ADMIN_IDS="12345678" \ --name qrbot_instance \ qrbot
This repository is configured for easy deployment on Render.
- Fork this repository to your GitHub account.
- Log in to Render and click New + -> Web Service.
- Select your forked
QRBotrepository. - Render should automatically detect the
render.yamlorDockerfile.- Runtime: Docker
- Environment Variables:
- Add
TELEGRAM_BOT_TOKEN(Required) - Add
ADMIN_IDS(Optional)
- Add
- Click Create Web Service.
The bot will start automatically and stay awake thanks to the built-in keep-alive server.