@discordjs/structures 1.0.0-dev.1786968995-99af6d8be → 1.0.0-dev.1788538586-ecea9ed57
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.d.mts +340 -28
- package/dist/index.d.ts +340 -28
- package/dist/index.js +495 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +471 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -449,7 +449,8 @@ var BitField = class _BitField {
|
|
|
449
449
|
serialize(...hasParams) {
|
|
450
450
|
const serialized = {};
|
|
451
451
|
for (const [flag, bit] of Object.entries(this.constructor.Flags)) {
|
|
452
|
-
if (Number.isNaN(Number(flag))
|
|
452
|
+
if (Number.isNaN(Number(flag)) && bit > 0)
|
|
453
|
+
serialized[flag] = this.has(bit, ...hasParams);
|
|
453
454
|
}
|
|
454
455
|
return serialized;
|
|
455
456
|
}
|
|
@@ -477,8 +478,9 @@ var BitField = class _BitField {
|
|
|
477
478
|
return this.bitField;
|
|
478
479
|
}
|
|
479
480
|
*[Symbol.iterator](...hasParams) {
|
|
480
|
-
for (const bitName of Object.
|
|
481
|
-
if (Number.isNaN(Number(bitName)) && this.has(
|
|
481
|
+
for (const [bitName, bit] of Object.entries(this.constructor.Flags)) {
|
|
482
|
+
if (Number.isNaN(Number(bitName)) && bit > 0 && this.has(bit, ...hasParams))
|
|
483
|
+
yield bitName;
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
/**
|
|
@@ -503,6 +505,21 @@ var BitField = class _BitField {
|
|
|
503
505
|
}
|
|
504
506
|
};
|
|
505
507
|
|
|
508
|
+
// src/bitfields/ActivityFlagsBitField.ts
|
|
509
|
+
import { ActivityFlags } from "discord-api-types/v10";
|
|
510
|
+
var ActivityFlagsBitField = class extends BitField {
|
|
511
|
+
static {
|
|
512
|
+
__name(this, "ActivityFlagsBitField");
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Numeric gateway presence activity flags.
|
|
516
|
+
*/
|
|
517
|
+
static Flags = ActivityFlags;
|
|
518
|
+
toJSON() {
|
|
519
|
+
return super.toJSON(true);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
506
523
|
// src/bitfields/AttachmentFlagsBitField.ts
|
|
507
524
|
import { AttachmentFlags } from "discord-api-types/v10";
|
|
508
525
|
var AttachmentFlagsBitField = class extends BitField {
|
|
@@ -726,6 +743,16 @@ var ChannelPermissionMixin = class {
|
|
|
726
743
|
}
|
|
727
744
|
};
|
|
728
745
|
|
|
746
|
+
// src/utils/optimization.ts
|
|
747
|
+
function extendTemplate(superTemplate, additions) {
|
|
748
|
+
return Object.defineProperties(additions, Object.getOwnPropertyDescriptors(superTemplate));
|
|
749
|
+
}
|
|
750
|
+
__name(extendTemplate, "extendTemplate");
|
|
751
|
+
function dateToDiscordISOTimestamp(date) {
|
|
752
|
+
return `${date.getUTCFullYear()}-${(date.getUTCMonth() + 1).toString().padStart(2, "0")}-${date.getUTCDate().toString().padStart(2, "0")}T${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0").padEnd(6, "0")}+00:00`;
|
|
753
|
+
}
|
|
754
|
+
__name(dateToDiscordISOTimestamp, "dateToDiscordISOTimestamp");
|
|
755
|
+
|
|
729
756
|
// src/channels/mixins/ChannelPinMixin.ts
|
|
730
757
|
var ChannelPinMixin = class {
|
|
731
758
|
static {
|
|
@@ -758,7 +785,7 @@ var ChannelPinMixin = class {
|
|
|
758
785
|
/**
|
|
759
786
|
* The Date of when the last pin in the channel happened
|
|
760
787
|
*/
|
|
761
|
-
get
|
|
788
|
+
get lastPinDate() {
|
|
762
789
|
const lastPinTimestamp = this.lastPinTimestamp;
|
|
763
790
|
return lastPinTimestamp ? new Date(lastPinTimestamp) : null;
|
|
764
791
|
}
|
|
@@ -768,7 +795,7 @@ var ChannelPinMixin = class {
|
|
|
768
795
|
* @param data - the result of {@link (Structure:class).toJSON}
|
|
769
796
|
*/
|
|
770
797
|
[kMixinToJSON](data) {
|
|
771
|
-
data.last_pin_timestamp = this[kLastPinTimestamp] ? new Date(this[kLastPinTimestamp])
|
|
798
|
+
data.last_pin_timestamp = this[kLastPinTimestamp] ? dateToDiscordISOTimestamp(new Date(this[kLastPinTimestamp])) : null;
|
|
772
799
|
}
|
|
773
800
|
};
|
|
774
801
|
|
|
@@ -1177,14 +1204,14 @@ var ThreadMetadata = class extends Structure {
|
|
|
1177
1204
|
/**
|
|
1178
1205
|
* The time the thread was archived at
|
|
1179
1206
|
*/
|
|
1180
|
-
get
|
|
1207
|
+
get archivedDate() {
|
|
1181
1208
|
const archivedTimestamp = this.archivedTimestamp;
|
|
1182
1209
|
return archivedTimestamp ? new Date(archivedTimestamp) : null;
|
|
1183
1210
|
}
|
|
1184
1211
|
/**
|
|
1185
1212
|
* The time the thread was created at
|
|
1186
1213
|
*/
|
|
1187
|
-
get
|
|
1214
|
+
get createdDate() {
|
|
1188
1215
|
const createdTimestamp = this.createdTimestamp;
|
|
1189
1216
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1190
1217
|
}
|
|
@@ -1194,10 +1221,10 @@ var ThreadMetadata = class extends Structure {
|
|
|
1194
1221
|
toJSON() {
|
|
1195
1222
|
const data = super.toJSON();
|
|
1196
1223
|
if (this[kArchiveTimestamp]) {
|
|
1197
|
-
data.archive_timestamp = new Date(this[kArchiveTimestamp])
|
|
1224
|
+
data.archive_timestamp = dateToDiscordISOTimestamp(new Date(this[kArchiveTimestamp]));
|
|
1198
1225
|
}
|
|
1199
1226
|
if (this[kCreatedTimestamp]) {
|
|
1200
|
-
data.create_timestamp = new Date(this[kCreatedTimestamp])
|
|
1227
|
+
data.create_timestamp = dateToDiscordISOTimestamp(new Date(this[kCreatedTimestamp]));
|
|
1201
1228
|
}
|
|
1202
1229
|
return data;
|
|
1203
1230
|
}
|
|
@@ -1219,6 +1246,13 @@ function isFieldSet(data, fieldName, type) {
|
|
|
1219
1246
|
return hasProperty(data, fieldName) && typeof data[fieldName] === type;
|
|
1220
1247
|
}
|
|
1221
1248
|
__name(isFieldSet, "isFieldSet");
|
|
1249
|
+
function isArrayFieldSet(array, targetIndex, type) {
|
|
1250
|
+
return Array.isArray(array) ? array.length > targetIndex ? (
|
|
1251
|
+
// eslint-disable-next-line valid-typeof
|
|
1252
|
+
typeof array[targetIndex] === type
|
|
1253
|
+
) : false : false;
|
|
1254
|
+
}
|
|
1255
|
+
__name(isArrayFieldSet, "isArrayFieldSet");
|
|
1222
1256
|
|
|
1223
1257
|
// src/channels/Channel.ts
|
|
1224
1258
|
var Channel = class extends Structure {
|
|
@@ -1277,7 +1311,7 @@ var Channel = class extends Structure {
|
|
|
1277
1311
|
/**
|
|
1278
1312
|
* The time the channel was created at
|
|
1279
1313
|
*/
|
|
1280
|
-
get
|
|
1314
|
+
get createdDate() {
|
|
1281
1315
|
const createdTimestamp = this.createdTimestamp;
|
|
1282
1316
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1283
1317
|
}
|
|
@@ -1721,7 +1755,7 @@ var Emoji = class extends Structure {
|
|
|
1721
1755
|
/**
|
|
1722
1756
|
* The time the emoji was created at
|
|
1723
1757
|
*/
|
|
1724
|
-
get
|
|
1758
|
+
get createdDate() {
|
|
1725
1759
|
const createdTimestamp = this.createdTimestamp;
|
|
1726
1760
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1727
1761
|
}
|
|
@@ -1729,18 +1763,6 @@ var Emoji = class extends Structure {
|
|
|
1729
1763
|
|
|
1730
1764
|
// src/entitlements/Entitlement.ts
|
|
1731
1765
|
import { DiscordSnowflake as DiscordSnowflake3 } from "@sapphire/snowflake";
|
|
1732
|
-
|
|
1733
|
-
// src/utils/optimization.ts
|
|
1734
|
-
function extendTemplate(superTemplate, additions) {
|
|
1735
|
-
return Object.defineProperties(additions, Object.getOwnPropertyDescriptors(superTemplate));
|
|
1736
|
-
}
|
|
1737
|
-
__name(extendTemplate, "extendTemplate");
|
|
1738
|
-
function dateToDiscordISOTimestamp(date) {
|
|
1739
|
-
return `${date.getUTCFullYear()}-${(date.getUTCMonth() + 1).toString().padStart(2, "0")}-${date.getUTCDate().toString().padStart(2, "0")}T${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0").padEnd(6, "0")}+00:00`;
|
|
1740
|
-
}
|
|
1741
|
-
__name(dateToDiscordISOTimestamp, "dateToDiscordISOTimestamp");
|
|
1742
|
-
|
|
1743
|
-
// src/entitlements/Entitlement.ts
|
|
1744
1766
|
var Entitlement = class extends Structure {
|
|
1745
1767
|
static {
|
|
1746
1768
|
__name(this, "Entitlement");
|
|
@@ -1818,7 +1840,7 @@ var Entitlement = class extends Structure {
|
|
|
1818
1840
|
/**
|
|
1819
1841
|
* Start date at which the entitlement is valid
|
|
1820
1842
|
*/
|
|
1821
|
-
get
|
|
1843
|
+
get startsDate() {
|
|
1822
1844
|
const timestamp = this.startsTimestamp;
|
|
1823
1845
|
return timestamp ? new Date(timestamp) : null;
|
|
1824
1846
|
}
|
|
@@ -1831,7 +1853,7 @@ var Entitlement = class extends Structure {
|
|
|
1831
1853
|
/**
|
|
1832
1854
|
* End date at which the entitlement is valid
|
|
1833
1855
|
*/
|
|
1834
|
-
get
|
|
1856
|
+
get endsDate() {
|
|
1835
1857
|
const timestamp = this.endsTimestamp;
|
|
1836
1858
|
return timestamp ? new Date(timestamp) : null;
|
|
1837
1859
|
}
|
|
@@ -1862,7 +1884,7 @@ var Entitlement = class extends Structure {
|
|
|
1862
1884
|
/**
|
|
1863
1885
|
* The time the entitlement was created at
|
|
1864
1886
|
*/
|
|
1865
|
-
get
|
|
1887
|
+
get createdDate() {
|
|
1866
1888
|
const createdTimestamp = this.createdTimestamp;
|
|
1867
1889
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1868
1890
|
}
|
|
@@ -1871,13 +1893,13 @@ var Entitlement = class extends Structure {
|
|
|
1871
1893
|
*/
|
|
1872
1894
|
toJSON() {
|
|
1873
1895
|
const clone = super.toJSON();
|
|
1874
|
-
const
|
|
1875
|
-
const
|
|
1876
|
-
if (
|
|
1877
|
-
clone.starts_at = dateToDiscordISOTimestamp(new Date(
|
|
1896
|
+
const startsDateTimestamp = this[kStartsTimestamp];
|
|
1897
|
+
const endsDateTimestamp = this[kEndsTimestamp];
|
|
1898
|
+
if (startsDateTimestamp) {
|
|
1899
|
+
clone.starts_at = dateToDiscordISOTimestamp(new Date(startsDateTimestamp));
|
|
1878
1900
|
}
|
|
1879
|
-
if (
|
|
1880
|
-
clone.ends_at = dateToDiscordISOTimestamp(new Date(
|
|
1901
|
+
if (endsDateTimestamp) {
|
|
1902
|
+
clone.ends_at = dateToDiscordISOTimestamp(new Date(endsDateTimestamp));
|
|
1881
1903
|
}
|
|
1882
1904
|
return clone;
|
|
1883
1905
|
}
|
|
@@ -1997,7 +2019,7 @@ var Invite = class extends Structure {
|
|
|
1997
2019
|
/**
|
|
1998
2020
|
* The time the invite will expire at
|
|
1999
2021
|
*/
|
|
2000
|
-
get
|
|
2022
|
+
get expiresDate() {
|
|
2001
2023
|
const expiresTimestamp = this.expiresTimestamp;
|
|
2002
2024
|
return expiresTimestamp ? new Date(expiresTimestamp) : null;
|
|
2003
2025
|
}
|
|
@@ -2034,7 +2056,7 @@ var Invite = class extends Structure {
|
|
|
2034
2056
|
/**
|
|
2035
2057
|
* The time the invite was created at
|
|
2036
2058
|
*/
|
|
2037
|
-
get
|
|
2059
|
+
get createdDate() {
|
|
2038
2060
|
const createdTimestamp = this.createdTimestamp;
|
|
2039
2061
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
2040
2062
|
}
|
|
@@ -3419,7 +3441,7 @@ var Message = class extends Structure {
|
|
|
3419
3441
|
/**
|
|
3420
3442
|
* The time the message was created at
|
|
3421
3443
|
*/
|
|
3422
|
-
get
|
|
3444
|
+
get createdDate() {
|
|
3423
3445
|
const createdTimestamp = this.createdTimestamp;
|
|
3424
3446
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
3425
3447
|
}
|
|
@@ -3438,7 +3460,7 @@ var Message = class extends Structure {
|
|
|
3438
3460
|
/**
|
|
3439
3461
|
* The time the message was last edited at, or `null` if it never was edited
|
|
3440
3462
|
*/
|
|
3441
|
-
get
|
|
3463
|
+
get editedDate() {
|
|
3442
3464
|
const editedTimestamp = this.editedTimestamp;
|
|
3443
3465
|
return editedTimestamp ? new Date(editedTimestamp) : null;
|
|
3444
3466
|
}
|
|
@@ -3492,12 +3514,13 @@ var Message = class extends Structure {
|
|
|
3492
3514
|
*/
|
|
3493
3515
|
toJSON() {
|
|
3494
3516
|
const clone = super.toJSON();
|
|
3495
|
-
|
|
3496
|
-
|
|
3517
|
+
const editedTimestamp = this[kEditedTimestamp];
|
|
3518
|
+
const createdDate = this.createdDate;
|
|
3519
|
+
if (editedTimestamp) {
|
|
3520
|
+
clone.edited_timestamp = dateToDiscordISOTimestamp(new Date(editedTimestamp));
|
|
3497
3521
|
}
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
clone.timestamp = dateToDiscordISOTimestamp(createdAt);
|
|
3522
|
+
if (createdDate) {
|
|
3523
|
+
clone.timestamp = dateToDiscordISOTimestamp(createdDate);
|
|
3501
3524
|
}
|
|
3502
3525
|
return clone;
|
|
3503
3526
|
}
|
|
@@ -3571,7 +3594,7 @@ var MessageCall = class extends Structure {
|
|
|
3571
3594
|
/**
|
|
3572
3595
|
* The time the call ended at, or `null` if it didn't end yet
|
|
3573
3596
|
*/
|
|
3574
|
-
get
|
|
3597
|
+
get endedDate() {
|
|
3575
3598
|
const endedTimestamp = this.endedTimestamp;
|
|
3576
3599
|
return endedTimestamp ? new Date(endedTimestamp) : null;
|
|
3577
3600
|
}
|
|
@@ -3900,7 +3923,7 @@ var Poll = class extends Structure {
|
|
|
3900
3923
|
/**
|
|
3901
3924
|
* The time the poll will expire at
|
|
3902
3925
|
*/
|
|
3903
|
-
get
|
|
3926
|
+
get expiresDate() {
|
|
3904
3927
|
const expiresTimestamp = this.expiresTimestamp;
|
|
3905
3928
|
return expiresTimestamp ? new Date(expiresTimestamp) : null;
|
|
3906
3929
|
}
|
|
@@ -4020,6 +4043,391 @@ var PollResults = class extends Structure {
|
|
|
4020
4043
|
}
|
|
4021
4044
|
};
|
|
4022
4045
|
|
|
4046
|
+
// src/presences/activities/Activity.ts
|
|
4047
|
+
var Activity = class extends Structure {
|
|
4048
|
+
static {
|
|
4049
|
+
__name(this, "Activity");
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* The template used for removing data from the raw data stored for each activity
|
|
4053
|
+
*/
|
|
4054
|
+
static DataTemplate = {};
|
|
4055
|
+
/**
|
|
4056
|
+
* @param data - The raw data received from the API for the activity
|
|
4057
|
+
*/
|
|
4058
|
+
constructor(data) {
|
|
4059
|
+
super(data);
|
|
4060
|
+
}
|
|
4061
|
+
/**
|
|
4062
|
+
* The name of the activity
|
|
4063
|
+
*/
|
|
4064
|
+
get name() {
|
|
4065
|
+
return this[kData].name;
|
|
4066
|
+
}
|
|
4067
|
+
/**
|
|
4068
|
+
* The type of this activity
|
|
4069
|
+
*
|
|
4070
|
+
* @see {@link https://docs.discord.com/developers/events/gateway-events#activity-object-activity-types}
|
|
4071
|
+
*/
|
|
4072
|
+
get type() {
|
|
4073
|
+
return this[kData].type;
|
|
4074
|
+
}
|
|
4075
|
+
/**
|
|
4076
|
+
* Stream URL, is validated when type is {@link ActivityType.Streaming}
|
|
4077
|
+
*/
|
|
4078
|
+
get url() {
|
|
4079
|
+
return this[kData].url;
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Time of when the activity was added to the user's session
|
|
4083
|
+
*/
|
|
4084
|
+
get createdDate() {
|
|
4085
|
+
return isFieldSet(this[kData], "created_at", "number") ? new Date(this[kData].created_at) : null;
|
|
4086
|
+
}
|
|
4087
|
+
/**
|
|
4088
|
+
* Unix timestamp (in milliseconds) of when the activity was added to the user's session
|
|
4089
|
+
*/
|
|
4090
|
+
get createdTimestamp() {
|
|
4091
|
+
return this[kData].created_at;
|
|
4092
|
+
}
|
|
4093
|
+
/**
|
|
4094
|
+
* Application id for the game
|
|
4095
|
+
*/
|
|
4096
|
+
get applicationId() {
|
|
4097
|
+
return this[kData].application_id;
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* Controls which field is displayed in the user's status text in the member list
|
|
4101
|
+
*
|
|
4102
|
+
* @see {@link https://docs.discord.com/developers/events/gateway-events#activity-object-status-display-types}
|
|
4103
|
+
*/
|
|
4104
|
+
get statusDisplayType() {
|
|
4105
|
+
return this[kData].status_display_type;
|
|
4106
|
+
}
|
|
4107
|
+
/**
|
|
4108
|
+
* What the player is currently doing
|
|
4109
|
+
*/
|
|
4110
|
+
get details() {
|
|
4111
|
+
return this[kData].details;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* URL that is linked when clicking on the details text
|
|
4115
|
+
*/
|
|
4116
|
+
get detailsURL() {
|
|
4117
|
+
return this[kData].details_url;
|
|
4118
|
+
}
|
|
4119
|
+
/**
|
|
4120
|
+
* User's current party status, or text used for a custom status
|
|
4121
|
+
*/
|
|
4122
|
+
get state() {
|
|
4123
|
+
return this[kData].state;
|
|
4124
|
+
}
|
|
4125
|
+
/**
|
|
4126
|
+
* URL that is linked when clicking on the state text
|
|
4127
|
+
*/
|
|
4128
|
+
get stateURL() {
|
|
4129
|
+
return this[kData].state_url;
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* Whether the activity is an instanced game session
|
|
4133
|
+
*/
|
|
4134
|
+
get instance() {
|
|
4135
|
+
return this[kData].instance;
|
|
4136
|
+
}
|
|
4137
|
+
/**
|
|
4138
|
+
* Activity flags `OR`d together, describes what the payload includes
|
|
4139
|
+
*
|
|
4140
|
+
* @see {@link https://docs.discord.com/developers/events/gateway-events#activity-object-activity-flags}
|
|
4141
|
+
*/
|
|
4142
|
+
get flags() {
|
|
4143
|
+
return isFieldSet(this[kData], "flags", "number") ? new ActivityFlagsBitField(this[kData].flags) : null;
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
|
|
4147
|
+
// src/presences/activities/ActivityAssets.ts
|
|
4148
|
+
import {
|
|
4149
|
+
CDNRoutes,
|
|
4150
|
+
ImageFormat,
|
|
4151
|
+
RouteBases as RouteBases2
|
|
4152
|
+
} from "discord-api-types/v10";
|
|
4153
|
+
var ActivityAssets = class extends Structure {
|
|
4154
|
+
static {
|
|
4155
|
+
__name(this, "ActivityAssets");
|
|
4156
|
+
}
|
|
4157
|
+
/**
|
|
4158
|
+
* The template used for removing data from the raw data stored for each activity assets
|
|
4159
|
+
*/
|
|
4160
|
+
static DataTemplate = {};
|
|
4161
|
+
/**
|
|
4162
|
+
* @param data - The raw data received from the API for the activity assets
|
|
4163
|
+
*/
|
|
4164
|
+
constructor(data) {
|
|
4165
|
+
super(data);
|
|
4166
|
+
}
|
|
4167
|
+
/**
|
|
4168
|
+
* @see {@link https://docs.discord.com/developers/events/gateway-events#activity-object-activity-asset-image}
|
|
4169
|
+
*/
|
|
4170
|
+
get largeImage() {
|
|
4171
|
+
return this[kData].large_image;
|
|
4172
|
+
}
|
|
4173
|
+
/**
|
|
4174
|
+
* Returns the large image URL of this `largeImage`
|
|
4175
|
+
*
|
|
4176
|
+
* @param applicationId - The id of the application to whom this asset belongs to
|
|
4177
|
+
* @param imageFormat - The desired format of the returned image URL
|
|
4178
|
+
*/
|
|
4179
|
+
largeImageURL(applicationId, imageFormat = ImageFormat.PNG) {
|
|
4180
|
+
return isFieldSet(this[kData], "large_image", "string") ? `${RouteBases2.cdn}${CDNRoutes.applicationAsset(applicationId, this[kData].large_image, imageFormat)}` : null;
|
|
4181
|
+
}
|
|
4182
|
+
/**
|
|
4183
|
+
* Text displayed when hovering over the large image of the activity
|
|
4184
|
+
*/
|
|
4185
|
+
get largeText() {
|
|
4186
|
+
return this[kData].large_text;
|
|
4187
|
+
}
|
|
4188
|
+
/**
|
|
4189
|
+
* URL that is opened when clicking on the large image
|
|
4190
|
+
*/
|
|
4191
|
+
get largeURL() {
|
|
4192
|
+
return this[kData].large_url;
|
|
4193
|
+
}
|
|
4194
|
+
/**
|
|
4195
|
+
* @see {@link https://docs.discord.com/developers/events/gateway-events#activity-object-activity-asset-image}
|
|
4196
|
+
*/
|
|
4197
|
+
get smallImage() {
|
|
4198
|
+
return this[kData].small_image;
|
|
4199
|
+
}
|
|
4200
|
+
/**
|
|
4201
|
+
* Returns the small image URL of this `smallImage`
|
|
4202
|
+
*
|
|
4203
|
+
* @param applicationId - The id of the application to whom this asset belongs to
|
|
4204
|
+
* @param imageFormat - The desired format of the returned image URL
|
|
4205
|
+
*/
|
|
4206
|
+
smallImageURL(applicationId, imageFormat = ImageFormat.PNG) {
|
|
4207
|
+
return isFieldSet(this[kData], "small_image", "string") ? `${RouteBases2.cdn}${CDNRoutes.applicationAsset(applicationId, this[kData].small_image, imageFormat)}` : null;
|
|
4208
|
+
}
|
|
4209
|
+
/**
|
|
4210
|
+
* Text displayed when hovering over the small image of the activity
|
|
4211
|
+
*/
|
|
4212
|
+
get smallText() {
|
|
4213
|
+
return this[kData].small_text;
|
|
4214
|
+
}
|
|
4215
|
+
/**
|
|
4216
|
+
* URL that is opened when clicking on the small image
|
|
4217
|
+
*/
|
|
4218
|
+
get smallURL() {
|
|
4219
|
+
return this[kData].small_url;
|
|
4220
|
+
}
|
|
4221
|
+
/**
|
|
4222
|
+
* URL of the image which is displayed as a banner on a Game Invite
|
|
4223
|
+
*/
|
|
4224
|
+
get inviteCoverImage() {
|
|
4225
|
+
return this[kData].invite_cover_image;
|
|
4226
|
+
}
|
|
4227
|
+
};
|
|
4228
|
+
|
|
4229
|
+
// src/presences/activities/ActivityButton.ts
|
|
4230
|
+
var ActivityButton = class extends Structure {
|
|
4231
|
+
static {
|
|
4232
|
+
__name(this, "ActivityButton");
|
|
4233
|
+
}
|
|
4234
|
+
/**
|
|
4235
|
+
* The template used for removing data from the raw data stored for each activity button
|
|
4236
|
+
*/
|
|
4237
|
+
static DataTemplate = {};
|
|
4238
|
+
/**
|
|
4239
|
+
* @param data - The raw data received from the API for the activity button
|
|
4240
|
+
*/
|
|
4241
|
+
constructor(data) {
|
|
4242
|
+
super(data);
|
|
4243
|
+
}
|
|
4244
|
+
/**
|
|
4245
|
+
* Text shown on the button (1-32 characters)
|
|
4246
|
+
*/
|
|
4247
|
+
get label() {
|
|
4248
|
+
return this[kData].label;
|
|
4249
|
+
}
|
|
4250
|
+
/**
|
|
4251
|
+
* URL opened when clicking the button (1-512 characters)
|
|
4252
|
+
*/
|
|
4253
|
+
get url() {
|
|
4254
|
+
return this[kData].url;
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
4257
|
+
|
|
4258
|
+
// src/presences/activities/ActivityParty.ts
|
|
4259
|
+
var ActivityParty = class extends Structure {
|
|
4260
|
+
static {
|
|
4261
|
+
__name(this, "ActivityParty");
|
|
4262
|
+
}
|
|
4263
|
+
/**
|
|
4264
|
+
* The template used for removing data from the raw data stored for each activity party.
|
|
4265
|
+
*/
|
|
4266
|
+
static DataTemplate = {};
|
|
4267
|
+
/**
|
|
4268
|
+
* @param data - The raw data received from the API for the activity party.
|
|
4269
|
+
*/
|
|
4270
|
+
constructor(data) {
|
|
4271
|
+
super(data);
|
|
4272
|
+
}
|
|
4273
|
+
/**
|
|
4274
|
+
* The id of the party.
|
|
4275
|
+
*
|
|
4276
|
+
* @remarks This is an application-defined id and is not a Discord snowflake.
|
|
4277
|
+
*/
|
|
4278
|
+
get id() {
|
|
4279
|
+
return this[kData].id;
|
|
4280
|
+
}
|
|
4281
|
+
/**
|
|
4282
|
+
* The current size of the party
|
|
4283
|
+
*/
|
|
4284
|
+
get currentSize() {
|
|
4285
|
+
const array = this[kData].size;
|
|
4286
|
+
return array ? isArrayFieldSet(array, 0, "number") ? array[0] : null : null;
|
|
4287
|
+
}
|
|
4288
|
+
/**
|
|
4289
|
+
* The maximum size of the party
|
|
4290
|
+
*/
|
|
4291
|
+
get maximumSize() {
|
|
4292
|
+
const array = this[kData].size;
|
|
4293
|
+
return array ? isArrayFieldSet(array, 1, "number") ? array[1] : null : null;
|
|
4294
|
+
}
|
|
4295
|
+
};
|
|
4296
|
+
|
|
4297
|
+
// src/presences/activities/ActivitySecrets.ts
|
|
4298
|
+
var ActivitySecrets = class extends Structure {
|
|
4299
|
+
static {
|
|
4300
|
+
__name(this, "ActivitySecrets");
|
|
4301
|
+
}
|
|
4302
|
+
/**
|
|
4303
|
+
* The template used for removing data from the raw data stored for each activity's secrets.
|
|
4304
|
+
*/
|
|
4305
|
+
static DataTemplate = {};
|
|
4306
|
+
/**
|
|
4307
|
+
* @param data - The raw data received from the API for the activity's secrets.
|
|
4308
|
+
*/
|
|
4309
|
+
constructor(data) {
|
|
4310
|
+
super(data);
|
|
4311
|
+
}
|
|
4312
|
+
/**
|
|
4313
|
+
* Secret for joining a party.
|
|
4314
|
+
*/
|
|
4315
|
+
get join() {
|
|
4316
|
+
return this[kData].join;
|
|
4317
|
+
}
|
|
4318
|
+
/**
|
|
4319
|
+
* Secret for spectating a game.
|
|
4320
|
+
*/
|
|
4321
|
+
get spectate() {
|
|
4322
|
+
return this[kData].spectate;
|
|
4323
|
+
}
|
|
4324
|
+
/**
|
|
4325
|
+
* Secret for a specific instanced match
|
|
4326
|
+
*/
|
|
4327
|
+
get match() {
|
|
4328
|
+
return this[kData].match;
|
|
4329
|
+
}
|
|
4330
|
+
};
|
|
4331
|
+
|
|
4332
|
+
// src/presences/activities/ActivityTimestamps.ts
|
|
4333
|
+
var ActivityTimestamps = class extends Structure {
|
|
4334
|
+
static {
|
|
4335
|
+
__name(this, "ActivityTimestamps");
|
|
4336
|
+
}
|
|
4337
|
+
/**
|
|
4338
|
+
* The template used for removing data from the raw data stored for each activity timestamp
|
|
4339
|
+
*/
|
|
4340
|
+
static DataTemplate = {};
|
|
4341
|
+
/**
|
|
4342
|
+
* @param data - The raw data received from the API for the activity timestamp
|
|
4343
|
+
*/
|
|
4344
|
+
constructor(data) {
|
|
4345
|
+
super(data);
|
|
4346
|
+
}
|
|
4347
|
+
/**
|
|
4348
|
+
* Unix time (in milliseconds) of when the activity started.
|
|
4349
|
+
*/
|
|
4350
|
+
get startTimestamp() {
|
|
4351
|
+
return this[kData].start;
|
|
4352
|
+
}
|
|
4353
|
+
/**
|
|
4354
|
+
* Time of when the activity started.
|
|
4355
|
+
*/
|
|
4356
|
+
get startDate() {
|
|
4357
|
+
return isFieldSet(this[kData], "start", "number") ? new Date(this[kData].start) : null;
|
|
4358
|
+
}
|
|
4359
|
+
/**
|
|
4360
|
+
* Unix time (in milliseconds) of when the activity ends.
|
|
4361
|
+
*/
|
|
4362
|
+
get endTimestamp() {
|
|
4363
|
+
return this[kData].end;
|
|
4364
|
+
}
|
|
4365
|
+
/**
|
|
4366
|
+
* Time of when the activity ended.
|
|
4367
|
+
*/
|
|
4368
|
+
get endDate() {
|
|
4369
|
+
return isFieldSet(this[kData], "end", "number") ? new Date(this[kData].end) : null;
|
|
4370
|
+
}
|
|
4371
|
+
};
|
|
4372
|
+
|
|
4373
|
+
// src/presences/ClientStatus.ts
|
|
4374
|
+
var ClientStatus = class extends Structure {
|
|
4375
|
+
static {
|
|
4376
|
+
__name(this, "ClientStatus");
|
|
4377
|
+
}
|
|
4378
|
+
/**
|
|
4379
|
+
* The template used for removing data from the raw data stored for each client status
|
|
4380
|
+
*/
|
|
4381
|
+
static DataTemplate = {};
|
|
4382
|
+
/**
|
|
4383
|
+
* @param data - The raw data received from the API for the client status
|
|
4384
|
+
*/
|
|
4385
|
+
constructor(data) {
|
|
4386
|
+
super(data);
|
|
4387
|
+
}
|
|
4388
|
+
/**
|
|
4389
|
+
* The user's status set for an active desktop (Windows, Linux, Mac) application session
|
|
4390
|
+
*/
|
|
4391
|
+
get desktop() {
|
|
4392
|
+
return this[kData].desktop;
|
|
4393
|
+
}
|
|
4394
|
+
/**
|
|
4395
|
+
* The user's status set for an active mobile (iOS, Android) application session
|
|
4396
|
+
*/
|
|
4397
|
+
get mobile() {
|
|
4398
|
+
return this[kData].mobile;
|
|
4399
|
+
}
|
|
4400
|
+
/**
|
|
4401
|
+
* The user's status set for an active web (browser, bot user) application session
|
|
4402
|
+
*/
|
|
4403
|
+
get web() {
|
|
4404
|
+
return this[kData].web;
|
|
4405
|
+
}
|
|
4406
|
+
};
|
|
4407
|
+
|
|
4408
|
+
// src/presences/Presence.ts
|
|
4409
|
+
var Presence = class extends Structure {
|
|
4410
|
+
static {
|
|
4411
|
+
__name(this, "Presence");
|
|
4412
|
+
}
|
|
4413
|
+
/**
|
|
4414
|
+
* The template used for removing data from the raw data stored for each presence update
|
|
4415
|
+
*/
|
|
4416
|
+
static DataTemplate = {};
|
|
4417
|
+
/**
|
|
4418
|
+
* @param data - The raw data received from the API for the presence update
|
|
4419
|
+
*/
|
|
4420
|
+
constructor(data) {
|
|
4421
|
+
super(data);
|
|
4422
|
+
}
|
|
4423
|
+
/**
|
|
4424
|
+
* The user's new status
|
|
4425
|
+
*/
|
|
4426
|
+
get status() {
|
|
4427
|
+
return this[kData].status;
|
|
4428
|
+
}
|
|
4429
|
+
};
|
|
4430
|
+
|
|
4023
4431
|
// src/skus/SKU.ts
|
|
4024
4432
|
var SKU = class extends Structure {
|
|
4025
4433
|
static {
|
|
@@ -4146,7 +4554,7 @@ var SoundboardSound = class extends Structure {
|
|
|
4146
4554
|
*
|
|
4147
4555
|
* @remarks only available for guild soundboard sounds
|
|
4148
4556
|
*/
|
|
4149
|
-
get
|
|
4557
|
+
get createdDate() {
|
|
4150
4558
|
const createdTimestamp = this.createdTimestamp;
|
|
4151
4559
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4152
4560
|
}
|
|
@@ -4213,7 +4621,7 @@ var StageInstance = class extends Structure {
|
|
|
4213
4621
|
/**
|
|
4214
4622
|
* The time the stage instance was created at
|
|
4215
4623
|
*/
|
|
4216
|
-
get
|
|
4624
|
+
get createdDate() {
|
|
4217
4625
|
const createdTimestamp = this.createdTimestamp;
|
|
4218
4626
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4219
4627
|
}
|
|
@@ -4286,7 +4694,7 @@ var Sticker = class extends Structure {
|
|
|
4286
4694
|
/**
|
|
4287
4695
|
* The time the sticker was created at
|
|
4288
4696
|
*/
|
|
4289
|
-
get
|
|
4697
|
+
get createdDate() {
|
|
4290
4698
|
const createdTimestamp = this.createdTimestamp;
|
|
4291
4699
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4292
4700
|
}
|
|
@@ -4355,7 +4763,7 @@ var StickerPack = class extends Structure {
|
|
|
4355
4763
|
/**
|
|
4356
4764
|
* The time the sticker pack was created at
|
|
4357
4765
|
*/
|
|
4358
|
-
get
|
|
4766
|
+
get createdDate() {
|
|
4359
4767
|
const createdTimestamp = this.createdTimestamp;
|
|
4360
4768
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4361
4769
|
}
|
|
@@ -4410,7 +4818,7 @@ var Team = class extends Structure {
|
|
|
4410
4818
|
/**
|
|
4411
4819
|
* The time the team was created at
|
|
4412
4820
|
*/
|
|
4413
|
-
get
|
|
4821
|
+
get createdDate() {
|
|
4414
4822
|
const createdTimestamp = this.createdTimestamp;
|
|
4415
4823
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4416
4824
|
}
|
|
@@ -4613,7 +5021,7 @@ var User = class extends Structure {
|
|
|
4613
5021
|
/**
|
|
4614
5022
|
* The time the user was created at
|
|
4615
5023
|
*/
|
|
4616
|
-
get
|
|
5024
|
+
get createdDate() {
|
|
4617
5025
|
const createdTimestamp = this.createdTimestamp;
|
|
4618
5026
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4619
5027
|
}
|
|
@@ -4783,7 +5191,7 @@ var Webhook = class extends Structure {
|
|
|
4783
5191
|
/**
|
|
4784
5192
|
* The time the webhook was created at
|
|
4785
5193
|
*/
|
|
4786
|
-
get
|
|
5194
|
+
get createdDate() {
|
|
4787
5195
|
const createdTimestamp = this.createdTimestamp;
|
|
4788
5196
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
4789
5197
|
}
|
|
@@ -5010,7 +5418,7 @@ var Subscription = class extends Structure {
|
|
|
5010
5418
|
/**
|
|
5011
5419
|
* The time at which the current subscription period will start
|
|
5012
5420
|
*/
|
|
5013
|
-
get
|
|
5421
|
+
get currentPeriodStartDate() {
|
|
5014
5422
|
const startTimestamp = this.currentPeriodStartTimestamp;
|
|
5015
5423
|
return startTimestamp ? new Date(startTimestamp) : null;
|
|
5016
5424
|
}
|
|
@@ -5023,7 +5431,7 @@ var Subscription = class extends Structure {
|
|
|
5023
5431
|
/**
|
|
5024
5432
|
* The time at which the current subscription period will end
|
|
5025
5433
|
*/
|
|
5026
|
-
get
|
|
5434
|
+
get currentPeriodEndDate() {
|
|
5027
5435
|
const endTimestamp = this.currentPeriodEndTimestamp;
|
|
5028
5436
|
return endTimestamp ? new Date(endTimestamp) : null;
|
|
5029
5437
|
}
|
|
@@ -5044,7 +5452,7 @@ var Subscription = class extends Structure {
|
|
|
5044
5452
|
*
|
|
5045
5453
|
* @remarks This is populated when the {@link Subscription.status} transitions to {@link discord-api-types/v10#SubscriptionStatus.Ending}.
|
|
5046
5454
|
*/
|
|
5047
|
-
get
|
|
5455
|
+
get canceledDate() {
|
|
5048
5456
|
const canceledTimestamp = this.canceledTimestamp;
|
|
5049
5457
|
return canceledTimestamp ? new Date(canceledTimestamp) : null;
|
|
5050
5458
|
}
|
|
@@ -5063,7 +5471,7 @@ var Subscription = class extends Structure {
|
|
|
5063
5471
|
/**
|
|
5064
5472
|
* The time the subscription was created at
|
|
5065
5473
|
*/
|
|
5066
|
-
get
|
|
5474
|
+
get createdDate() {
|
|
5067
5475
|
const createdTimestamp = this.createdTimestamp;
|
|
5068
5476
|
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
5069
5477
|
}
|
|
@@ -5089,6 +5497,13 @@ var Subscription = class extends Structure {
|
|
|
5089
5497
|
};
|
|
5090
5498
|
export {
|
|
5091
5499
|
ActionRowComponent,
|
|
5500
|
+
Activity,
|
|
5501
|
+
ActivityAssets,
|
|
5502
|
+
ActivityButton,
|
|
5503
|
+
ActivityFlagsBitField,
|
|
5504
|
+
ActivityParty,
|
|
5505
|
+
ActivitySecrets,
|
|
5506
|
+
ActivityTimestamps,
|
|
5092
5507
|
AnnouncementChannel,
|
|
5093
5508
|
AnnouncementThreadChannel,
|
|
5094
5509
|
ApplicationCommandInteractionMetadata,
|
|
@@ -5114,6 +5529,7 @@ export {
|
|
|
5114
5529
|
ChannelSlowmodeMixin,
|
|
5115
5530
|
ChannelTopicMixin,
|
|
5116
5531
|
ChannelWebhookMixin,
|
|
5532
|
+
ClientStatus,
|
|
5117
5533
|
Component,
|
|
5118
5534
|
ComponentEmoji,
|
|
5119
5535
|
Connection,
|
|
@@ -5164,6 +5580,7 @@ export {
|
|
|
5164
5580
|
PollMedia,
|
|
5165
5581
|
PollResults,
|
|
5166
5582
|
PremiumButtonComponent,
|
|
5583
|
+
Presence,
|
|
5167
5584
|
PrivateThreadChannel,
|
|
5168
5585
|
PublicThreadChannel,
|
|
5169
5586
|
Reaction,
|