5858from .scheduled_events import ScheduledEvent
5959from .sticker import GuildSticker , StickerItem
6060from .utils import warn_deprecated
61+ from .shared_client_theme import SharedClientThemeBaseType
6162
6263__all__ = (
6364 "Snowflake" ,
8990 from .member import Member
9091 from .message import Message , MessageReference , PartialMessage
9192 from .poll import Poll
93+ from .shared_client_theme import SharedClientTheme
9294 from .state import ConnectionState
9395 from .threads import Thread
9496 from .types .channel import Channel as ChannelPayload
@@ -1388,6 +1390,7 @@ async def send(
13881390 suppress : bool = ...,
13891391 suppress_embeds : bool = ...,
13901392 silent : bool = ...,
1393+ shared_client_theme : SharedClientTheme = ...,
13911394 ) -> Message : ...
13921395
13931396 @overload
@@ -1410,6 +1413,7 @@ async def send(
14101413 suppress : bool = ...,
14111414 suppress_embeds : bool = ...,
14121415 silent : bool = ...,
1416+ shared_client_theme : SharedClientTheme = ...,
14131417 ) -> Message : ...
14141418
14151419 @overload
@@ -1432,6 +1436,7 @@ async def send(
14321436 suppress : bool = ...,
14331437 suppress_embeds : bool = ...,
14341438 silent : bool = ...,
1439+ shared_client_theme : SharedClientTheme = ...,
14351440 ) -> Message : ...
14361441
14371442 @overload
@@ -1454,6 +1459,7 @@ async def send(
14541459 suppress : bool = ...,
14551460 suppress_embeds : bool = ...,
14561461 silent : bool = ...,
1462+ shared_client_theme : SharedClientTheme = ...,
14571463 ) -> Message : ...
14581464
14591465 async def send (
@@ -1477,6 +1483,7 @@ async def send(
14771483 suppress = None ,
14781484 suppress_embeds = None ,
14791485 silent = None ,
1486+ shared_client_theme = None ,
14801487 ):
14811488 """|coro|
14821489
@@ -1496,6 +1503,9 @@ async def send(
14961503 parameter should be used with a :class:`list` of :class:`~discord.Embed` objects.
14971504 **Specifying both parameters will lead to an exception**.
14981505
1506+ To upload a shared client theme, the ``shared_client_theme`` parameter should be used
1507+ with a :class:`~discord.SharedClientTheme` object.
1508+
14991509 Parameters
15001510 ----------
15011511 content: Optional[:class:`str`]
@@ -1568,6 +1578,10 @@ async def send(
15681578 The poll to send.
15691579
15701580 .. versionadded:: 2.6
1581+ shared_client_theme: :class:`SharedClientTheme`
1582+ The shared client theme to send.
1583+
1584+ .. versionadded:: 2.8
15711585
15721586 Returns
15731587 -------
@@ -1585,13 +1599,35 @@ async def send(
15851599 you specified both ``file`` and ``files``,
15861600 or you specified both ``embed`` and ``embeds``,
15871601 or the ``reference`` object is not a :class:`~discord.Message`,
1588- :class:`~discord.MessageReference` or :class:`~discord.PartialMessage`.
1602+ :class:`~discord.MessageReference` or :class:`~discord.PartialMessage`,
1603+ or the ``shared_client_theme`` object does not meet the required criteria.
15891604 """
15901605
15911606 channel = await self ._get_channel ()
15921607 state = self ._state
15931608 content = str (content ) if content is not None else None
15941609
1610+ if shared_client_theme is not None :
1611+ if shared_client_theme .colors is None or len (shared_client_theme .colors ) == 0 :
1612+ raise InvalidArgument ("shared_client_theme must have at least one color" )
1613+ if len (shared_client_theme .colors ) > 5 :
1614+ raise InvalidArgument ("shared_client_theme cannot have more than 5 colors" )
1615+
1616+ if shared_client_theme .gradient_angle is None :
1617+ raise InvalidArgument ("shared_client_theme must have a gradient angle" )
1618+ if shared_client_theme .gradient_angle < 0 or shared_client_theme .gradient_angle > 360 :
1619+ raise InvalidArgument ("shared_client_theme gradient angle must be between 0 and 360 degrees" )
1620+
1621+ if shared_client_theme .base_mix is None :
1622+ raise InvalidArgument ("shared_client_theme must have a base mix value" )
1623+ if shared_client_theme .base_mix < 0 or shared_client_theme .base_mix > 100 :
1624+ raise InvalidArgument ("shared_client_theme base mix must be between 0 and 100" )
1625+
1626+ if shared_client_theme .base_theme is not None and not isinstance (shared_client_theme .base_theme , SharedClientThemeBaseType ):
1627+ raise InvalidArgument ("shared_client_theme base theme must be a SharedClientThemeBaseType enum value" )
1628+
1629+ shared_client_theme = shared_client_theme .to_dict ()
1630+
15951631 if embed is not None and embeds is not None :
15961632 raise InvalidArgument (
15971633 "cannot pass both embed and embeds parameter to send()"
@@ -1706,6 +1742,7 @@ async def send(
17061742 components = components ,
17071743 flags = flags .value ,
17081744 poll = poll ,
1745+ shared_client_theme = shared_client_theme ,
17091746 )
17101747 finally :
17111748 for f in files :
@@ -1725,6 +1762,7 @@ async def send(
17251762 components = components ,
17261763 flags = flags .value ,
17271764 poll = poll ,
1765+ shared_client_theme = shared_client_theme ,
17281766 )
17291767
17301768 ret = state .create_message (channel = channel , data = data )
0 commit comments