From 24fc05b3db994d4654c1994f6bad5a3fcdbc1529 Mon Sep 17 00:00:00 2001 From: DeltaXWizard <33706469+deltaxwizard@users.noreply.github.com> Date: Sat, 16 Jul 2022 16:16:26 -0400 Subject: [PATCH] feat: Remove PresenceButton object. --- interactions/api/models/presence.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/interactions/api/models/presence.py b/interactions/api/models/presence.py index 9f1003437..ad01dde18 100644 --- a/interactions/api/models/presence.py +++ b/interactions/api/models/presence.py @@ -14,7 +14,6 @@ "PresenceTimestamp", "PresenceActivity", "PresenceActivityType", - "PresenceButtons", "ClientPresence", ) @@ -64,19 +63,6 @@ class PresenceSecrets(DictSerializerMixin): match: Optional[str] = field(default=None) -@define() -class PresenceButtons(DictSerializerMixin): - """ - A class object representing the buttons of a presence. - - :ivar str label: Text of the button - :ivar str url: URL of the button - """ - - label: str = field() - url: str = field() - - @define() class PresenceTimestamp(DictSerializerMixin): """ @@ -109,8 +95,11 @@ class PresenceActivity(DictSerializerMixin): A class object representing the current activity data of a presence. .. note:: - When using this model to instantiate alongside the client, if you provide a type 1 ( or PresenceActivityType.STREAMING ), then - the ``url`` attribute is necessary. + When using this model to instantiate alongside the client, if you provide a type 1 ( or PresenceActivityType.STREAMING ), + then the ``url`` attribute is necessary. + + The ``button`` attribute technically contains an object denoting Presence buttons. However, the gateway dispatches these + as strings (of button labels) as bots don't read the button URLs. :ivar str name: The activity name :ivar Union[int, PresenceActivityType] type: The activity type @@ -126,7 +115,7 @@ class PresenceActivity(DictSerializerMixin): :ivar Optional[PresenceSecrets] secrets?: for RPC join/spectate :ivar Optional[bool] instance?: A status denoting if the activity is a game session :ivar Optional[int] flags?: activity flags - :ivar Optional[List[PresenceButtons]] buttons?: Custom buttons shown in the RPC. + :ivar Optional[List[str]] buttons?: Custom button labels shown in the status, if any. """ name: str = field() @@ -143,9 +132,7 @@ class PresenceActivity(DictSerializerMixin): secrets: Optional[PresenceSecrets] = field(converter=PresenceSecrets, default=None) instance: Optional[bool] = field(default=None) flags: Optional[int] = field(default=None) - buttons: Optional[List[PresenceButtons]] = field( - converter=convert_list(PresenceButtons), default=None - ) + buttons: Optional[List[str]] = field(default=None) # TODO: document/investigate what these do. user: Optional[Any] = field(default=None) users: Optional[Any] = field(default=None)