'how to use buttons on telegram bot made with telethon

this is the code

@bot.on(events.NewMessage(pattern="opzioni"))
async def handler(event):
bottoni = [
    [  
        Button.inline("prima opzione", b"1"), 
        Button.inline("seconda opzione", b"2")
    ],
    [
        Button.inline("terza opzione", b"3"), 
        Button.inline("quarta opzione", b"4")
    ],
    [
        Button.inline("quinta opzione", b"5")
    ]
]

await bot.send_message("tag",".       --queste sono le opzioni--       .", buttons= bottoni)

and i want it to do something when i click a button, but i don't have the minimum idea how to do it.

let's say we have 10 photos and one button after i enter a number sends tot photos. how do i do it?



Solution 1:[1]

@bot.on(events.CallbackQuery())
async def callback(event):
    if event.data == b'1':
        event.edit('your photo')
    elif event.data == b'2':

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wai Ha Lee