Telethon: Question: How would I interact with a bot's button?

Created on 24 Apr 2018  路  1Comment  路  Source: LonamiWebs/Telethon

I know how to read what buttons a bot has set up through the special reply markup (from here), but how do I then interact with it after?

Example (using GetBotCallbackAnswerRequest):

>>> messages[0].reply_markup.rows[0].buttons[0].data
b'seed_list' 

How would I 'click' or otherwise interact with the "seed_list" button for example? I need my Python script to do so, and I'm probably missing something obvious. I have also read through the list of constructors in the full API but have either missed it or I'm not sure what it would be called. Assistance or a point in the right direction would be appreciated, thank you.

I'm also new to GitHub, not sure how to tag it as a "Question" issue so hopefully this is okay.
(edit: I believe this is done by the project owner and not me)

Most helpful comment

GetBotCallbackAnswerRequest is what "presses" or "interacts" the buttons, and you linked to the right place indeed. What's your issue exactly? With messages[0].reply_markup.rows[0].buttons[0].data you access the data, with the linked:

from telethon.tl.functions.messages import GetBotCallbackAnswerRequest

client(GetBotCallbackAnswerRequest(
    user_or_chat,
    msg.id,
    data=msg.reply_markup.rows[wanted_row].buttons[wanted_button].data
))

You "click" it. Yes, labels are added by collaborators including the owner. This has also been asked before at #98, and beware of #326.

>All comments

GetBotCallbackAnswerRequest is what "presses" or "interacts" the buttons, and you linked to the right place indeed. What's your issue exactly? With messages[0].reply_markup.rows[0].buttons[0].data you access the data, with the linked:

from telethon.tl.functions.messages import GetBotCallbackAnswerRequest

client(GetBotCallbackAnswerRequest(
    user_or_chat,
    msg.id,
    data=msg.reply_markup.rows[wanted_row].buttons[wanted_button].data
))

You "click" it. Yes, labels are added by collaborators including the owner. This has also been asked before at #98, and beware of #326.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pazis picture pazis  路  5Comments

denilen picture denilen  路  3Comments

saharokk picture saharokk  路  3Comments

ksanderer picture ksanderer  路  3Comments

Lerbytech picture Lerbytech  路  5Comments