zekroTJA / dgrs

A (WIP) DiscordGo state manager using Redis.
https://pkg.go.dev/github.com/zekrotja/dgrs
MIT License
8 stars 1 forks source link

Roles are not updated in guild object #3

Open zekroTJA opened 3 years ago

AriaFantom commented 1 year ago

Can you show any examples of it

zekroTJA commented 1 year ago

As you can see here, when roles are added, updated or removed, only the roles itself are updated in the cache.

https://github.com/zekroTJA/dgrs/blob/51033d725a31cd60bf5a2a1acd08b92954001c73/state.go#L232-L237

https://github.com/zekroTJA/dgrs/blob/51033d725a31cd60bf5a2a1acd08b92954001c73/roles.go#L5-L9

The discordgo.Guild object has a Property Roles which keeps a list of references to role objects related to that guild. These are not updated in the Guild object in the Redis cache though, which might be a bit inconvenient when working with the guild object from the cache.

https://github.com/bwmarrin/discordgo/blob/f184824b8c4412b4450df468dd80b6047ab52f5b/structs.go#L735

I am not really sure though if the guild object should also be updated in the cache when a role of the guild has been updated.

AriaFantom commented 5 months ago

I guess if it is linked with guild (eg role) that chache show be updated? And also do you have seperate cache for Role?