Могу поделиться примером с использованием FSM и библиотеки aiogram
from aiogram import Bot, Dispatcher, executor, types
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import StatesGroup, State
import random
bot = Bot(token="TOKEN")
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)
class UserChoice(StatesGroup):
question1 = State()
question2 = State()
@dp.message_handler(commands=["БотИли"])
async def start_command(message: types.Message):
await UserChoice.question1.set()
await message.answer("Введите первое условие:")
@dp.message_handler(state=UserChoice.question1)
async def state_q1(message: types.Message, state: FSMContext):
async with state.proxy() as data:
data['q1'] = message.text
await UserChoice.question2.set()
await message.answer("Введите второе условие:")
@dp.message_handler(state=UserChoice.question2)
async def state_q2(message: types.Message, state: FSMContext):
async with state.proxy() as data:
data['q2'] = message.text
await message.answer(f"Я думаю {random.choice(list(data.values()))}")
await state.finish()
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)