feat: Add the shared client theme object on message sent and in message object#3209
feat: Add the shared client theme object on message sent and in message object#3209UnBonWhisky wants to merge 6 commits intoPycord-Development:masterfrom
Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3209/head:pr-3209
git checkout pr-3209This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3209/head |
|
Note : shared client theme should not work with components v2 (source: Discord docs) but it works.
|
|
|
||
|
|
||
| class SharedClientThemeBaseType(Enum): | ||
| """The base theme mode of a :class:`SharedClientTheme`. |
There was a problem hiding this comment.
Having the docs here is not necessary I think since you have them in enums.rst anyways
| if TYPE_CHECKING: | ||
| from .types.shared_client_theme import SharedClientTheme as SharedClientThemePayload | ||
|
|
||
| ColourLike = Union[Colour, str, int] |
There was a problem hiding this comment.
Use | syntax since Pycord is 3.10 plus
| if not 0 <= gradient_angle <= 360: | ||
| raise ValueError("gradient_angle must be between 0 and 360") | ||
|
|
||
| if not isinstance(base_mix, int) or isinstance(base_mix, bool): |
| if len(normalized) > 5: | ||
| raise ValueError("colors must contain at most 5 colors") | ||
|
|
||
| if not isinstance(gradient_angle, int) or isinstance(gradient_angle, bool): |
| DEALINGS IN THE SOFTWARE. | ||
| """ | ||
|
|
||
| from __future__ import annotations |
There was a problem hiding this comment.
We don't need it here I think
| Shared Client Theme | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| .. attributetable:: SharedClientTheme |
There was a problem hiding this comment.
Is it actually a data class ?
plun1331
left a comment
There was a problem hiding this comment.
Since shared client theme is constructible, I feel like we should add methods like set_colors and whatnot to make that easier
| role, | ||
| scheduled_events, | ||
| ) | ||
| from .types import shared_client_theme as shared_client_theme_type |
|
|
||
| - Support for **Python 3.14**. | ||
| ([#2948](https://github.com/Pycord-Development/pycord/pull/2948)) | ||
| - Added `SharedClientTheme` support for sending client themes. |
There was a problem hiding this comment.
| - Added `SharedClientTheme` support for sending client themes. | |
| - Added `SharedClientTheme` object for sending and receiving client themes. |
| if len(normalized) > 5: | ||
| raise ValueError("colors must contain at most 5 colors") |
There was a problem hiding this comment.
Check both of these first before coercion
| ): | ||
| raise TypeError("base_theme must be a SharedClientThemeBaseType or None") | ||
|
|
||
| self.colors: list[str] = normalized |
There was a problem hiding this comment.
A way to easily get these as int or Color would be nice
|
|
||
| def __init__( | ||
| self, | ||
| colors: Iterable[ColourLike], |
| ): | ||
| raise TypeError("base_theme must be a SharedClientThemeBaseType or None") | ||
|
|
||
| self.colors: list[str] = normalized |

Caution
Feature freeze is active, as described by our Release Schedule.
Summary
It adds the object of shared client theme described here by Discord.
Yes AI has been used (partially)
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.