32
32
from .flags import SKUFlags
33
33
from .iterators import SubscriptionIterator
34
34
from .mixins import Hashable
35
- from .utils import cached_property , cached_slot_property , MISSING , _get_as_snowflake , parse_time
35
+ from .utils import (
36
+ MISSING ,
37
+ _get_as_snowflake ,
38
+ cached_property ,
39
+ cached_slot_property ,
40
+ parse_time ,
41
+ )
36
42
37
43
if TYPE_CHECKING :
38
44
from datetime import datetime
@@ -133,7 +139,14 @@ def list_subscriptions(
133
139
limit: :class:`int` | None
134
140
The number of subscriptions to retrieve. If ``None``, retrieves all subscriptions.
135
141
"""
136
- return SubscriptionIterator (self ._state , self .id , user_id = user .id , before = before , after = after , limit = limit )
142
+ return SubscriptionIterator (
143
+ self ._state ,
144
+ self .id ,
145
+ user_id = user .id ,
146
+ before = before ,
147
+ after = after ,
148
+ limit = limit ,
149
+ )
137
150
138
151
139
152
class Entitlement (Hashable ):
@@ -199,7 +212,9 @@ def __init__(self, *, data: EntitlementPayload, state: ConnectionState) -> None:
199
212
self .starts_at : datetime | MISSING = (
200
213
parse_time (data .get ("starts_at" )) or MISSING
201
214
)
202
- self .ends_at : datetime | MISSING | None = parse_time (ea ) if (ea := data .get ("ends_at" )) is not None else MISSING
215
+ self .ends_at : datetime | MISSING | None = (
216
+ parse_time (ea ) if (ea := data .get ("ends_at" )) is not None else MISSING
217
+ )
203
218
self .guild_id : int | MISSING = _get_as_snowflake (data , "guild_id" ) or MISSING
204
219
self .consumed : bool = data .get ("consumed" , False )
205
220
@@ -269,6 +284,7 @@ class Subscription(Hashable):
269
284
canceled_at: :class:`datetime.datetime` | ``None``
270
285
When the subscription was canceled.
271
286
"""
287
+
272
288
__slots__ = (
273
289
"_state" ,
274
290
"id" ,
@@ -292,7 +308,9 @@ def __init__(self, *, state: ConnectionState, data: SubscriptionPayload) -> None
292
308
self .current_period_end : datetime = parse_time (data ["current_period_end" ])
293
309
self .status : SubscriptionStatus = try_enum (SubscriptionStatus , data ["status" ])
294
310
self .canceled_at : datetime | None = parse_time (data .get ("canceled_at" ))
295
- self .country : str | None = data .get ("country" ) # Not documented, it is only available with oauth2, not bots
311
+ self .country : str | None = data .get (
312
+ "country"
313
+ ) # Not documented, it is only available with oauth2, not bots
296
314
297
315
def __repr__ (self ) -> str :
298
316
return (
@@ -306,4 +324,3 @@ def __eq__(self, other: object) -> bool:
306
324
def user (self ):
307
325
"""Optional[:class:`User`]: The user that owns this subscription."""
308
326
return self ._state .get_user (self .user_id )
309
-
0 commit comments