Search code examples
python-3.xtelegramtelethon

telethon how to get 'alert' message?


enter image description here

how can i get the 'alert' message ?

my code:

@client.on(events.NewMessage(chats=group_to_enter))
async def handler(event):
    buttons = await event.get_buttons()
    for bline in buttons:
        for button in bline:
            print(button.button.text)
            await button.click()

but this code cannot get alert message only message displayed in the group


Solution

  • The result is returned from Message.click (or MessageButton.click):

    result = await button.click()
    print(result)