tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Help in DownloadFile API #2936

Closed manavchaudhary1 closed 4 months ago

manavchaudhary1 commented 4 months ago

I'm trying to create a telegram client which runs on spring boot . When i getChatHistory for getting fileId : i'm confused which one should i use

"messages": [
        {
            "id": <this_one>,
            "senderId": {
                "chatId": XXXX
                "constructor": XXX
            },

or

   "messages": [
        "content": {
                "document": {
                     "document": {
                        "id": 2416, this one changes every time client restarts
                        }

I'm having trouble in using FileDownload Api and UpdateFile Api , i try to create a method using javadoc but i didn't understand many thing from it , is there any example of Download File & UpdateFile , any help will be very helpful . As i having trouble cause i'm still a college student not long ago i started learning , this is my first project for my resume . I'm using https://github.com/p-vorobyev/spring-boot-starter-telegram this starter pack .

levlam commented 4 months ago

File identifiers and a lot of other identifiers can be used only with the same TDLib instance from which they were obtained. It is not possible to save an identifier, close an instance, open a new instance and pass the saved identifier to the new instance. To download a file, you need to call downloadFile with a file identifier (for example, document.id) obtained from the same TDLib instance.