import telethon
client = TelegramClient(StringSession(sessionid), api_id, api_hash)
@client.on(events.NewMessage())
async def handler(event):
message = await client.get_messages(222222)
print(message)
await message.click()
client.start()
client.run_until_disconnected()
[Message(id=8103, peer_id=PeerUser(user_id=22222), date=datetime.datetime(2021, 11, 18, 14, 13, 11, tzinfo=datetime.timezone.utc), message='Chose one:', out=False, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=ReplyInlineMarkup(rows=[KeyboardButtonRow(buttons=[KeyboardButtonCallback(text='Button1', data=b'\x0cikb:0:0|22', requires_password=False), KeyboardButtonCallback(text='Button2', data=b'\x0cikb:1:0|171', requires_password=False)])]), entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, restriction_reason=[], ttl_period=None), total=456]
Unhandled exception on handler
Traceback (most recent call last):
File "C:\Users\mp\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\updates.py", line 454, in _dispatch_update
await callback(event)
File "C:\Users\mp\Documents\clicker.py", line 22, in handler
await message.click(1,1)
AttributeError: 'TotalList' object has no attribute 'click'
Итого получилось: