[go: up one dir, main page]

Set defaults and fallbacks for staff roles

Set default values for select guild staff role config when fallback roles for them exist on the guild. Update privileged role checks to query the guild's role cache for them, too.

  • staff_role: "staff"
  • global_moderator_role: "mod"
  • admin_role: "admin"

Caching these fallback roles is critical.

Guild config is cached on bot initialization, and we could make use of that, but setting keys during guild init alone would be error prone. If those roles come into existence after the bot joins, it wouldn't know about them.

Setting the guild DB config for these items during guild init and on matching role creation events would be ideal. This way, the role checks can continue querying for the guild config keys, and fall back to searching via the Discord API only in rare cases.