Skip to content

Commit

Permalink
feat: Remove PresenceButton object. (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
FayeDel committed Jul 16, 2022
1 parent 0632809 commit 61f50d3
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions interactions/api/models/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"PresenceTimestamp",
"PresenceActivity",
"PresenceActivityType",
"PresenceButtons",
"ClientPresence",
)

Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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)
Expand Down

0 comments on commit 61f50d3

Please sign in to comment.