discord-backup icon indicating copy to clipboard operation
discord-backup copied to clipboard

Store users separately from messages

Open adroitwhiz opened this issue 3 years ago • 1 comments

Currently, the username and user avatar for the sender of a message are stored as part of the message. This takes up a lot of space in the serialized JSON (avatar URLs are longer than the average message), and precludes the ability to save avatars using Base64 (you'd save the entire image in Base64 once per message, resulting in infeasibly large backups).

Instead, during the backup, we can keep a map from user IDs to users, and store the poster's ID in the serialized message instead of the user data itself. When going over each message, we can simply check if we've encountered the poster before, and save their data if not.

adroitwhiz avatar May 07 '21 18:05 adroitwhiz

Indeed it would be much more efficient. Feel free to submit a pull request if you know how to code this, otherwise I'll do it when I have time 👍

Androz2091 avatar May 15 '21 09:05 Androz2091