π Telegram shop bot template
This is an example Telegram shop bot. Itβs a simple and, most importantly, efficient way to place an order without leaving your favorite messenger.
/start
- needed to start the bot and choose the mode (user/admin).
/menu
- go to the menu.
/sos
- ask the administrator a question.
The user menu looks like this:
The catalog consists of products sorted by categories. Users can add items to their cart, and the admin has full control over catalog management (addition/removal).
The ordering process looks like this: the user goes to the ποΈ Catalog
, selects the desired category, chooses products, and clicks the π Cart
button.
Then, after making sure everything is in place, proceed to checkout by clicking π¦ Place Order
.
To add a product, select a category and click the β Add Product
button. Then, fill out the βname-description-image-priceβ form and confirm.
To ask the admin a question, simply select the /sos
command. There is a limit on the number of questions.
Clone this repository.
Create and activate virtual enviroment:
Windows:
python -m venv venv
& venv/scripts/activate.ps1
UNIX:
python3 -m venv venv
source venv/scripts/activate
pip install -r requirements.txt
.env
file in the root directory. Here are the required keys (* - always required; ** - required only in production):Key | Value |
---|---|
BOTTOKEN (*_) | To get bot token, you need create a bot via BotFather. |
PROJECTNAME (**_) | Name of your project on Heroku (required if you want to deploy bot on Heroku). |
WEBHOOKHOST, WEBHOOK_PATH (**_) | Webhook host and path. |
ADMINS (**) | A comma-separated string of admins IDs (e.g., 000000000,123456789). To get your Telegram ID, use Get My ID bot. |
Example:
BOT_TOKEN=YOUR_BOT_TOKEN
ADMINS=123456789,000000000
app.py
:python3 app.py