diamondburned / arikawa

A Golang library and framework for the Discord API.
ISC License
469 stars 55 forks source link

state: Use store roles for calculating overrides #411

Closed twoscott closed 10 months ago

twoscott commented 10 months ago

Currently, the state.Permissions() helper method uses Guild.Roles to calculate the permission overrides. Guild.Roles aren't updated by Guild Role Update events, so this can result in the helper method giving unexpected results when a role was updated, but no Guild Update event has happened since. This change pulls roles from store.Roles() in the helper method, and passes them to the CalcOverrides method, which now uses the passed in roles instead of Guild.Roles.