E
E
EnotShow2022-04-10 00:04:20
Telegram
EnotShow, 2022-04-10 00:04:20

How to make the issuance of questionnaires like in Divinchik python aiogram?

I am writing a telegram bot like Divinchik, in python aiogram. The question is: how to implement the same issuance of questionnaires? For those who have not seen the bot, the principle is as follows: the bot issues a questionnaire, and then after the user's response, it issues the next one. I understand that the data needs to be transmitted through the state machine, but in what form? I had an idea to request the output from the database, save it to a sheet, and then take the data from the sheet, but in this case, if we have many users, we will generate too huge sheets for each user, which will greatly affect the speed of the bot . So how do you implement this functionality? What to use for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Joni Straponi, 2022-04-10
@EnotShow

If I understand you correctly, this will help you.

sp = ['''Путь к фотографиям''']
x = random.randint(0, 10) #Выбирает рандомную фотку из тех, что есть в папке 

bot.send_photo(message.from_user.id, photo=open(sp[x], 'rb')) #Отправляет пользователю рандомно выбранное фото

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question