diff --git a/discord/activity.py b/discord/activity.py index 82b979b24..c692443f9 100644 --- a/discord/activity.py +++ b/discord/activity.py @@ -162,6 +162,10 @@ class Activity(BaseActivity): The user's current state. For example, "In Game". details: Optional[:class:`str`] The detail of the user's current activity. + platform: Optional[:class:`str`] + The user's current platform. + + .. versionadded:: 2.4 timestamps: :class:`dict` A dictionary of timestamps. It contains the following optional keys: @@ -197,6 +201,7 @@ class Activity(BaseActivity): 'state', 'details', 'timestamps', + 'platform', 'assets', 'party', 'flags', @@ -215,6 +220,7 @@ class Activity(BaseActivity): self.state: Optional[str] = kwargs.pop('state', None) self.details: Optional[str] = kwargs.pop('details', None) self.timestamps: ActivityTimestamps = kwargs.pop('timestamps', {}) + self.platform: Optional[str] = kwargs.pop('platform', None) self.assets: ActivityAssets = kwargs.pop('assets', {}) self.party: ActivityParty = kwargs.pop('party', {}) self.application_id: Optional[int] = _get_as_snowflake(kwargs, 'application_id') @@ -238,6 +244,7 @@ class Activity(BaseActivity): ('type', self.type), ('name', self.name), ('url', self.url), + ('platform', self.platform), ('details', self.details), ('application_id', self.application_id), ('session_id', self.session_id), @@ -351,13 +358,30 @@ class Game(BaseActivity): ----------- name: :class:`str` The game's name. + platform: Optional[:class:`str`] + Where the user is playing from (ie. PS5, Xbox). + + .. versionadded:: 2.4 + + assets: :class:`dict` + A dictionary representing the images and their hover text of a game. + It contains the following optional keys: + + - ``large_image``: A string representing the ID for the large image asset. + - ``large_text``: A string representing the text when hovering over the large image asset. + - ``small_image``: A string representing the ID for the small image asset. + - ``small_text``: A string representing the text when hovering over the small image asset. + + .. versionadded:: 2.4 """ - __slots__ = ('name', '_end', '_start') + __slots__ = ('name', '_end', '_start', 'platform', 'assets') def __init__(self, name: str, **extra: Any) -> None: super().__init__(**extra) self.name: str = name + self.platform: Optional[str] = extra.get('platform') + self.assets: ActivityAssets = extra.get('assets', {}) or {} try: timestamps: ActivityTimestamps = extra['timestamps'] @@ -408,6 +432,8 @@ class Game(BaseActivity): 'type': ActivityType.playing.value, 'name': str(self.name), 'timestamps': timestamps, + 'platform': str(self.platform) if self.platform else None, + 'assets': self.assets, } def __eq__(self, other: object) -> bool: diff --git a/discord/types/activity.py b/discord/types/activity.py index 57fb86d4a..f57334936 100644 --- a/discord/types/activity.py +++ b/discord/types/activity.py @@ -93,6 +93,7 @@ class Activity(_BaseActivity, total=False): state: Optional[str] details: Optional[str] timestamps: ActivityTimestamps + platform: Optional[str] assets: ActivityAssets party: ActivityParty application_id: Snowflake