@@ -50,11 +50,16 @@ class GuildScheduledEvent extends Base {
5050 this . creatorId ??= null ;
5151 }
5252
53- /**
54- * The name of the guild scheduled event
55- * @type {string }
56- */
57- this . name = data . name ;
53+ if ( 'name' in data ) {
54+ /**
55+ * The name of the guild scheduled event
56+ * @type {?string }
57+ */
58+ this . name = data . name ;
59+ } else {
60+ // Only if partial.
61+ this . name ??= null ;
62+ }
5863
5964 if ( 'description' in data ) {
6065 /**
@@ -66,37 +71,59 @@ class GuildScheduledEvent extends Base {
6671 this . description ??= null ;
6772 }
6873
69- /**
70- * The timestamp the guild scheduled event will start at
71- * <info>This can be potentially `null` only when it's an {@link AuditLogEntryTarget}</info>
72- * @type {?number }
73- */
74- this . scheduledStartTimestamp = data . scheduled_start_time ? Date . parse ( data . scheduled_start_time ) : null ;
74+ if ( 'scheduled_start_time' in data ) {
75+ /**
76+ * The timestamp the guild scheduled event will start at
77+ * @type {?number }
78+ */
79+ this . scheduledStartTimestamp = Date . parse ( data . scheduled_start_time ) ;
80+ } else {
81+ this . scheduledStartTimestamp ??= null ;
82+ }
7583
76- /**
77- * The timestamp the guild scheduled event will end at,
78- * or `null` if the event does not have a scheduled time to end
79- * @type {?number }
80- */
81- this . scheduledEndTimestamp = data . scheduled_end_time ? Date . parse ( data . scheduled_end_time ) : null ;
84+ if ( 'scheduled_end_time' in data ) {
85+ /**
86+ * The timestamp the guild scheduled event will end at
87+ * or `null` if the event does not have a scheduled time to end
88+ * @type {?number }
89+ */
90+ this . scheduledEndTimestamp = data . scheduled_end_time ? Date . parse ( data . scheduled_end_time ) : null ;
91+ } else {
92+ this . scheduledEndTimestamp ??= null ;
93+ }
8294
83- /**
84- * The privacy level of the guild scheduled event
85- * @type {GuildScheduledEventPrivacyLevel }
86- */
87- this . privacyLevel = data . privacy_level ;
95+ if ( 'privacy_level' in data ) {
96+ /**
97+ * The privacy level of the guild scheduled event
98+ * @type {?GuildScheduledEventPrivacyLevel }
99+ */
100+ this . privacyLevel = data . privacy_level ;
101+ } else {
102+ // Only if partial.
103+ this . privacyLevel ??= null ;
104+ }
88105
89- /**
90- * The status of the guild scheduled event
91- * @type {GuildScheduledEventStatus }
92- */
93- this . status = data . status ;
106+ if ( 'status' in data ) {
107+ /**
108+ * The status of the guild scheduled event
109+ * @type {?GuildScheduledEventStatus }
110+ */
111+ this . status = data . status ;
112+ } else {
113+ // Only if partial.
114+ this . status ??= null ;
115+ }
94116
95- /**
96- * The type of hosting entity associated with the scheduled event
97- * @type {GuildScheduledEventEntityType }
98- */
99- this . entityType = data . entity_type ;
117+ if ( 'entity_type' in data ) {
118+ /**
119+ * The type of hosting entity associated with the scheduled event
120+ * @type {?GuildScheduledEventEntityType }
121+ */
122+ this . entityType = data . entity_type ;
123+ } else {
124+ // Only if partial.
125+ this . entityType ??= null ;
126+ }
100127
101128 if ( 'entity_id' in data ) {
102129 /**
@@ -164,6 +191,15 @@ class GuildScheduledEvent extends Base {
164191 }
165192 }
166193
194+ /**
195+ * Whether this guild scheduled event is partial.
196+ * @type {boolean }
197+ * @readonly
198+ */
199+ get partial ( ) {
200+ return this . name === null ;
201+ }
202+
167203 /**
168204 * The URL of this scheduled event's cover image
169205 * @param {BaseImageURLOptions } [options={}] Options for image URL
@@ -276,6 +312,15 @@ class GuildScheduledEvent extends Base {
276312 return this . guild . scheduledEvents . edit ( this . id , options ) ;
277313 }
278314
315+ /**
316+ * Fetches this guild scheduled event.
317+ * @param {boolean } [force=true] Whether to skip the cache check and request the API
318+ * @returns {Promise<GuildScheduledEvent> }
319+ */
320+ fetch ( force = true ) {
321+ return this . guild . scheduledEvents . fetch ( { guildScheduledEvent : this . id , force } ) ;
322+ }
323+
279324 /**
280325 * Deletes this guild scheduled event.
281326 * @returns {Promise<GuildScheduledEvent> }
0 commit comments