Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multisubscriptions #10042

Merged
merged 3 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions discord/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class Subscription(Hashable):
canceled_at: Optional[:class:`datetime.datetime`]
When the subscription was canceled.
This is only available for subscriptions with a :attr:`status` of :attr:`SubscriptionStatus.inactive`.
renewal_sku_ids: List[:class:`int`]
The IDs of the SKUs that the user is going to be subscribed to when renewing.
"""

__slots__ = (
Expand All @@ -75,6 +77,7 @@ class Subscription(Hashable):
'current_period_end',
'status',
'canceled_at',
'renewal_sku_ids',
)

def __init__(self, *, state: ConnectionState, data: SubscriptionPayload):
Expand All @@ -88,6 +91,7 @@ def __init__(self, *, state: ConnectionState, data: SubscriptionPayload):
self.current_period_end: datetime.datetime = utils.parse_time(data['current_period_end'])
self.status: SubscriptionStatus = try_enum(SubscriptionStatus, data['status'])
self.canceled_at: Optional[datetime.datetime] = utils.parse_time(data['canceled_at'])
self.renewal_sku_ids: List[int] = list(map(int, data['renewal_sku_ids'] or []))

def __repr__(self) -> str:
return f'<Subscription id={self.id} user_id={self.user_id} status={self.status!r}>'
Expand Down
1 change: 1 addition & 0 deletions discord/types/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ class Subscription(TypedDict):
current_period_end: str
status: SubscriptionStatus
canceled_at: Optional[str]
renewal_sku_ids: List[Snowflake]
Loading