Answer the question
In order to leave comments, you need to log in
Vk_bottle How to write a user's message to a certain variable and save it?
I need the bot to ask the person for a name, and save it, and with a certain command, he sends the same name to the person. The main thing is that the name is taken not from the user profile, but exactly the one that he indicated.
Answer the question
In order to leave comments, you need to log in
name = ''
@bot.on.private_message(text = 'ввести_имя')
async def get_name(message):
global name
name = message.text
@bot.on.private_message(text = 'мое_имя')
async def get_name(message):
global name
await message.answer(f"Ваше имя: {name}")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question