LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!

Home Page:https://docs.telethon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetMessagesViewsRequest error

XuliGan4eg2006 opened this issue · comments

Code that causes the issue


from telethon import TelegramClient, types, functions
            client = TelegramClient("anon.session", 12314,
                                    '12454512',
                                    device_model="iPhone 13 Pro Max",
                                    system_version='14.8.1',
                                    app_version='8.4',
                                    lang_code='en')

            client.start()

            client(functions.messages.GetMessagesViewsRequest(
                peer=self.target_channel_edit.text(),
                id=last_message[0].id,
                increment=True
            ))

            client.disconnect()

Expected behavior

Iam trying to inscare post view counter via GetMessagesViewsRequest

Actual behavior

But I am getting this error:

Traceback

client(functions.messages.GetMessagesViewsRequest(
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\client\users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\client\users.py", line 67, in _call
    future = sender.send(request, ordered=ordered)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\network\mtprotosender.py", line 183, in send
    state = RequestState(request)
            ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\network\requeststate.py", line 17, in __init__
    self.data = bytes(request)
                ^^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\tl\tlobject.py", line 194, in __bytes__
    return self._bytes()
           ^^^^^^^^^^^^^
  File "C:\Users\pccc\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\tl\functions\messages.py", line 3159, in _bytes
    b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.id)),b''.join(struct.pack('<i', x) for x in self.id),
                                          ^^^^^^^^^^^^
TypeError: object of type 'int' has no len()

Telethon version

1.35.0

Python version

3.11.4

Operating system (including distribution name and version)

Win 11

Other details

No response

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.

id expects a list of integers, not an integer.