jsaalfeld / pr0gramm_telegram_bot

A Telegram Bot for pr0gramm
1 stars 0 forks source link

Use some better file names #8

Open Dazzel opened 9 years ago

Dazzel commented 9 years ago

We need to use better file names if we send them as documents.

Maybe the first three tags?

jsaalfeld commented 9 years ago

First three tags could repeat themselves. Why not the Imagename itself? If the Bot runs in Multiple Chats at the same time, we don't need to download the image anymore, we can just take it from the temporary download folder. This saves us outgoing bandwidth and would be greate for Issue #16 - If this is run in multiple Chats. But then again, we need to clean at some point the temporary folder, so we don't waste too much space on the HDD.

Dazzel commented 9 years ago

We already have checks in place so we do not need to download and upload the same picture multiple times. This is handled by telgram itself: You get an file id after uploading an file to their servers. If you send this file id on the next "upload" telegram takes the already uploaded picture and sends it to the user.

The temporary folder is cleaned immediately after the image has been uploaded.

For caching see #18

jsaalfeld commented 9 years ago

But we don't check yet if we already sent the picture, so we download it in first place and then send it again. Even though the Image then ain't really sent, because the file ID is already known at the Telegram servers.

Dazzel commented 9 years ago

No, we only get the data from the pr0gramm api and then we check if this image was already downloaded. If so, we do not download it again and send the file_id instead

jsaalfeld commented 9 years ago

Well, then just lets use as filename the id provided by pr0gramm (e.g. /top/990527 - 990527 as filename)