Skip to content

Commit

Permalink
Document new SKUProductLine enum
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Jan 2, 2024
1 parent c507bc2 commit a74ba60
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ def __int__(self) -> int:

class SKUProductLine(Enum):
premium = 1
guild_premium = 2
premium_guild = 2
iap = 3
guild_role = 4
guild_product = 5
Expand Down
4 changes: 2 additions & 2 deletions discord/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ def _update(self, data: StoreListingPayload, application: Optional[PartialApplic
self.child_skus: List[SKU] = [SKU(data=sku, state=state) for sku in data.get('child_skus', [])]
self.alternative_skus: List[SKU] = [SKU(data=sku, state=state) for sku in data.get('alternative_skus', [])]
self.entitlement_branch_id: Optional[int] = _get_as_snowflake(data, 'entitlement_branch_id')
self.guild: Optional[Guild] = state.create_guild(data['guild']) if 'guild' in data else None
self.guild: Optional[Guild] = state.create_guild(data['guild']) if 'guild' in data else None # type: ignore
self.published: bool = data.get('published', True)
self.published_at: Optional[datetime] = parse_time(data['published_at']) if 'published_at' in data else None
self.unpublished_at: Optional[datetime] = parse_time(data['unpublished_at']) if 'unpublished_at' in data else None
Expand Down Expand Up @@ -1279,7 +1279,7 @@ def _update(self, data: SKUPayload) -> None:
self.genres: List[SKUGenre] = [try_enum(SKUGenre, genre) for genre in data.get('genres', [])]
self.available_regions: Optional[List[str]] = data.get('available_regions')
self.content_ratings: List[ContentRating] = (
[ContentRating.from_dict(data['content_rating'], data['content_rating_agency'])]
[ContentRating.from_dict(data['content_rating'], data['content_rating_agency'])] # type: ignore
if 'content_rating' in data and 'content_rating_agency' in data
else ContentRating.from_dicts(data.get('content_ratings'))
)
Expand Down
34 changes: 34 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4277,6 +4277,40 @@ of :class:`enum.Enum`.

The SKU is available to VIP users only.

.. class:: SKUProductLine

Represents the product line of a SKU.

.. versionadded:: 2.1

.. attribute:: premium

The SKU is a premium (Nitro) product.

.. attribute:: premium_guild

The SKU is a premium guild product.

.. attribute:: iap

The SKU is an embedded in-app purchase.

.. attribute:: guild_role

The SKU is a guild role subscription.

.. attribute:: guild_product

The SKU is a guild product.

.. attribute:: application

The SKU is an application subscription.

.. attribute:: collectible

The SKU is a collectible avatar decoration or profile effect.

.. class:: SKUFeature

Represents a feature of a SKU.
Expand Down

0 comments on commit a74ba60

Please sign in to comment.