from telethon import events, TelegramClient bot = TelegramClient(BOT_SESSION, BOT_API_ID, BOT_API_HASH).start(bot_token=BOT_TOKEN) @bot.on(events.NewMessage(pattern='/greeting')) async def greeting(event): async with bot.conversation(await event.get_chat(), exclusive=True) as conv: await conv.send_message('Hi!') hello = await conv.get_response() await conv.send_message('Please tell me your name') name = await conv.get_response().raw_text await conv.send_message(f'Thanks {name}!')