Ошибка:
button_data = msg.reply_markup.rows[0].buttons[0].data
AttributeError: 'KeyboardButton' object has no attribute 'data'
Код:
from telethon import TelegramClient, sync, events
api_id =
api_hash = ''
client = TelegramClient('boters', api_id, api_hash)
client.start()
dlgs = client.get_dialogs()
for dlg in dlgs:
print(dlg.title)
for dlg in dlgs:
if dlg.title == '':
client.send_message('', "")
tegmo = dlg
msgs = client.get_messages(tegmo, limit=30)
for msg in msgs:
if msg.reply_markup is not None:
button_data = msg.reply_markup.rows[0].buttons[0].data
message_id = msg.id
print(button_data, message_id)
from telethon.tl.functions.messages import GetBotCallbackAnswerRequest
resp = client(GetBotCallbackAnswerRequest(
tegmo,
58462,
data=b'hatgiong;7187'
))
print(resp.message)