@discordjs/structures 0.2.0-dev.1767398517-8ccae833e → 0.2.0-dev.1768608129-017176926
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 +145 -2
- package/dist/index.d.ts +145 -2
- package/dist/index.js +231 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -280,6 +280,8 @@ var kEndedTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.endedTimestamp"
|
|
|
280
280
|
var kCreatedTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.createdTimestamp");
|
|
281
281
|
var kEditedTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.editedTimestamp");
|
|
282
282
|
var kArchiveTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.archiveTimestamp");
|
|
283
|
+
var kStartsTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.startsTimestamp");
|
|
284
|
+
var kEndsTimestamp = /* @__PURE__ */ Symbol.for("djs.structures.endsTimestamp");
|
|
283
285
|
var kAllow = /* @__PURE__ */ Symbol.for("djs.structures.allow");
|
|
284
286
|
var kDeny = /* @__PURE__ */ Symbol.for("djs.structures.deny");
|
|
285
287
|
var kBurstColors = /* @__PURE__ */ Symbol.for("djs.structures.burstColors");
|
|
@@ -1408,21 +1410,79 @@ Mixin(VoiceChannel, [
|
|
|
1408
1410
|
VoiceChannelMixin
|
|
1409
1411
|
]);
|
|
1410
1412
|
|
|
1411
|
-
// src/
|
|
1412
|
-
|
|
1413
|
+
// src/emojis/Emoji.ts
|
|
1414
|
+
import { DiscordSnowflake as DiscordSnowflake2 } from "@sapphire/snowflake";
|
|
1415
|
+
var Emoji = class extends Structure {
|
|
1413
1416
|
static {
|
|
1414
|
-
__name(this, "
|
|
1417
|
+
__name(this, "Emoji");
|
|
1415
1418
|
}
|
|
1416
1419
|
/**
|
|
1417
|
-
*
|
|
1420
|
+
* The template used for removing data from the raw data stored for each emoji
|
|
1421
|
+
*/
|
|
1422
|
+
static DataTemplate = {};
|
|
1423
|
+
/**
|
|
1424
|
+
* @param data - The raw data received from the API for the emoji
|
|
1418
1425
|
*/
|
|
1419
1426
|
constructor(data) {
|
|
1420
1427
|
super(data);
|
|
1421
1428
|
}
|
|
1429
|
+
/**
|
|
1430
|
+
* The emoji's id
|
|
1431
|
+
*/
|
|
1432
|
+
get id() {
|
|
1433
|
+
return this[kData].id;
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* The name of the emoji
|
|
1437
|
+
*
|
|
1438
|
+
* @remarks can be null only in reaction emoji objects
|
|
1439
|
+
*/
|
|
1440
|
+
get name() {
|
|
1441
|
+
return this[kData].name;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Whether this emoji must be wrapped in colons
|
|
1445
|
+
*/
|
|
1446
|
+
get requireColons() {
|
|
1447
|
+
return this[kData].require_colons;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Whether the emoji is managed
|
|
1451
|
+
*/
|
|
1452
|
+
get managed() {
|
|
1453
|
+
return this[kData].managed;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Whether the emoji is animated
|
|
1457
|
+
*/
|
|
1458
|
+
get animated() {
|
|
1459
|
+
return this[kData].animated;
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Whether the emoji can be used
|
|
1463
|
+
*
|
|
1464
|
+
* @remarks May be false due to loss of server boosts
|
|
1465
|
+
*/
|
|
1466
|
+
get available() {
|
|
1467
|
+
return this[kData].available;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* The timestamp the emoji was created at
|
|
1471
|
+
*/
|
|
1472
|
+
get createdTimestamp() {
|
|
1473
|
+
return isIdSet(this.id) ? DiscordSnowflake2.timestampFrom(this.id) : null;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* The time the emoji was created at
|
|
1477
|
+
*/
|
|
1478
|
+
get createdAt() {
|
|
1479
|
+
const createdTimestamp = this.createdTimestamp;
|
|
1480
|
+
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1481
|
+
}
|
|
1422
1482
|
};
|
|
1423
1483
|
|
|
1424
|
-
// src/
|
|
1425
|
-
import {
|
|
1484
|
+
// src/entitlements/Entitlement.ts
|
|
1485
|
+
import { DiscordSnowflake as DiscordSnowflake3 } from "@sapphire/snowflake";
|
|
1426
1486
|
|
|
1427
1487
|
// src/utils/optimization.ts
|
|
1428
1488
|
function extendTemplate(superTemplate, additions) {
|
|
@@ -1434,7 +1494,164 @@ function dateToDiscordISOTimestamp(date) {
|
|
|
1434
1494
|
}
|
|
1435
1495
|
__name(dateToDiscordISOTimestamp, "dateToDiscordISOTimestamp");
|
|
1436
1496
|
|
|
1497
|
+
// src/entitlements/Entitlement.ts
|
|
1498
|
+
var Entitlement = class extends Structure {
|
|
1499
|
+
static {
|
|
1500
|
+
__name(this, "Entitlement");
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* The template used for removing data from the raw data stored for each entitlement
|
|
1504
|
+
*
|
|
1505
|
+
* @remarks This template has defaults, if you want to remove additional data and keep the defaults,
|
|
1506
|
+
* use `Object.defineProperties`. To override the defaults, set this value directly.
|
|
1507
|
+
*/
|
|
1508
|
+
static DataTemplate = {
|
|
1509
|
+
set starts_at(_) {
|
|
1510
|
+
},
|
|
1511
|
+
set ends_at(_) {
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
[kStartsTimestamp] = null;
|
|
1515
|
+
[kEndsTimestamp] = null;
|
|
1516
|
+
/**
|
|
1517
|
+
* @param data - The raw data received from the API for the entitlement
|
|
1518
|
+
*/
|
|
1519
|
+
constructor(data) {
|
|
1520
|
+
super(data);
|
|
1521
|
+
this.optimizeData(data);
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* {@inheritDoc Structure.optimizeData}
|
|
1525
|
+
*/
|
|
1526
|
+
optimizeData(data) {
|
|
1527
|
+
if (data.starts_at) {
|
|
1528
|
+
this[kStartsTimestamp] = Date.parse(data.starts_at);
|
|
1529
|
+
}
|
|
1530
|
+
if (data.ends_at) {
|
|
1531
|
+
this[kEndsTimestamp] = Date.parse(data.ends_at);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* The id of the entitlement
|
|
1536
|
+
*/
|
|
1537
|
+
get id() {
|
|
1538
|
+
return this[kData].id;
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* The id of the SKU
|
|
1542
|
+
*/
|
|
1543
|
+
get skuId() {
|
|
1544
|
+
return this[kData].sku_id;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* The id of the parent application
|
|
1548
|
+
*/
|
|
1549
|
+
get applicationId() {
|
|
1550
|
+
return this[kData].application_id;
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* The id of the user that is granted access to the entitlement's SKU
|
|
1554
|
+
*/
|
|
1555
|
+
get userId() {
|
|
1556
|
+
return this[kData].user_id;
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Type of entitlement
|
|
1560
|
+
*
|
|
1561
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#entitlement-object-entitlement-types}
|
|
1562
|
+
*/
|
|
1563
|
+
get type() {
|
|
1564
|
+
return this[kData].type;
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Whether the entitlement was deleted
|
|
1568
|
+
*/
|
|
1569
|
+
get deleted() {
|
|
1570
|
+
return this[kData].deleted;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Start date at which the entitlement is valid
|
|
1574
|
+
*/
|
|
1575
|
+
get startsAt() {
|
|
1576
|
+
const timestamp = this.startsTimestamp;
|
|
1577
|
+
return timestamp ? new Date(timestamp) : null;
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Timestamp of the start date at which the entitlement is valid
|
|
1581
|
+
*/
|
|
1582
|
+
get startsTimestamp() {
|
|
1583
|
+
return this[kStartsTimestamp];
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* End date at which the entitlement is valid
|
|
1587
|
+
*/
|
|
1588
|
+
get endsAt() {
|
|
1589
|
+
const timestamp = this.endsTimestamp;
|
|
1590
|
+
return timestamp ? new Date(timestamp) : null;
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Timestamp of the end date at which the entitlement is valid
|
|
1594
|
+
*/
|
|
1595
|
+
get endsTimestamp() {
|
|
1596
|
+
return this[kEndsTimestamp];
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Id of the guild that is granted access to the entitlement's SKU
|
|
1600
|
+
*/
|
|
1601
|
+
get guildId() {
|
|
1602
|
+
return this[kData].guild_id;
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* For consumable items, whether the entitlement has been consumed
|
|
1606
|
+
*/
|
|
1607
|
+
get consumed() {
|
|
1608
|
+
return this[kData].consumed;
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* The timestamp the entitlement was created at
|
|
1612
|
+
*/
|
|
1613
|
+
get createdTimestamp() {
|
|
1614
|
+
return isIdSet(this.id) ? DiscordSnowflake3.timestampFrom(this.id) : null;
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* The time the entitlement was created at
|
|
1618
|
+
*/
|
|
1619
|
+
get createdAt() {
|
|
1620
|
+
const createdTimestamp = this.createdTimestamp;
|
|
1621
|
+
return createdTimestamp ? new Date(createdTimestamp) : null;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* {@inheritDoc Structure.toJSON}
|
|
1625
|
+
*/
|
|
1626
|
+
toJSON() {
|
|
1627
|
+
const clone = super.toJSON();
|
|
1628
|
+
const startsAtTimestamp = this[kStartsTimestamp];
|
|
1629
|
+
const endsAtTimestamp = this[kEndsTimestamp];
|
|
1630
|
+
if (startsAtTimestamp) {
|
|
1631
|
+
clone.starts_at = dateToDiscordISOTimestamp(new Date(startsAtTimestamp));
|
|
1632
|
+
}
|
|
1633
|
+
if (endsAtTimestamp) {
|
|
1634
|
+
clone.ends_at = dateToDiscordISOTimestamp(new Date(endsAtTimestamp));
|
|
1635
|
+
}
|
|
1636
|
+
return clone;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1640
|
+
// src/interactions/ResolvedInteractionData.ts
|
|
1641
|
+
var ResolvedInteractionData = class extends Structure {
|
|
1642
|
+
static {
|
|
1643
|
+
__name(this, "ResolvedInteractionData");
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* @param data - The raw data received from the API for the connection
|
|
1647
|
+
*/
|
|
1648
|
+
constructor(data) {
|
|
1649
|
+
super(data);
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1437
1653
|
// src/invites/Invite.ts
|
|
1654
|
+
import { RouteBases } from "discord-api-types/v10";
|
|
1438
1655
|
var Invite = class extends Structure {
|
|
1439
1656
|
static {
|
|
1440
1657
|
__name(this, "Invite");
|
|
@@ -2898,7 +3115,7 @@ var ChannelMention = class extends Structure {
|
|
|
2898
3115
|
};
|
|
2899
3116
|
|
|
2900
3117
|
// src/messages/Message.ts
|
|
2901
|
-
import { DiscordSnowflake as
|
|
3118
|
+
import { DiscordSnowflake as DiscordSnowflake4 } from "@sapphire/snowflake";
|
|
2902
3119
|
var Message = class extends Structure {
|
|
2903
3120
|
static {
|
|
2904
3121
|
__name(this, "Message");
|
|
@@ -2952,7 +3169,7 @@ var Message = class extends Structure {
|
|
|
2952
3169
|
* The timestamp this message was created at
|
|
2953
3170
|
*/
|
|
2954
3171
|
get createdTimestamp() {
|
|
2955
|
-
return isIdSet(this.id) ?
|
|
3172
|
+
return isIdSet(this.id) ? DiscordSnowflake4.timestampFrom(this.id) : null;
|
|
2956
3173
|
}
|
|
2957
3174
|
/**
|
|
2958
3175
|
* The time the message was created at
|
|
@@ -3605,7 +3822,7 @@ var AvatarDecorationData = class extends Structure {
|
|
|
3605
3822
|
};
|
|
3606
3823
|
|
|
3607
3824
|
// src/users/User.ts
|
|
3608
|
-
import { DiscordSnowflake as
|
|
3825
|
+
import { DiscordSnowflake as DiscordSnowflake5 } from "@sapphire/snowflake";
|
|
3609
3826
|
var User = class extends Structure {
|
|
3610
3827
|
static {
|
|
3611
3828
|
__name(this, "User");
|
|
@@ -3728,7 +3945,7 @@ var User = class extends Structure {
|
|
|
3728
3945
|
* The timestamp the user was created at
|
|
3729
3946
|
*/
|
|
3730
3947
|
get createdTimestamp() {
|
|
3731
|
-
return isIdSet(this.id) ?
|
|
3948
|
+
return isIdSet(this.id) ? DiscordSnowflake5.timestampFrom(this.id) : null;
|
|
3732
3949
|
}
|
|
3733
3950
|
/**
|
|
3734
3951
|
* The time the user was created at
|
|
@@ -3857,6 +4074,8 @@ export {
|
|
|
3857
4074
|
EmbedProvider,
|
|
3858
4075
|
EmbedThumbnail,
|
|
3859
4076
|
EmbedVideo,
|
|
4077
|
+
Emoji,
|
|
4078
|
+
Entitlement,
|
|
3860
4079
|
FileComponent,
|
|
3861
4080
|
FileUploadComponent,
|
|
3862
4081
|
ForumChannel,
|