diff --git a/discord/guild.py b/discord/guild.py index 3cfbce662..7d9e7a473 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -3757,24 +3757,20 @@ class Guild(Hashable): else: fields['color'] = actual_colour.value - - actual_secondary_colour = secondary_colour or secondary_color + actual_secondary_colour = secondary_colour or secondary_color or Colour.default() actual_tertiary_colour = tertiary_colour or tertiary_color colours = { 'primary_color': fields['color'], } - + if actual_secondary_colour is not MISSING: - if actual_secondary_colour is None: - colours['secondary_color'] = None - elif isinstance(actual_secondary_colour, int): + if isinstance(actual_secondary_colour, int): colours['secondary_color'] = actual_secondary_colour else: colours['secondary_color'] = actual_secondary_colour.value - if actual_tertiary_colour is not MISSING: - if actual_tertiary_colour is None: - colours['tertiary_color'] = None - elif isinstance(actual_tertiary_colour, int): + + if actual_tertiary_colour is not MISSING and actual_tertiary_colour is not None: + if isinstance(actual_tertiary_colour, int): colours['tertiary_color'] = actual_tertiary_colour else: colours['tertiary_color'] = actual_tertiary_colour.value diff --git a/discord/role.py b/discord/role.py index 9a119a79a..ed0bdf430 100644 --- a/discord/role.py +++ b/discord/role.py @@ -222,7 +222,6 @@ class Role(Hashable): 'tags', '_flags', '_state', - '_primary_colour', '_secondary_colour', '_tertiary_colour', ) @@ -288,7 +287,6 @@ class Role(Hashable): self.tags: Optional[RoleTags] self._flags: int = data.get('flags', 0) colors = data.get('colors', {}) - self._primary_colour = colors.get('primary_colour', None) self._secondary_colour = colors.get('secondary_colour', None) self._tertiary_colour = colors.get('tertiary_colour', None) @@ -330,16 +328,6 @@ class Role(Hashable): me = self.guild.me return not self.is_default() and not self.managed and (me.top_role > self or me.id == self.guild.owner_id) - @property - def primary_colour(self) -> Optional[Colour]: - """Optional[:class:`Colour`]: The role's primary colour.""" - return Colour(self._primary_colour) if self._primary_colour is not None else None - - @property - def primary_color(self) -> Optional[Colour]: - """Optional[:class:`Colour`]: Alias for :attr:`primary_colour`.""" - return self.primary_colour - @property def secondary_colour(self) -> Optional[Colour]: """Optional[:class:`Colour`]: The role's secondary colour.""" @@ -568,7 +556,10 @@ class Role(Hashable): colours = { 'primary_color': payload['color'], } - + + actual_secondary_colour = secondary_colour or secondary_color + actual_tertiary_colour = tertiary_colour or tertiary_color + if actual_secondary_colour is not MISSING: if actual_secondary_colour is None: colours['secondary_color'] = None diff --git a/discord/types/role.py b/discord/types/role.py index d32de8803..9614aa07a 100644 --- a/discord/types/role.py +++ b/discord/types/role.py @@ -34,6 +34,8 @@ class Role(TypedDict): id: Snowflake name: str color: int + secondary_color: NotRequired[Optional[int]] + tertiary_color: NotRequired[Optional[int]] hoist: bool position: int permissions: str