@discordjs/structures 0.2.0-dev.1769385723-323d8e757 → 0.2.0-dev.1769601701-c71228aab

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -12,6 +12,9 @@ var kEditedTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.editedTimestam
12
12
  var kArchiveTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.archiveTimestamp");
13
13
  var kStartsTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.startsTimestamp");
14
14
  var kEndsTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.endsTimestamp");
15
+ var kCurrentPeriodStartTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.currentPeriodStartTimestamp");
16
+ var kCurrentPeriodEndTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.currentPeriodEndTimestamp");
17
+ var kCanceledTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.canceledTimestamp");
15
18
  var kAllow = /* @__PURE__ */ Symbol.for("djs.structures.allow");
16
19
  var kDeny = /* @__PURE__ */ Symbol.for("djs.structures.deny");
17
20
  var kBurstColors = /* @__PURE__ */ Symbol.for("djs.structures.burstColors");
@@ -134,7 +137,9 @@ var AutoModerationAction = class extends Structure {
134
137
  super(data);
135
138
  }
136
139
  /**
137
- * The {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types | action type}
140
+ * The action type
141
+ *
142
+ * @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types}
138
143
  */
139
144
  get type() {
140
145
  return this[kData].type;
@@ -226,13 +231,17 @@ var AutoModerationRule = class extends Structure {
226
231
  return this[kData].creator_id;
227
232
  }
228
233
  /**
229
- * The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types | event type}
234
+ * The rule event type
235
+ *
236
+ * @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types}
230
237
  */
231
238
  get eventType() {
232
239
  return this[kData].event_type;
233
240
  }
234
241
  /**
235
- * The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types | trigger type}
242
+ * The rule trigger type
243
+ *
244
+ * @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types}
236
245
  */
237
246
  get triggerType() {
238
247
  return this[kData].trigger_type;
@@ -603,6 +612,21 @@ var PermissionsBitField = class extends BitField {
603
612
  }
604
613
  };
605
614
 
615
+ // src/bitfields/SKUFlagsBitField.ts
616
+ import { SKUFlags } from "discord-api-types/v10";
617
+ var SKUFlagsBitField = class extends BitField {
618
+ static {
619
+ __name(this, "SKUFlagsBitField");
620
+ }
621
+ /**
622
+ * Numeric SKU flags.
623
+ */
624
+ static Flags = SKUFlags;
625
+ toJSON() {
626
+ return super.toJSON(true);
627
+ }
628
+ };
629
+
606
630
  // src/channels/mixins/AppliedTagsMixin.ts
607
631
  var AppliedTagsMixin = class {
608
632
  static {
@@ -1187,6 +1211,14 @@ function isIdSet(id) {
1187
1211
  return typeof id === "string" || typeof id === "bigint";
1188
1212
  }
1189
1213
  __name(isIdSet, "isIdSet");
1214
+ function hasProperty(data, fieldName) {
1215
+ return fieldName in data;
1216
+ }
1217
+ __name(hasProperty, "hasProperty");
1218
+ function isFieldSet(data, fieldName, type) {
1219
+ return hasProperty(data, fieldName) && typeof data[fieldName] === type;
1220
+ }
1221
+ __name(isFieldSet, "isFieldSet");
1190
1222
 
1191
1223
  // src/channels/Channel.ts
1192
1224
  var Channel = class extends Structure {
@@ -1234,8 +1266,7 @@ var Channel = class extends Structure {
1234
1266
  * to null, respecting Omit behaviors
1235
1267
  */
1236
1268
  get flags() {
1237
- const flags = "flags" in this[kData] && typeof this[kData].flags === "number" ? this[kData].flags : null;
1238
- return flags ? new ChannelFlagsBitField(flags) : null;
1269
+ return isFieldSet(this[kData], "flags", "number") ? new ChannelFlagsBitField(this[kData].flags) : null;
1239
1270
  }
1240
1271
  /**
1241
1272
  * The timestamp the channel was created at
@@ -3283,8 +3314,7 @@ var Attachment = class extends Structure {
3283
3314
  * Attachment flags combined as a bitfield
3284
3315
  */
3285
3316
  get flags() {
3286
- const flags = this[kData].flags;
3287
- return flags ? new AttachmentFlagsBitField(this[kData].flags) : null;
3317
+ return isFieldSet(this[kData], "flags", "number") ? new AttachmentFlagsBitField(this[kData].flags) : null;
3288
3318
  }
3289
3319
  };
3290
3320
 
@@ -3416,8 +3446,7 @@ var Message = class extends Structure {
3416
3446
  * The flags of this message as a bit field
3417
3447
  */
3418
3448
  get flags() {
3419
- const flags = this[kData].flags;
3420
- return flags ? new MessageFlagsBitField(this[kData].flags) : null;
3449
+ return isFieldSet(this[kData], "flags", "number") ? new MessageFlagsBitField(this[kData].flags) : null;
3421
3450
  }
3422
3451
  /**
3423
3452
  * The nonce used when sending this message.
@@ -3948,7 +3977,207 @@ var PollResults = class extends Structure {
3948
3977
  }
3949
3978
  };
3950
3979
 
3980
+ // src/skus/SKU.ts
3981
+ var SKU = class extends Structure {
3982
+ static {
3983
+ __name(this, "SKU");
3984
+ }
3985
+ /**
3986
+ * The template used for removing data from the raw data stored for each SKU
3987
+ */
3988
+ static DataTemplate = {};
3989
+ /**
3990
+ * @param data - The raw data received from the API for the SKU
3991
+ */
3992
+ constructor(data) {
3993
+ super(data);
3994
+ }
3995
+ /**
3996
+ * Id of the SKU
3997
+ */
3998
+ get id() {
3999
+ return this[kData].id;
4000
+ }
4001
+ /**
4002
+ * Type of SKU
4003
+ *
4004
+ * @see {@link https://discord.com/developers/docs/resources/sku#sku-object-sku-types}
4005
+ */
4006
+ get type() {
4007
+ return this[kData].type;
4008
+ }
4009
+ /**
4010
+ * Id of the parent application
4011
+ */
4012
+ get applicationId() {
4013
+ return this[kData].application_id;
4014
+ }
4015
+ /**
4016
+ * Customer-facing name of your premium offering
4017
+ */
4018
+ get name() {
4019
+ return this[kData].name;
4020
+ }
4021
+ /**
4022
+ * System-generated URL slug based on the SKU's name
4023
+ */
4024
+ get slug() {
4025
+ return this[kData].slug;
4026
+ }
4027
+ /**
4028
+ * SKU flags combined as a bitfield
4029
+ */
4030
+ get flags() {
4031
+ return isFieldSet(this[kData], "flags", "number") ? new SKUFlagsBitField(this[kData].flags) : null;
4032
+ }
4033
+ };
4034
+
4035
+ // src/soundboards/SoundboardSound.ts
4036
+ import { DiscordSnowflake as DiscordSnowflake5 } from "@sapphire/snowflake";
4037
+ var SoundboardSound = class extends Structure {
4038
+ static {
4039
+ __name(this, "SoundboardSound");
4040
+ }
4041
+ /**
4042
+ * The template used for removing data from the raw data stored for each soundboard sound.
4043
+ */
4044
+ static DataTemplate = {};
4045
+ /**
4046
+ * @param data - The raw data received from the API for the soundboard sound
4047
+ */
4048
+ constructor(data) {
4049
+ super(data);
4050
+ }
4051
+ /**
4052
+ * The name of this sound
4053
+ */
4054
+ get name() {
4055
+ return this[kData].name;
4056
+ }
4057
+ /**
4058
+ * The id of this sound
4059
+ */
4060
+ get soundId() {
4061
+ return this[kData].sound_id;
4062
+ }
4063
+ /**
4064
+ * The volume of this sound, from 0 to 1
4065
+ */
4066
+ get volume() {
4067
+ return this[kData].volume;
4068
+ }
4069
+ /**
4070
+ * The id of this sound's custom emoji
4071
+ */
4072
+ get emojiId() {
4073
+ return this[kData].emoji_id;
4074
+ }
4075
+ /**
4076
+ * The unicode character of this sound's standard emoji
4077
+ */
4078
+ get emojiName() {
4079
+ return this[kData].emoji_name;
4080
+ }
4081
+ /**
4082
+ * The id of the guild this sound is in
4083
+ */
4084
+ get guildId() {
4085
+ return this[kData].guild_id;
4086
+ }
4087
+ /**
4088
+ * Whether this sound can be used, may be false due to loss of server boosts
4089
+ */
4090
+ get available() {
4091
+ return this[kData].available;
4092
+ }
4093
+ /**
4094
+ * The timestamp this sound was created at
4095
+ *
4096
+ * @remarks only available for guild soundboard sounds
4097
+ */
4098
+ get createdTimestamp() {
4099
+ return isIdSet(this[kData].sound_id) && isIdSet(this[kData].guild_id) ? DiscordSnowflake5.timestampFrom(this[kData].sound_id) : null;
4100
+ }
4101
+ /**
4102
+ * The time this sound was created at
4103
+ *
4104
+ * @remarks only available for guild soundboard sounds
4105
+ */
4106
+ get createdAt() {
4107
+ const createdTimestamp = this.createdTimestamp;
4108
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4109
+ }
4110
+ };
4111
+
4112
+ // src/stageInstances/StageInstance.ts
4113
+ import { DiscordSnowflake as DiscordSnowflake6 } from "@sapphire/snowflake";
4114
+ var StageInstance = class extends Structure {
4115
+ static {
4116
+ __name(this, "StageInstance");
4117
+ }
4118
+ /**
4119
+ * The template used for removing data from the raw data stored for each stage instance
4120
+ */
4121
+ static DataTemplate = {};
4122
+ /**
4123
+ * @param data - The raw data received from the API for the stage instance
4124
+ */
4125
+ constructor(data) {
4126
+ super(data);
4127
+ }
4128
+ /**
4129
+ * The stage instance's id
4130
+ */
4131
+ get id() {
4132
+ return this[kData].id;
4133
+ }
4134
+ /**
4135
+ * The guild id of the associated stage channel
4136
+ */
4137
+ get guildId() {
4138
+ return this[kData].guild_id;
4139
+ }
4140
+ /**
4141
+ * The id of the associated stage channel
4142
+ */
4143
+ get channelId() {
4144
+ return this[kData].channel_id;
4145
+ }
4146
+ /**
4147
+ * The topic of the stage instance (1-120 characters)
4148
+ */
4149
+ get topic() {
4150
+ return this[kData].topic;
4151
+ }
4152
+ /**
4153
+ * The privacy level of the stage instance
4154
+ */
4155
+ get privacyLevel() {
4156
+ return this[kData].privacy_level;
4157
+ }
4158
+ /**
4159
+ * The id of the scheduled event for this stage instance
4160
+ */
4161
+ get guildScheduledEventId() {
4162
+ return this[kData].guild_scheduled_event_id;
4163
+ }
4164
+ /**
4165
+ * The timestamp the stage instance was created at
4166
+ */
4167
+ get createdTimestamp() {
4168
+ return isIdSet(this.id) ? DiscordSnowflake6.timestampFrom(this.id) : null;
4169
+ }
4170
+ /**
4171
+ * The time the stage instance was created at
4172
+ */
4173
+ get createdAt() {
4174
+ const createdTimestamp = this.createdTimestamp;
4175
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4176
+ }
4177
+ };
4178
+
3951
4179
  // src/stickers/Sticker.ts
4180
+ import { DiscordSnowflake as DiscordSnowflake7 } from "@sapphire/snowflake";
3952
4181
  var Sticker = class extends Structure {
3953
4182
  static {
3954
4183
  __name(this, "Sticker");
@@ -4005,6 +4234,182 @@ var Sticker = class extends Structure {
4005
4234
  get type() {
4006
4235
  return this[kData].type;
4007
4236
  }
4237
+ /**
4238
+ * The timestamp the sticker was created at
4239
+ */
4240
+ get createdTimestamp() {
4241
+ return isIdSet(this.id) ? DiscordSnowflake7.timestampFrom(this.id) : null;
4242
+ }
4243
+ /**
4244
+ * The time the sticker was created at
4245
+ */
4246
+ get createdAt() {
4247
+ const createdTimestamp = this.createdTimestamp;
4248
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4249
+ }
4250
+ };
4251
+
4252
+ // src/stickers/StickerPack.ts
4253
+ import { DiscordSnowflake as DiscordSnowflake8 } from "@sapphire/snowflake";
4254
+ var StickerPack = class extends Structure {
4255
+ static {
4256
+ __name(this, "StickerPack");
4257
+ }
4258
+ /**
4259
+ * The template used for removing data from the raw data stored for each sticker pack
4260
+ */
4261
+ static DataTemplate = {};
4262
+ /**
4263
+ * @param data - The raw data received from the API for the sticker pack
4264
+ */
4265
+ constructor(data) {
4266
+ super(data);
4267
+ }
4268
+ /**
4269
+ * The id of the sticker pack
4270
+ */
4271
+ get id() {
4272
+ return this[kData].id;
4273
+ }
4274
+ /**
4275
+ * The name of the sticker pack
4276
+ */
4277
+ get name() {
4278
+ return this[kData].name;
4279
+ }
4280
+ /**
4281
+ * The id of the pack's SKU
4282
+ */
4283
+ get skuId() {
4284
+ return this[kData].sku_id;
4285
+ }
4286
+ /**
4287
+ * The id of a sticker in the pack which is shown as the pack's icon
4288
+ */
4289
+ get coverStickerId() {
4290
+ return this[kData].cover_sticker_id;
4291
+ }
4292
+ /**
4293
+ * The description of the sticker pack
4294
+ */
4295
+ get description() {
4296
+ return this[kData].description;
4297
+ }
4298
+ /**
4299
+ * The id of the sticker pack's banner image
4300
+ *
4301
+ * @see {@link https://discord.com/developers/docs/reference#image-formatting}
4302
+ */
4303
+ get bannerAssetId() {
4304
+ return this[kData].banner_asset_id;
4305
+ }
4306
+ /**
4307
+ * The timestamp the sticker pack was created at
4308
+ */
4309
+ get createdTimestamp() {
4310
+ return isIdSet(this.id) ? DiscordSnowflake8.timestampFrom(this.id) : null;
4311
+ }
4312
+ /**
4313
+ * The time the sticker pack was created at
4314
+ */
4315
+ get createdAt() {
4316
+ const createdTimestamp = this.createdTimestamp;
4317
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4318
+ }
4319
+ };
4320
+
4321
+ // src/teams/Team.ts
4322
+ import { DiscordSnowflake as DiscordSnowflake9 } from "@sapphire/snowflake";
4323
+ var Team = class extends Structure {
4324
+ static {
4325
+ __name(this, "Team");
4326
+ }
4327
+ /**
4328
+ * The template used for removing data from the raw data stored for each team.
4329
+ */
4330
+ static DataTemplate = {};
4331
+ /**
4332
+ * @param data - The raw data received from the API for the team.
4333
+ */
4334
+ constructor(data) {
4335
+ super(data);
4336
+ }
4337
+ /**
4338
+ * Hash of the image of the team's icon
4339
+ */
4340
+ get icon() {
4341
+ return this[kData].icon;
4342
+ }
4343
+ /**
4344
+ * The unique id of the team
4345
+ */
4346
+ get id() {
4347
+ return this[kData].id;
4348
+ }
4349
+ /**
4350
+ * Name of the team
4351
+ */
4352
+ get name() {
4353
+ return this[kData].name;
4354
+ }
4355
+ /**
4356
+ * User ID of the current team owner
4357
+ */
4358
+ get ownerUserId() {
4359
+ return this[kData].owner_user_id;
4360
+ }
4361
+ /**
4362
+ * The timestamp the team was created at
4363
+ */
4364
+ get createdTimestamp() {
4365
+ return isIdSet(this.id) ? DiscordSnowflake9.timestampFrom(this.id) : null;
4366
+ }
4367
+ /**
4368
+ * The time the team was created at
4369
+ */
4370
+ get createdAt() {
4371
+ const createdTimestamp = this.createdTimestamp;
4372
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4373
+ }
4374
+ };
4375
+
4376
+ // src/teams/TeamMember.ts
4377
+ var TeamMember = class extends Structure {
4378
+ static {
4379
+ __name(this, "TeamMember");
4380
+ }
4381
+ /**
4382
+ * The template used for removing data from the raw data stored for each team member
4383
+ */
4384
+ static DataTemplate = {};
4385
+ /**
4386
+ * @param data - The raw data received from the API for the team member
4387
+ */
4388
+ constructor(data) {
4389
+ super(data);
4390
+ }
4391
+ /**
4392
+ * User's membership state on the team
4393
+ *
4394
+ * @see {@link https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum}
4395
+ */
4396
+ get membershipState() {
4397
+ return this[kData].membership_state;
4398
+ }
4399
+ /**
4400
+ * Id of the parent team of which they are a member
4401
+ */
4402
+ get teamId() {
4403
+ return this[kData].team_id;
4404
+ }
4405
+ /**
4406
+ * Role of the team member
4407
+ *
4408
+ * @see {@link https://discord.com/developers/docs/topics/teams#team-member-roles-team-member-role-types}
4409
+ */
4410
+ get role() {
4411
+ return this[kData].role;
4412
+ }
4008
4413
  };
4009
4414
 
4010
4415
  // src/users/AvatarDecorationData.ts
@@ -4037,7 +4442,7 @@ var AvatarDecorationData = class extends Structure {
4037
4442
  };
4038
4443
 
4039
4444
  // src/users/User.ts
4040
- import { DiscordSnowflake as DiscordSnowflake5 } from "@sapphire/snowflake";
4445
+ import { DiscordSnowflake as DiscordSnowflake10 } from "@sapphire/snowflake";
4041
4446
  var User = class extends Structure {
4042
4447
  static {
4043
4448
  __name(this, "User");
@@ -4160,7 +4565,7 @@ var User = class extends Structure {
4160
4565
  * The timestamp the user was created at
4161
4566
  */
4162
4567
  get createdTimestamp() {
4163
- return isIdSet(this.id) ? DiscordSnowflake5.timestampFrom(this.id) : null;
4568
+ return isIdSet(this.id) ? DiscordSnowflake10.timestampFrom(this.id) : null;
4164
4569
  }
4165
4570
  /**
4166
4571
  * The time the user was created at
@@ -4251,6 +4656,286 @@ var Connection = class extends Structure {
4251
4656
  return this[kData].visibility;
4252
4657
  }
4253
4658
  };
4659
+
4660
+ // src/voice/VoiceState.ts
4661
+ var VoiceState = class extends Structure {
4662
+ static {
4663
+ __name(this, "VoiceState");
4664
+ }
4665
+ /**
4666
+ * The template used for removing data from the raw data stored for each voice state
4667
+ */
4668
+ static DataTemplate = {};
4669
+ /**
4670
+ * @param data - The raw data received from the API for the voice state
4671
+ */
4672
+ constructor(data) {
4673
+ super(data);
4674
+ }
4675
+ /**
4676
+ * The guild id this voice state is for
4677
+ */
4678
+ get guildId() {
4679
+ return this[kData].guild_id;
4680
+ }
4681
+ /**
4682
+ * The channel id this user is connected to
4683
+ */
4684
+ get channelId() {
4685
+ return this[kData].channel_id;
4686
+ }
4687
+ /**
4688
+ * The user id this voice state is for
4689
+ */
4690
+ get userId() {
4691
+ return this[kData].user_id;
4692
+ }
4693
+ /**
4694
+ * The session id for this voice state
4695
+ */
4696
+ get sessionId() {
4697
+ return this[kData].session_id;
4698
+ }
4699
+ /**
4700
+ * Whether this user is deafened by the server
4701
+ */
4702
+ get deaf() {
4703
+ return this[kData].deaf;
4704
+ }
4705
+ /**
4706
+ * Whether this user is muted by the server
4707
+ */
4708
+ get mute() {
4709
+ return this[kData].mute;
4710
+ }
4711
+ /**
4712
+ * Whether this user is locally deafened
4713
+ */
4714
+ get selfDeaf() {
4715
+ return this[kData].self_deaf;
4716
+ }
4717
+ /**
4718
+ * Whether this user is locally muted
4719
+ */
4720
+ get selfMute() {
4721
+ return this[kData].self_mute;
4722
+ }
4723
+ /**
4724
+ * Whether this user is streaming using "Go Live"
4725
+ */
4726
+ get selfStream() {
4727
+ return this[kData].self_stream;
4728
+ }
4729
+ /**
4730
+ * Whether this user's camera is enabled
4731
+ */
4732
+ get selfVideo() {
4733
+ return this[kData].self_video;
4734
+ }
4735
+ /**
4736
+ * Whether this user's permission to speak is denied
4737
+ */
4738
+ get suppress() {
4739
+ return this[kData].suppress;
4740
+ }
4741
+ /**
4742
+ * The time at which the user requested to speak
4743
+ */
4744
+ get requestToSpeakTimestamp() {
4745
+ return this[kData].request_to_speak_timestamp;
4746
+ }
4747
+ };
4748
+
4749
+ // src/voice/VoiceRegion.ts
4750
+ var VoiceRegion = class extends Structure {
4751
+ static {
4752
+ __name(this, "VoiceRegion");
4753
+ }
4754
+ /**
4755
+ * The template used for removing data from the raw data stored for each voice region
4756
+ */
4757
+ static DataTemplate = {};
4758
+ /**
4759
+ * @param data - The raw data received from the API for the voice region
4760
+ */
4761
+ constructor(data) {
4762
+ super(data);
4763
+ }
4764
+ /**
4765
+ * Unique id for the region
4766
+ */
4767
+ get id() {
4768
+ return this[kData].id;
4769
+ }
4770
+ /**
4771
+ * Name of the region
4772
+ */
4773
+ get name() {
4774
+ return this[kData].name;
4775
+ }
4776
+ /**
4777
+ * `true` for a single server that is closest to the current user's client
4778
+ */
4779
+ get optimal() {
4780
+ return this[kData].optimal;
4781
+ }
4782
+ /**
4783
+ * Whether this is a deprecated voice region (avoid switching to these)
4784
+ */
4785
+ get deprecated() {
4786
+ return this[kData].deprecated;
4787
+ }
4788
+ /**
4789
+ * Whether this is a custom voice region (used for events/etc)
4790
+ */
4791
+ get custom() {
4792
+ return this[kData].custom;
4793
+ }
4794
+ };
4795
+
4796
+ // src/subscriptions/Subscription.ts
4797
+ import { DiscordSnowflake as DiscordSnowflake11 } from "@sapphire/snowflake";
4798
+ var Subscription = class extends Structure {
4799
+ static {
4800
+ __name(this, "Subscription");
4801
+ }
4802
+ /**
4803
+ * The template used for removing data from the raw data stored for each subscription
4804
+ */
4805
+ static DataTemplate = {
4806
+ set current_period_start(_) {
4807
+ },
4808
+ set current_period_end(_) {
4809
+ },
4810
+ set canceled_at(_) {
4811
+ }
4812
+ };
4813
+ [kCurrentPeriodStartTimestamp] = null;
4814
+ [kCurrentPeriodEndTimestamp] = null;
4815
+ [kCanceledTimestamp] = null;
4816
+ /**
4817
+ * @param data - The raw data received from the API for the subscription
4818
+ */
4819
+ constructor(data) {
4820
+ super(data);
4821
+ this.optimizeData(data);
4822
+ }
4823
+ /**
4824
+ * {@inheritDoc Structure.optimizeData}
4825
+ */
4826
+ optimizeData(data) {
4827
+ const currentPeriodStartTimestamp = data.current_period_start;
4828
+ const currentPeriodEndTimestamp = data.current_period_end;
4829
+ const canceledTimestamp = data.canceled_at;
4830
+ if (currentPeriodStartTimestamp) {
4831
+ this[kCurrentPeriodStartTimestamp] = Date.parse(currentPeriodStartTimestamp);
4832
+ }
4833
+ if (currentPeriodEndTimestamp) {
4834
+ this[kCurrentPeriodEndTimestamp] = Date.parse(currentPeriodEndTimestamp);
4835
+ }
4836
+ if (canceledTimestamp) {
4837
+ this[kCanceledTimestamp] = Date.parse(canceledTimestamp);
4838
+ }
4839
+ }
4840
+ /**
4841
+ * The subscription's id
4842
+ *
4843
+ * @remarks The start of a subscription is determined by its id. When the subscription renews, its current period is updated.
4844
+ */
4845
+ get id() {
4846
+ return this[kData].id;
4847
+ }
4848
+ /**
4849
+ * Id of the user who is subscribed
4850
+ */
4851
+ get userId() {
4852
+ return this[kData].user_id;
4853
+ }
4854
+ /**
4855
+ * List of SKUs subscribed to
4856
+ */
4857
+ get skuIds() {
4858
+ return this[kData].sku_ids;
4859
+ }
4860
+ /**
4861
+ * List of entitlements granted for this subscription
4862
+ */
4863
+ get entitlementIds() {
4864
+ return this[kData].entitlement_ids;
4865
+ }
4866
+ /**
4867
+ * List of SKUs that this user will be subscribed to at renewal
4868
+ */
4869
+ get renewalSkuIds() {
4870
+ return this[kData].renewal_sku_ids;
4871
+ }
4872
+ /**
4873
+ * Timestamp of start of the current subscription period
4874
+ */
4875
+ get currentPeriodStartTimestamp() {
4876
+ return this[kCurrentPeriodStartTimestamp];
4877
+ }
4878
+ /**
4879
+ * The time at which the current subscription period will start
4880
+ */
4881
+ get currentPeriodStartAt() {
4882
+ const startTimestamp = this.currentPeriodStartTimestamp;
4883
+ return startTimestamp ? new Date(startTimestamp) : null;
4884
+ }
4885
+ /**
4886
+ * Timestamp of end of the current subscription period
4887
+ */
4888
+ get currentPeriodEndTimestamp() {
4889
+ return this[kCurrentPeriodEndTimestamp];
4890
+ }
4891
+ /**
4892
+ * The time at which the current subscription period will end
4893
+ */
4894
+ get currentPeriodEndsAt() {
4895
+ const endTimestamp = this.currentPeriodEndTimestamp;
4896
+ return endTimestamp ? new Date(endTimestamp) : null;
4897
+ }
4898
+ /**
4899
+ * The {@link SubscriptionStatus} of the current subscription
4900
+ */
4901
+ get status() {
4902
+ return this[kData].status;
4903
+ }
4904
+ /**
4905
+ * Timestamp when the subscription was canceled
4906
+ */
4907
+ get canceledTimestamp() {
4908
+ return this[kCanceledTimestamp];
4909
+ }
4910
+ /**
4911
+ * The time when the subscription was canceled
4912
+ *
4913
+ * @remarks This is populated when the {@link Subscription#status} transitions to {@link SubscriptionStatus.Ending}.
4914
+ */
4915
+ get canceledAt() {
4916
+ const canceledTimestamp = this.canceledTimestamp;
4917
+ return canceledTimestamp ? new Date(canceledTimestamp) : null;
4918
+ }
4919
+ /**
4920
+ * ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope.
4921
+ */
4922
+ get country() {
4923
+ return this[kData].country;
4924
+ }
4925
+ /**
4926
+ * The timestamp the subscription was created at
4927
+ */
4928
+ get createdTimestamp() {
4929
+ return isIdSet(this.id) ? DiscordSnowflake11.timestampFrom(this.id) : null;
4930
+ }
4931
+ /**
4932
+ * The time the subscription was created at
4933
+ */
4934
+ get createdAt() {
4935
+ const createdTimestamp = this.createdTimestamp;
4936
+ return createdTimestamp ? new Date(createdTimestamp) : null;
4937
+ }
4938
+ };
4254
4939
  export {
4255
4940
  ActionRowComponent,
4256
4941
  AnnouncementChannel,
@@ -4335,15 +5020,23 @@ export {
4335
5020
  ResolvedInteractionData,
4336
5021
  RoleSelectMenuComponent,
4337
5022
  RoleSubscriptionData,
5023
+ SKU,
5024
+ SKUFlagsBitField,
4338
5025
  SectionComponent,
4339
5026
  SelectMenuComponent,
4340
5027
  SelectMenuDefaultValue,
4341
5028
  SeparatorComponent,
5029
+ SoundboardSound,
4342
5030
  StageChannel,
5031
+ StageInstance,
4343
5032
  Sticker,
5033
+ StickerPack,
4344
5034
  StringSelectMenuComponent,
4345
5035
  StringSelectMenuOption,
4346
5036
  Structure,
5037
+ Subscription,
5038
+ Team,
5039
+ TeamMember,
4347
5040
  TextChannel,
4348
5041
  TextChannelMixin,
4349
5042
  TextDisplayComponent,
@@ -4357,6 +5050,8 @@ export {
4357
5050
  UserSelectMenuComponent,
4358
5051
  VoiceChannel,
4359
5052
  VoiceChannelMixin,
5053
+ VoiceRegion,
5054
+ VoiceState,
4360
5055
  dateToDiscordISOTimestamp,
4361
5056
  extendTemplate
4362
5057
  };