Skip to content

feat: Add the shared client theme object on message sent and in message object#3209

Open
UnBonWhisky wants to merge 6 commits intoPycord-Development:masterfrom
UnBonWhisky:master
Open

feat: Add the shared client theme object on message sent and in message object#3209
UnBonWhisky wants to merge 6 commits intoPycord-Development:masterfrom
UnBonWhisky:master

Conversation

@UnBonWhisky
Copy link
Copy Markdown
Contributor

@UnBonWhisky UnBonWhisky commented Apr 20, 2026

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

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.
  • AI Usage has been disclosed.
    • If AI has been used, I understand fully what the code does

@UnBonWhisky UnBonWhisky requested review from a team and Lulalaby April 20, 2026 23:17
@UnBonWhisky UnBonWhisky requested a review from plun1331 April 20, 2026 23:17
@github-project-automation github-project-automation Bot moved this to Todo in Pycord Apr 20, 2026
@UnBonWhisky UnBonWhisky requested a review from a team as a code owner April 20, 2026 23:17
@pycord-app
Copy link
Copy Markdown

pycord-app Bot commented Apr 20, 2026

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3209/head:pr-3209
git checkout pr-3209

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3209/head

@UnBonWhisky UnBonWhisky changed the title Add the shared client theme object on message sent and in message object feat: Add the shared client theme object on message sent and in message object Apr 20, 2026
@UnBonWhisky
Copy link
Copy Markdown
Contributor Author

Note : shared client theme should not work with components v2 (source: Discord docs) but it works.

{40C79FCB-7F68-49B9-BBA9-95913F88ABEE}

@Paillat-dev Paillat-dev self-assigned this Apr 22, 2026
@Paillat-dev Paillat-dev self-requested a review April 22, 2026 13:53
Comment thread discord/enums.py


class SharedClientThemeBaseType(Enum):
"""The base theme mode of a :class:`SharedClientTheme`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one we don't need imo

if len(normalized) > 5:
raise ValueError("colors must contain at most 5 colors")

if not isinstance(gradient_angle, int) or isinstance(gradient_angle, bool):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Idem

DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need it here I think

Comment thread docs/api/data_classes.rst
Shared Client Theme
~~~~~~~~~~~~~~~~~~~

.. attributetable:: SharedClientTheme
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it actually a data class ?

Copy link
Copy Markdown
Member

@plun1331 plun1331 left a comment

Choose a reason for hiding this comment

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

Since shared client theme is constructible, I feel like we should add methods like set_colors and whatnot to make that easier

Comment thread discord/http.py
role,
scheduled_events,
)
from .types import shared_client_theme as shared_client_theme_type
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

merge these imports

Comment thread CHANGELOG.md

- Support for **Python 3.14**.
([#2948](https://github.com/Pycord-Development/pycord/pull/2948))
- Added `SharedClientTheme` support for sending client themes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- Added `SharedClientTheme` support for sending client themes.
- Added `SharedClientTheme` object for sending and receiving client themes.

Comment on lines +92 to +93
if len(normalized) > 5:
raise ValueError("colors must contain at most 5 colors")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Check both of these first before coercion

):
raise TypeError("base_theme must be a SharedClientThemeBaseType or None")

self.colors: list[str] = normalized
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A way to easily get these as int or Color would be nice


def __init__(
self,
colors: Iterable[ColourLike],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add colours as an alias

):
raise TypeError("base_theme must be a SharedClientThemeBaseType or None")

self.colors: list[str] = normalized
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add colours as an alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants