Skip to content

Commit

Permalink
feat: update docs and support state for custom statuses (#1527)
Browse files Browse the repository at this point in the history
* feat: update docs and support state for custom statuses

* docs: little adjustments to docs
  • Loading branch information
AstreaTSS authored Aug 15, 2023
1 parent f3ba43d commit 79ef2cc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions interactions/models/discord/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Activity(DictSerializationMixin):
details: Optional[str] = attrs.field(repr=False, default=None)
"""What the player is currently doing"""
state: Optional[str] = attrs.field(repr=False, default=None)
"""The user's current party status"""
"""The user's current party status, or text used for a custom status if type is set as CUSTOM"""
emoji: Optional[PartialEmoji] = attrs.field(repr=False, default=None, converter=optional(PartialEmoji.from_dict))
"""The emoji used for a custom status"""
party: Optional[ActivityParty] = attrs.field(repr=False, default=None, converter=optional(ActivityParty.from_dict))
Expand All @@ -99,20 +99,23 @@ class Activity(DictSerializationMixin):
"""The custom buttons shown in the Rich Presence (max 2)"""

@classmethod
def create(cls, name: str, type: ActivityType = ActivityType.GAME, url: Optional[str] = None) -> "Activity":
def create(
cls, name: str, type: ActivityType = ActivityType.GAME, url: Optional[str] = None, state: Optional[str] = None
) -> "Activity":
"""
Creates an activity object for the bot.
Args:
name: The new activity's name
type: Type of activity to create
url: Stream link for the activity
state: Current party status, or text used for a custom status if type is set as CUSTOM
Returns:
The new activity object
"""
return cls(name=name, type=type, url=url)
return cls(name=name, type=type, url=url, state=state)

def to_dict(self) -> dict:
return dict_filter_none({"name": self.name, "type": self.type, "url": self.url})
return dict_filter_none({"name": self.name, "type": self.type, "state": self.state, "url": self.url})

0 comments on commit 79ef2cc

Please sign in to comment.