Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1379.feature.rst
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions disnake/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment on lines +369 to +371
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about using the word "custom" here, it implies the existence of non-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."""
Expand Down
Loading