aquelemiguel / parrot

🦜 A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.
MIT License
136 stars 44 forks source link

feat: add guild settings de/serialization #237

Closed joao-conde closed 1 year ago

joao-conde commented 1 year ago
- -
Issue https://github.com/aquelemiguel/parrot/issues/124
Dependencies Add serde crate.
Decisions Derive Serialize and Deserialize traits for the GuildSettings struct. Implement a save() and load() methods. Load when the bot is summoned. Save whenever a setting changes. Save parrot data to /data/ and settings to /data/settings.
afonsojramos commented 1 year ago

@joao-conde Let's goooo

joao-conde commented 1 year ago

@afonsojramos something we could do later in another PR is to add to Docker a volume maybe, for /data/settings so that we can save and re-use across deloys this folder, no? I dont know how we would make it persist across Docker builds and redeploys tho.

afonsojramos commented 1 year ago

@joao-conde Indeed! That definitely makes sense and would be something we would want to do!

aquelemiguel commented 1 year ago

Sorry to keep you waiting, @joao-conde, will review this over the weekend.

joao-conde commented 1 year ago

@aquelemiguel I did some tests, try to break it on your end, but I think this is it

joao-conde commented 1 year ago

Well spotted @aquelemiguel ;) Forgot to truncate previous file content.

aquelemiguel commented 1 year ago

Well spotted @aquelemiguel ;) Forgot to truncate previous file content.

Yeah, that seems to have done it! 🎉 I'll fmt and merge away, good work on the quick fix!