Skip to content
Open
Show file tree
Hide file tree
Changes from 18 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.
2 changes: 1 addition & 1 deletion disnake/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"VoiceChannelEffectAnimationType",
"MessageReferenceType",
"SeparatorSpacing",
"NameplatePalette",
"NameplatePalette"
)

EnumMetaT = TypeVar("EnumMetaT", bound="Type[EnumMeta]")
Expand Down
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_gradient(self) -> bool:
"""
Whether the role has any gradient (custom or holographic).

.. versionadded:: 2.12

:return type: :class:`bool`
"""
return self.secondary_color is not None

def is_holographic(self) -> bool:
"""
Whether the role has a 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