@@ -113,6 +113,7 @@ class Promotion(Hashable):
113
113
114
114
__slots__ = (
115
115
'id' ,
116
+ '_type' ,
116
117
'trial_id' ,
117
118
'starts_at' ,
118
119
'ends_at' ,
@@ -145,15 +146,16 @@ def _update(self, data: Union[PromotionPayload, ClaimedPromotionPayload]) -> Non
145
146
promotion : PromotionPayload = data .get ('promotion' , data )
146
147
147
148
self .id : int = int (promotion ['id' ])
149
+ self ._type = promotion .get ('promotion_type' , 0 ) # Unknown enum, observed values 0-2
148
150
self .trial_id : Optional [int ] = _get_as_snowflake (promotion , 'trial_id' )
149
151
self .starts_at : datetime = parse_time (promotion ['start_date' ])
150
152
self .ends_at : datetime = parse_time (promotion ['end_date' ])
151
153
self .claimed_at : Optional [datetime ] = parse_time (data .get ('claimed_at' ))
152
154
self .code : Optional [str ] = data .get ('code' )
153
155
self ._flags : int = promotion .get ('flags' , 0 )
154
156
155
- self .outbound_title : str = promotion [ 'outbound_title' ]
156
- self .outbound_description : str = promotion [ 'outbound_redemption_modal_body' ]
157
+ self .outbound_title : str = promotion . get ( 'outbound_title' , '' )
158
+ self .outbound_description : str = promotion . get ( 'outbound_redemption_modal_body' , '' )
157
159
self .outbound_link : str = promotion .get (
158
160
'outbound_redemption_page_link' ,
159
161
promotion .get ('outbound_redemption_url_format' , '' ).replace ('{code}' , self .code or '{code}' ),
@@ -163,7 +165,7 @@ def _update(self, data: Union[PromotionPayload, ClaimedPromotionPayload]) -> Non
163
165
self .inbound_description : Optional [str ] = promotion .get ('inbound_body_text' )
164
166
self .inbound_link : Optional [str ] = promotion .get ('inbound_help_center_link' )
165
167
self .inbound_restricted_countries : List [str ] = promotion .get ('inbound_restricted_countries' , [])
166
- self .terms_and_conditions : str = promotion [ 'outbound_terms_and_conditions' ]
168
+ self .terms_and_conditions : str = promotion . get ( 'outbound_terms_and_conditions' , '' )
167
169
168
170
@property
169
171
def flags (self ) -> PromotionFlags :
0 commit comments