diff --git a/changelog/1379.feature.rst b/changelog/1379.feature.rst new file mode 100644 index 0000000000..afcb887731 --- /dev/null +++ b/changelog/1379.feature.rst @@ -0,0 +1 @@ +Add :attr:`Role.has_gradient` and :attr:`Role.is_holographic` properties to check whether a role has a gradient or is holographic. diff --git a/disnake/role.py b/disnake/role.py index 461a11abd2..0ba670caf2 100644 --- a/disnake/role.py +++ b/disnake/role.py @@ -366,6 +366,26 @@ def is_assignable(self) -> bool: and (me.top_role > self or me.id == self.guild.owner_id) ) + def has_custom_gradient(self) -> bool: + """ + Whether the role has custom gradient. + + .. versionadded:: 2.12 + + :return type: :class:`bool` + """ + return self.secondary_color is not None and self.tertiary_color is None + + def has_holographic_gradient(self) -> bool: + """ + Whether the role has holographic gradient. + + .. versionadded:: 2.12 + + :return type: :class:`bool` + """ + return self.tertiary_color is not None + @property def permissions(self) -> Permissions: """:class:`Permissions`: Returns the role's permissions."""