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

Unable to use downloadFile #3063

Open
mahajanparas09 opened this issue Sep 24, 2024 · 2 comments
Open

Unable to use downloadFile #3063

mahajanparas09 opened this issue Sep 24, 2024 · 2 comments

Comments

@mahajanparas09
Copy link

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)
@Hanis123456
Copy link

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)

@levlam
Copy link
Contributor

levlam commented Sep 27, 2024

Check TDLib logs with verbosity level 2.

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

3 participants