danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.74k stars 617 forks source link

RPC error with getFullInfo() #1512

Closed itdredd closed 2 months ago

itdredd commented 2 months ago

When I try to get full information (first call getInfo() succesed) about the basic chat I get an error. At the same time, if i change negative chat_id to positive (PeerHandler 659 line) then request will be success.

Exception: Telegram returned an RPC error: The provided chat id is invalid (400) (CHAT_ID_INVALID), caused by /app/vendor/danog/madelineproto/src/MTProtoSession/ResponseHandler.php:386

Code:

    /**
     * Handle incoming updates from users, chats and channels.
     */
    #[Handler]
    public function handleMessage(Incoming&Message $message): void
    {
        $chatId = $this->getId($message->chatId);
        $data = $this->getInfo($chatId);
        $data = $this->getFullInfo($chatId); // error here
    }
danog commented 2 months ago

First of all, you do not need to call getId, chatId is already in the correct format. Second, could you please send the full code, and the full exception trace?

danog commented 2 months ago

Fixed