I am learning about asyncio to use telethon module. I want to use buttons in conversations and get the output of the button selected by user.
@bot.on(events.NewMessage(incoming=True, pattern=r'start'))
async def chatbot(event):
sender = await event.get_sender(); SENDER = sender.id
async with bot.conversation(SENDER) as conv:
await conv.send_message('Select a button :')
await conv.send_message('Yes or no?', buttons=[
Button.inline('Yes!', b'yes'),
Button.inline('Nope', b'no') ])
if selected_button == 'yes' :
# do something
else:
# do something
Using callbackquery as given in the docs, jumps to the handler(event) function of events.CallbackQuery(). But does not go back to the conv of chatbot function.
How can I get the selected button info and proceed further in the chatbot function ?