yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.3k stars 1.5k forks source link

downloadFile #1003

Closed Vo0oX closed 10 months ago

Vo0oX commented 2 years ago

I send some photos to the bot (2-10) how can i save them all in one go? To then send to another user

danielperez9430 commented 2 years ago

If you get all the photos as a "gallery" only one message you dont need to download it. You can use the method copyMessage or in the other case you need to download file by file. Because the oficial Telegram Bot API don't have a method to bulk download in only one call.

Example of usebot.downloadFile(...) -> https://github.com/yagop/node-telegram-bot-api/issues/867#issuecomment-1172660816

Vo0oX commented 2 years ago

If you get all the photos as a "gallery" only one message you dont need to download it. You can use the method copyMessage or in the other case you need to download file by file. Because the oficial Telegram Bot API don't have a method to bulk download in only one call.

Example of usebot.downloadFile(...) -> https://github.com/yagop/node-telegram-bot-api/issues/867#issuecomment-1172660816

if i got all the photos in one message it would solve my problem

i submit a gallery but i get one message per photo(I send 2 photos as merged but I get 2 messages)

when I listen to “message” and send 2 photos to the bot, I receive two messages. when 3 photos - 3 messages. how can i determine how long i have to wait? before writing them to the database and sending them to the user ?

The logic is this: I get 2-10 photos and save them to the database, after which the callback gives them to the user. I can't figure out how to wait. there is no reference point. in order to understand when I can start the recoil.