Skip to content

Telegram bot-shop with Flask Admin manages pizza menu

Notifications You must be signed in to change notification settings

olegush/28_pizza_bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot for Pizzeria

This simple telegram bot based on pyTelegramBotAPI library. Pizza menu stores in the SQLite Database and manages with Flask-Admin.

How to Install

  1. Register new telegram bot and get the new token. @BotFather

  2. Python 3.6 and libraries from requirements.txt should be installed. Use virtual environment tool, for example virtualenv.

virtualenv virtualenv_folder_name
source virtualenv_folder_name/bin/activate
python3 -m pip install -r requirements.txt

3.Put vulnerable parameters to to .env file.

HOST=127.0.0.1
PORT=5000
FLASK_DEBUG=TRUE
DB_URI=sqlite:///db/catalog.db
ADMIN_LOGIN=admin_login
ADMIN_PWD=admin_password
TELEGRAM_TOKEN=telegram_token

FLASK_DEBUG environment variable Flask loads by itself, but for PORT loading we should use python-dotenv package.

  1. To create new database launch interactive Python shell:
python3

and run:

from app import db
from models import Pizza, Choice
db.create_all()

Database will be created in the db dir. Then, import data from catalog.json with run import.py.

  1. Change templates in the templates folder if you need.

Quickstart

  1. Run admin.py
$ python admin.py

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with inotify reloader
 * Debugger is active!

Goto http://127.0.0.1:5000/admin with your login and password. Here you can edit the menu.

  1. Run bot.py and test your bot in Telegram.

Project Goals

The code is written for educational purposes. Training course for web-developers - DEVMAN.org

About

Telegram bot-shop with Flask Admin manages pizza menu

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.8%
  • HTML 2.2%