schafezp / karmabot

A telegram bot designed for group chats to allow users to upvote and downvote content similar to reddit.
https://schafezp.github.io/karmabot/
MIT License
6 stars 1 forks source link

Add support for storing file assets that were parts of replies. #12

Open schafezp opened 6 years ago

schafezp commented 6 years ago

Is your feature request related to a problem? Please describe. Currently there is no way to retrieve a list of the highest karma rated images/videos/media.

Describe the solution you'd like There should be a mechanism in the reply handler which stores files associated with messages. It should make a distinction as to the type of content (image, audio, video, pdf, etc) when it stores the meta data. Additionally there should be a limit imposed to make sure that the file size allocated on the server does not grow too large. A simple initial solution is an individual file size limit. Alternatively there could be a per user space cap although this can lead to unexpected behaviors when a user runs out of space.

schafezp commented 6 years ago

The following table could be created to manage files

CREATE TABLE Telegram_file (
    id INT PRIMARY KEY,
    extension TEXT
    message_id INT REFERENCES Telegram_message(message_id),
    created_time TIMESTAMP default current_timestamp
)

After that we can optionally add a column on telegram_message to link directly to files.

ALTER TABLE Telegram_message ADD COLUMN file_id INT references(Telegram_file)

How useful is adding this column to telegram_message?

schafezp commented 6 years ago

Just store a link to the file asset and only download files lazily as needed. This will keep space requirements down but increase latency on responses initially

Sent with GitHawk

schafezp commented 6 years ago

Just store a link to the file asset and only download files lazily as needed. This will keep space requirements down but increase latency on responses initially

Sent with GitHawk