td icon indicating copy to clipboard operation
td copied to clipboard

Unable to use downloadFile

Open mahajanparas09 opened this issue 1 year ago • 2 comments

I am using TDL which is a javascript wrapper for TDLib. Following is my code to download a file. When I run this code I get updateFile logged twice in the console. The first time it says "is_downloading_active": true and "is_downloading_completed": false. The second time it says "is_downloading_active": false, "is_downloading_completed": false, "downloaded_size": 0. Why didn't file got downloaded. I can clearly see the file which is an image in my telegram app so definitely file is there.

client.on('update', onUpdate);

async function main () {
    await client.login()

    const chat = await client.invoke({
        _: 'getChat',
        chat_id: -702279442
    })
    
    let fileID = chat.last_message.content.photo.sizes[2].photo.id;

    const download = await client.invoke({
        _: 'downloadFile',
        file_id: fileID,
        priority: 32
    });

    await client.close()
  }

function onUpdate(upd){
    if (upd['_'] === 'updateFile'){
        console.log(upd);
    }
}


main().catch(console.error)

mahajanparas09 avatar Sep 24 '24 18:09 mahajanparas09

client.on('update', onUpdate);

async function main () { await client.login()

const chat = await client.invoke({
    _: 'getChat',
    chat_id: -702279442
})

let fileID = chat.last_message.content.photo.sizes[2].photo.id;

const download = await client.invoke({
    _: 'downloadFile',
    file_id: fileID,
    priority: 32
});

await client.close()

}

function onUpdate(upd){ if (upd['_'] === 'updateFile'){ console.log(upd); } }

main().catch(console.error)

Hanis123456 avatar Sep 26 '24 19:09 Hanis123456

Check TDLib logs with verbosity level 2.

levlam avatar Sep 27 '24 08:09 levlam