how to make a boat that sends a list value and then later during the activity of this value, it reacted only to a certain message that is written in the code. I just doing bot that sends any questions and needs to be answered.
I made a list of questions in other file:
list_5 = ['Question_1', 'Question_2', 'Question_3']
Made the bot send a random question
@router.message(F.text=='№5')
async def choose(message: Message):
Question = random.choice(list_5)
await message.answer('Here')
await message.answer(Question, reply_markup=Keyboard.stop_button_1)
if Question == list[0]:
await state.set_state(Choice.choice_1)
elif Question == list[1]:
await state.set_state(Choice.choice_1)
elif Question == list[2]:
await state.set_state(Choice.choice_1)
Make a answers:
@router.message(Choice.choice_1)
async def quest_5(message: Message):
if Choice.choice_1 == list[0]:
if message.text == 'a':
message.answer('Great!')
elif message.text !='a' and message.text != 'Other question':
message.answer('Wrong')
elif Choice.choice_1 == list[1]:
if message.text == 'b':
message.answer('Great!')
elif message.text !='b' and message.text != 'Other question':
message.answer('Wrong')
elif Choice.choice_1 == list[2]:
if message.text == 'c':
message.answer('Great!')
elif message.text !='c' and message.text != 'Other question':
message.answer('Wrong')
1 step work good, but then nothing works
can u guys pls help me
New contributor
Weector is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.