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}!')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter