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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ These changes are available on the `master` branch, but have not yet been releas

### Added

- Added `RoleColours.HOLOGRAPHIC_PRIMARY`, `RoleColours.HOLOGRAPHIC_SECONDARY`, and
`RoleColours.HOLOGRAPHIC_TERTIARY` class constants.
([#3268](https://github.com/Pycord-Development/pycord/pull/3268))

### Changed

### Fixed

- Fixed an `AttributeError` when using `RoleColours.is_holographic` and `secondary` or
`tertiary` is `None`.
([#3268](https://github.com/Pycord-Development/pycord/pull/3268))
- Fix error message for `Guild.create_sticker`.
([#3263](https://github.com/Pycord-Development/pycord/pull/3263))
- Fix typehint for `SlashCommandGroup.__new__`.
Expand Down
30 changes: 23 additions & 7 deletions discord/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,19 @@ class RoleColours:
secondary: Optional[:class:`Colour`]
The secondary colour of the role.
tertiary: Optional[:class:`Colour`]
The tertiary colour of the role. At the moment, only `16761760` is allowed.
The tertiary colour of the role. At the moment, only :attr:`HOLOGRAPHIC_TERTIARY` is allowed.
HOLOGRAPHIC_PRIMARY: :class:`Colour`
The primary colour used for holographic roles.
HOLOGRAPHIC_SECONDARY: :class:`Colour`
The secondary colour used for holographic roles.
HOLOGRAPHIC_TERTIARY: :class:`Colour`
The tertiary colour used for holographic roles.
"""

HOLOGRAPHIC_PRIMARY = Colour(11127295)
HOLOGRAPHIC_SECONDARY = Colour(16759788)
HOLOGRAPHIC_TERTIARY = Colour(16761760)

def __init__(
self,
primary: Colour,
Expand Down Expand Up @@ -362,20 +372,26 @@ def default(cls) -> RoleColours:
def holographic(cls) -> RoleColours:
"""Returns a :class:`RoleColours` that makes the role look holographic.

Currently holographic roles are only supported with colours 11127295, 16759788, and 16761760.
Currently holographic roles are only supported with colours defined in
:attr:`HOLOGRAPHIC_PRIMARY`, :attr:`HOLOGRAPHIC_SECONDARY`, and :attr:`HOLOGRAPHIC_TERTIARY`.
"""
return cls(Colour(11127295), Colour(16759788), Colour(16761760))
return cls(
cls.HOLOGRAPHIC_PRIMARY,
cls.HOLOGRAPHIC_SECONDARY,
cls.HOLOGRAPHIC_TERTIARY,
)

@property
def is_holographic(self) -> bool:
"""Whether the role is holographic.

Currently roles are holographic when colours are set to 11127295, 16759788, and 16761760.
Currently roles are holographic when colours are set to
:attr:`HOLOGRAPHIC_PRIMARY`, :attr:`HOLOGRAPHIC_SECONDARY`, and :attr:`HOLOGRAPHIC_TERTIARY`.
"""
return (
self.primary.value == 11127295
and self.secondary.value == 16759788
and self.tertiary.value == 16761760
self.primary == self.HOLOGRAPHIC_PRIMARY
and self.secondary == self.HOLOGRAPHIC_SECONDARY
and self.tertiary == self.HOLOGRAPHIC_TERTIARY
)

def __repr__(self) -> str:
Expand Down
Loading