This is a source code of Telegram restaurant chat-bot we built in 2016
Old spagetti-code, but still good to start with. In order to save user position in menu finite state machine notion used (in code represented by variable step)
-
Set bot token in config.py and webhook at the end of bot.py
-
Change regular for your country code in is_correct_phone function in utils.py
-
/broadcast for admins only to send notification for all of the bot users. handle_broadcast func - put your id here in bot.py
-
I've translated some text for you in messages table, but not all and everything. Be noticed, there are still dependencies on button names in source code buttons - table menu + first layer of categories comments - users reviews menu - for sending a photo of items in category messages - messages sent by bot orders - orders created by users products - items in final categories which are stated in type column requrests - items which were put in baskets of users users
-
Description, price of item will not appear untill you will add image_id in products
-
Created order sends to admins (users table set your telegra_id in your users row in admin column) check final function
Please, feel free to write me or create pull requests. More code later