Telegram bot for food menu navigate
Disclaimer. The picture below is taken from the movie "Бриллиантовая рука" for illustration only https://ru.wikipedia.org/wiki/%D0%91%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D0%B0%D0%BD%D1%82%D0%BE%D0%B2%D0%B0%D1%8F_%D1%80%D1%83%D0%BA%D0%B0
The person who deployed the bot is its administrator. Further:
- He advertises his bot as a platform for placing the menu
- restaurateurs turn to him
- he registers them in the system and restaurateurs manage their own menu
Tested on hosting heroku.com, demo sample in telegram @Muine_vzbot - https://t.me/Muine_vzbot To use the algorithm with another bot, you just need to specify a token.
At the first start, the algorithm creates the necessary tables on its own, but the database must already exist. Postgres server must be version 12 or higher due to changes in the syntax for creating a full-text index. The following environment variables must be set:
Connection to PostgeSQL database
DATABASE_URL=postgres://ciiqzyjmfs...
URL for webhook
HOST=your_app_name.herokuapp.com
Port of your https. Perhaps you should not set the port explicitly, it will provide the hosting (try first without this variable)
PORT=443
Token from bot father
TELOXIDE_TOKEN=11344...
For contact with you from caterers
CONTACT_INFO=@none
To identify you (up to three) as admins - you can see your user_id when press button with gear icon "⚙"
TELEGRAM_ADMIN_ID1=40966...
TELEGRAM_ADMIN_ID2=
can be blank
TELEGRAM_ADMIN_ID3=
To specify unit of price
PRICE_UNIT=$
To indicate the time zone
TIME_ZONE=+7
Optional. To specify service chat id - you can see it after add bot to group and send command /chat (/chat@yourbotname)
LOG_GROUP_ID=-100123...
The language resources for the interface are in the locale folder, reads at the start of the bot. To support a new language, create a file similar to existing ones with short name of new language. Default locale is "en". The interface language is determined by information from the telegram server (User/language_code field). And please make a pull request.
The bot has the ability to send messages about some actions to a special service chat:
- new user logon
- ordering through a bot
- completion or cancellation of the order by the customer or manager
To enable this feature, you need to add the chat ID to the LOG_GROUP_ID=ID
variable, as shown above. To find out the chat ID
:
- add a bot to chat
- in chat send command
/chat
and bot will report the identifier.
The code is written using https://github.com/teloxide/teloxide and deployed with https://github.com/emk/heroku-buildpack-rust Good luck!