GrafeasGroup / buttercup

Our personal assistant in Discord
MIT License
5 stars 2 forks source link

Cache user timezones #161

Open TimJentzsch opened 2 years ago

TimJentzsch commented 2 years ago

We currently use the timezone of the user executing the command to calculate the localized data. Instead, we should use the timezone of the user whose data is being shown.

To accomplish this, we need to cache the timezones. Whenever a user executes a command or changes their nickname, their timezone should be extracted from their username and cached in a simple dict. The extract_utc_offset function should then also take the username that the data is about and return their timezone.

This approach won't work across restarts, but I think that's fine.