Skip to content

Commit 79ef2cc

Browse files
authored
feat: update docs and support state for custom statuses (#1527)
* feat: update docs and support state for custom statuses * docs: little adjustments to docs
1 parent f3ba43d commit 79ef2cc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

interactions/models/discord/activity.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Activity(DictSerializationMixin):
7878
details: Optional[str] = attrs.field(repr=False, default=None)
7979
"""What the player is currently doing"""
8080
state: Optional[str] = attrs.field(repr=False, default=None)
81-
"""The user's current party status"""
81+
"""The user's current party status, or text used for a custom status if type is set as CUSTOM"""
8282
emoji: Optional[PartialEmoji] = attrs.field(repr=False, default=None, converter=optional(PartialEmoji.from_dict))
8383
"""The emoji used for a custom status"""
8484
party: Optional[ActivityParty] = attrs.field(repr=False, default=None, converter=optional(ActivityParty.from_dict))
@@ -99,20 +99,23 @@ class Activity(DictSerializationMixin):
9999
"""The custom buttons shown in the Rich Presence (max 2)"""
100100

101101
@classmethod
102-
def create(cls, name: str, type: ActivityType = ActivityType.GAME, url: Optional[str] = None) -> "Activity":
102+
def create(
103+
cls, name: str, type: ActivityType = ActivityType.GAME, url: Optional[str] = None, state: Optional[str] = None
104+
) -> "Activity":
103105
"""
104106
Creates an activity object for the bot.
105107
106108
Args:
107109
name: The new activity's name
108110
type: Type of activity to create
109111
url: Stream link for the activity
112+
state: Current party status, or text used for a custom status if type is set as CUSTOM
110113
111114
Returns:
112115
The new activity object
113116
114117
"""
115-
return cls(name=name, type=type, url=url)
118+
return cls(name=name, type=type, url=url, state=state)
116119

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

0 commit comments

Comments
 (0)