O
O
Omen2020-01-27 06:03:02
Python
Omen, 2020-01-27 06:03:02

How to teach a Telegram bot to issue an answer for a keyword?

Good day)
Faced a problem and I just can not find a solution!

I decided to create a TelegramBot in Python with the following task:
The user (and there will be not many of them, about 10 people) writes a request to the bot (name or phone number) The
bot, in turn, returns a message in response (about 500 characters) information about the employee (name , Phone number, year of birth, department, and other information ...) also, ideally, a photo of an employee, I haven’t gotten to that yet. By the way, there are 800+ employees.

Please help with advice on how to implement this ... tell me in which direction to move ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mt_max, 2020-01-27
@mt_max

Take a relational database, such as mysql or postgresql, install. Create a table that will store employee records. (Full name, phone number, year of birth, department, and other information...) these will be the columns of the table.
Then you take a library for working with a telegram, telebot, for example, understand the documentation, set up a webhook. When a user writes a message with a full name or phone number, execute the sql query "SELECT * FROM table_name WHERE fio=entered_name;" return the query result in a message. To organize the storage of employee photos and their sending, you need to create a column in the table that will store the paths to the photos, and the photos themselves will be in a folder on the server, you will receive the path from the database with a request and send the photo.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question