Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on get_chat caused by pinned messages #44

Open
3 tasks done
barbamento opened this issue Apr 24, 2024 · 0 comments
Open
3 tasks done

Error on get_chat caused by pinned messages #44

barbamento opened this issue Apr 24, 2024 · 0 comments

Comments

@barbamento
Copy link

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version

Description

I found a single chat where the pinned messages has, for some reason unknown to me, a wrong id.

The problem is that, for that reason I'm unable to interact with the chat. It is possible to use a try except block for the pinned message retrieval?

Steps to reproduce

I simply get this error using the get chat on a chat called "vezzoblog". Up until now it's the only chat i had this problem

Code example

from pyrogram import Client

app=Client(...)

with app:
        app.get_chat("vezzoblog")

Logs

Traceback (most recent call last):
  File "mydir/test_pyrogram.py", line 56, in <module>
    app.get_chat("vezzoblog")
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/methods/chats/get_chat.py", line 87, in get_chat
    return await types.Chat._parse_full(self, r)
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/types/user_and_chats/chat.py", line 511, in _parse_full
    parsed_chat.pinned_message = await client.get_messages(
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/methods/messages/get_messages.py", line 117, in get_messages
    messages = await utils.parse_messages(self, r, replies=replies)
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/utils.py", line 155, in parse_messages
    reply_messages = await client.get_messages(
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/methods/messages/get_messages.py", line 115, in get_messages
    r = await self.invoke(rpc, sleep_threshold=-1)
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/methods/advanced/invoke.py", line 94, in invoke
    r = await session.invoke(
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/session/session.py", line 399, in invoke
    return await self.send(query, timeout=timeout)
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/session/session.py", line 367, in send
    RPCError.raise_it(result, type(data))
  File "/.cache/pypoetry/virtualenvs/envname/lib/python3.10/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it
    raise getattr(
pyrogram.errors.exceptions.bad_request_400.MessageIdsEmpty: Telegram says: [400 MESSAGE_IDS_EMPTY] - The requested message doesn't exist or you provided no message id (caused by "channels.GetMessages")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant