@sapphire/discord-utilities 3.4.1 → 3.4.2-next.09afdaab
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/cjs/index.cjs +0 -67
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +83 -28
- package/dist/esm/index.d.mts +83 -28
- package/dist/esm/index.mjs +0 -67
- package/dist/esm/index.mjs.map +1 -1
- package/dist/iife/index.global.js +56 -70
- package/dist/iife/index.global.js.map +1 -1
- package/package.json +10 -10
|
@@ -184,6 +184,9 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
184
184
|
GatewayDispatchEvents3["EntitlementCreate"] = "ENTITLEMENT_CREATE";
|
|
185
185
|
GatewayDispatchEvents3["EntitlementUpdate"] = "ENTITLEMENT_UPDATE";
|
|
186
186
|
GatewayDispatchEvents3["EntitlementDelete"] = "ENTITLEMENT_DELETE";
|
|
187
|
+
GatewayDispatchEvents3["SubscriptionCreate"] = "SUBSCRIPTION_CREATE";
|
|
188
|
+
GatewayDispatchEvents3["SubscriptionUpdate"] = "SUBSCRIPTION_UPDATE";
|
|
189
|
+
GatewayDispatchEvents3["SubscriptionDelete"] = "SUBSCRIPTION_DELETE";
|
|
187
190
|
})(GatewayDispatchEvents2 || (exports.GatewayDispatchEvents = GatewayDispatchEvents2 = {}));
|
|
188
191
|
}
|
|
189
192
|
});
|
|
@@ -273,7 +276,19 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
273
276
|
*
|
|
274
277
|
* The `timestamp` and `style` group properties are present on the `exec` result of this expression
|
|
275
278
|
*/
|
|
276
|
-
StyledTimestamp: /<t:(?<timestamp>-?\d{1,13}):(?<style>[DFRTdft])
|
|
279
|
+
StyledTimestamp: /<t:(?<timestamp>-?\d{1,13}):(?<style>[DFRTdft])>/,
|
|
280
|
+
/**
|
|
281
|
+
* Regular expression for matching a guild navigation mention
|
|
282
|
+
*
|
|
283
|
+
* The `type` group property is present on the `exec` result of this expression
|
|
284
|
+
*/
|
|
285
|
+
GuildNavigation: /<id:(?<type>customize|browse|guide|linked-roles)>/,
|
|
286
|
+
/**
|
|
287
|
+
* Regular expression for matching a linked role mention
|
|
288
|
+
*
|
|
289
|
+
* The `id` group property is present on the `exec` result of this expression
|
|
290
|
+
*/
|
|
291
|
+
LinkedRole: /<id:linked-roles:(?<id>\d{17,20})>/
|
|
277
292
|
};
|
|
278
293
|
Object.freeze(exports.FormattingPatterns);
|
|
279
294
|
}
|
|
@@ -800,6 +815,8 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
800
815
|
MessageType3[MessageType3["GuildIncidentAlertModeDisabled"] = 37] = "GuildIncidentAlertModeDisabled";
|
|
801
816
|
MessageType3[MessageType3["GuildIncidentReportRaid"] = 38] = "GuildIncidentReportRaid";
|
|
802
817
|
MessageType3[MessageType3["GuildIncidentReportFalseAlarm"] = 39] = "GuildIncidentReportFalseAlarm";
|
|
818
|
+
MessageType3[MessageType3["PurchaseNotification"] = 44] = "PurchaseNotification";
|
|
819
|
+
MessageType3[MessageType3["PollResult"] = 46] = "PollResult";
|
|
803
820
|
})(MessageType2 || (exports.MessageType = MessageType2 = {}));
|
|
804
821
|
var MessageActivityType2;
|
|
805
822
|
(function(MessageActivityType3) {
|
|
@@ -856,6 +873,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
856
873
|
EmbedType3["Article"] = "article";
|
|
857
874
|
EmbedType3["Link"] = "link";
|
|
858
875
|
EmbedType3["AutoModerationMessage"] = "auto_moderation_message";
|
|
876
|
+
EmbedType3["PollResult"] = "poll_result";
|
|
859
877
|
})(EmbedType2 || (exports.EmbedType = EmbedType2 = {}));
|
|
860
878
|
var AttachmentFlags2;
|
|
861
879
|
(function(AttachmentFlags3) {
|
|
@@ -1069,10 +1087,12 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1069
1087
|
GuildMemberFlags3[GuildMemberFlags3["CompletedOnboarding"] = 2] = "CompletedOnboarding";
|
|
1070
1088
|
GuildMemberFlags3[GuildMemberFlags3["BypassesVerification"] = 4] = "BypassesVerification";
|
|
1071
1089
|
GuildMemberFlags3[GuildMemberFlags3["StartedOnboarding"] = 8] = "StartedOnboarding";
|
|
1090
|
+
GuildMemberFlags3[GuildMemberFlags3["IsGuest"] = 16] = "IsGuest";
|
|
1072
1091
|
GuildMemberFlags3[GuildMemberFlags3["StartedHomeActions"] = 32] = "StartedHomeActions";
|
|
1073
1092
|
GuildMemberFlags3[GuildMemberFlags3["CompletedHomeActions"] = 64] = "CompletedHomeActions";
|
|
1074
1093
|
GuildMemberFlags3[GuildMemberFlags3["AutomodQuarantinedUsernameOrGuildNickname"] = 128] = "AutomodQuarantinedUsernameOrGuildNickname";
|
|
1075
1094
|
GuildMemberFlags3[GuildMemberFlags3["AutomodQuarantinedBio"] = 256] = "AutomodQuarantinedBio";
|
|
1095
|
+
GuildMemberFlags3[GuildMemberFlags3["DmSettingsUpsellAcknowledged"] = 512] = "DmSettingsUpsellAcknowledged";
|
|
1076
1096
|
})(GuildMemberFlags2 || (exports.GuildMemberFlags = GuildMemberFlags2 = {}));
|
|
1077
1097
|
var IntegrationExpireBehavior2;
|
|
1078
1098
|
(function(IntegrationExpireBehavior3) {
|
|
@@ -1349,7 +1369,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1349
1369
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
1350
1370
|
};
|
|
1351
1371
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1352
|
-
exports.InteractionContextType = exports.ApplicationIntegrationType = exports.ApplicationCommandType = void 0;
|
|
1372
|
+
exports.EntryPointCommandHandlerType = exports.InteractionContextType = exports.ApplicationIntegrationType = exports.ApplicationCommandType = void 0;
|
|
1353
1373
|
__exportStar(require_chatInput(), exports);
|
|
1354
1374
|
__exportStar(require_contextMenu(), exports);
|
|
1355
1375
|
__exportStar(require_permissions(), exports);
|
|
@@ -1358,6 +1378,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1358
1378
|
ApplicationCommandType3[ApplicationCommandType3["ChatInput"] = 1] = "ChatInput";
|
|
1359
1379
|
ApplicationCommandType3[ApplicationCommandType3["User"] = 2] = "User";
|
|
1360
1380
|
ApplicationCommandType3[ApplicationCommandType3["Message"] = 3] = "Message";
|
|
1381
|
+
ApplicationCommandType3[ApplicationCommandType3["PrimaryEntryPoint"] = 4] = "PrimaryEntryPoint";
|
|
1361
1382
|
})(ApplicationCommandType2 || (exports.ApplicationCommandType = ApplicationCommandType2 = {}));
|
|
1362
1383
|
var ApplicationIntegrationType2;
|
|
1363
1384
|
(function(ApplicationIntegrationType3) {
|
|
@@ -1370,6 +1391,11 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1370
1391
|
InteractionContextType3[InteractionContextType3["BotDM"] = 1] = "BotDM";
|
|
1371
1392
|
InteractionContextType3[InteractionContextType3["PrivateChannel"] = 2] = "PrivateChannel";
|
|
1372
1393
|
})(InteractionContextType2 || (exports.InteractionContextType = InteractionContextType2 = {}));
|
|
1394
|
+
var EntryPointCommandHandlerType2;
|
|
1395
|
+
(function(EntryPointCommandHandlerType3) {
|
|
1396
|
+
EntryPointCommandHandlerType3[EntryPointCommandHandlerType3["AppHandler"] = 1] = "AppHandler";
|
|
1397
|
+
EntryPointCommandHandlerType3[EntryPointCommandHandlerType3["DiscordLaunchActivity"] = 2] = "DiscordLaunchActivity";
|
|
1398
|
+
})(EntryPointCommandHandlerType2 || (exports.EntryPointCommandHandlerType = EntryPointCommandHandlerType2 = {}));
|
|
1373
1399
|
}
|
|
1374
1400
|
});
|
|
1375
1401
|
|
|
@@ -1431,6 +1457,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1431
1457
|
InteractionResponseType3[InteractionResponseType3["ApplicationCommandAutocompleteResult"] = 8] = "ApplicationCommandAutocompleteResult";
|
|
1432
1458
|
InteractionResponseType3[InteractionResponseType3["Modal"] = 9] = "Modal";
|
|
1433
1459
|
InteractionResponseType3[InteractionResponseType3["PremiumRequired"] = 10] = "PremiumRequired";
|
|
1460
|
+
InteractionResponseType3[InteractionResponseType3["LaunchActivity"] = 12] = "LaunchActivity";
|
|
1434
1461
|
})(InteractionResponseType2 || (exports.InteractionResponseType = InteractionResponseType2 = {}));
|
|
1435
1462
|
}
|
|
1436
1463
|
});
|
|
@@ -1643,6 +1670,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1643
1670
|
})(UserPremiumType2 || (exports.UserPremiumType = UserPremiumType2 = {}));
|
|
1644
1671
|
var ConnectionService2;
|
|
1645
1672
|
(function(ConnectionService3) {
|
|
1673
|
+
ConnectionService3["AmazonMusic"] = "amazon-music";
|
|
1646
1674
|
ConnectionService3["BattleNet"] = "battlenet";
|
|
1647
1675
|
ConnectionService3["BungieNet"] = "bungie";
|
|
1648
1676
|
ConnectionService3["Domain"] = "domain";
|
|
@@ -1700,7 +1728,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1700
1728
|
var require_monetization = __commonJS({
|
|
1701
1729
|
"../../node_modules/discord-api-types/payloads/v10/monetization.js"(exports) {
|
|
1702
1730
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1703
|
-
exports.SKUType = exports.SKUFlags = exports.EntitlementType = void 0;
|
|
1731
|
+
exports.SubscriptionStatus = exports.SKUType = exports.SKUFlags = exports.EntitlementType = void 0;
|
|
1704
1732
|
var EntitlementType2;
|
|
1705
1733
|
(function(EntitlementType3) {
|
|
1706
1734
|
EntitlementType3[EntitlementType3["Purchase"] = 1] = "Purchase";
|
|
@@ -1725,6 +1753,12 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1725
1753
|
SKUType3[SKUType3["Subscription"] = 5] = "Subscription";
|
|
1726
1754
|
SKUType3[SKUType3["SubscriptionGroup"] = 6] = "SubscriptionGroup";
|
|
1727
1755
|
})(SKUType2 || (exports.SKUType = SKUType2 = {}));
|
|
1756
|
+
var SubscriptionStatus2;
|
|
1757
|
+
(function(SubscriptionStatus3) {
|
|
1758
|
+
SubscriptionStatus3[SubscriptionStatus3["Active"] = 0] = "Active";
|
|
1759
|
+
SubscriptionStatus3[SubscriptionStatus3["Ending"] = 1] = "Ending";
|
|
1760
|
+
SubscriptionStatus3[SubscriptionStatus3["Inactive"] = 2] = "Inactive";
|
|
1761
|
+
})(SubscriptionStatus2 || (exports.SubscriptionStatus = SubscriptionStatus2 = {}));
|
|
1728
1762
|
}
|
|
1729
1763
|
});
|
|
1730
1764
|
|
|
@@ -1878,6 +1912,8 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1878
1912
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["FeatureTemporarilyDisabledServerSide"] = 40006] = "FeatureTemporarilyDisabledServerSide";
|
|
1879
1913
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["UserBannedFromThisGuild"] = 40007] = "UserBannedFromThisGuild";
|
|
1880
1914
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["ConnectionHasBeenRevoked"] = 40012] = "ConnectionHasBeenRevoked";
|
|
1915
|
+
RESTJSONErrorCodes3[RESTJSONErrorCodes3["OnlyConsumableSKUsCanBeConsumed"] = 40018] = "OnlyConsumableSKUsCanBeConsumed";
|
|
1916
|
+
RESTJSONErrorCodes3[RESTJSONErrorCodes3["YouCanOnlyDeleteSandboxEntitlements"] = 40019] = "YouCanOnlyDeleteSandboxEntitlements";
|
|
1881
1917
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["TargetUserIsNotConnectedToVoice"] = 40032] = "TargetUserIsNotConnectedToVoice";
|
|
1882
1918
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["ThisMessageWasAlreadyCrossposted"] = 40033] = "ThisMessageWasAlreadyCrossposted";
|
|
1883
1919
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["ApplicationCommandWithThatNameAlreadyExists"] = 40041] = "ApplicationCommandWithThatNameAlreadyExists";
|
|
@@ -1889,6 +1925,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
1889
1925
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["ThereAreNoTagsAvailableThatCanBeSetByNonModerators"] = 40066] = "ThereAreNoTagsAvailableThatCanBeSetByNonModerators";
|
|
1890
1926
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["TagRequiredToCreateAForumPostInThisChannel"] = 40067] = "TagRequiredToCreateAForumPostInThisChannel";
|
|
1891
1927
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["AnEntitlementHasAlreadyBeenGrantedForThisResource"] = 40074] = "AnEntitlementHasAlreadyBeenGrantedForThisResource";
|
|
1928
|
+
RESTJSONErrorCodes3[RESTJSONErrorCodes3["ThisInteractionHasHitTheMaximumNumberOfFollowUpMessages"] = 40094] = "ThisInteractionHasHitTheMaximumNumberOfFollowUpMessages";
|
|
1892
1929
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["CloudflareIsBlockingYourRequest"] = 40333] = "CloudflareIsBlockingYourRequest";
|
|
1893
1930
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["MissingAccess"] = 50001] = "MissingAccess";
|
|
1894
1931
|
RESTJSONErrorCodes3[RESTJSONErrorCodes3["InvalidAccountType"] = 50002] = "InvalidAccountType";
|
|
@@ -3081,6 +3118,20 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3081
3118
|
*/
|
|
3082
3119
|
applicationEmoji(applicationId, emojiId) {
|
|
3083
3120
|
return `/applications/${applicationId}/emojis/${emojiId}`;
|
|
3121
|
+
},
|
|
3122
|
+
/**
|
|
3123
|
+
* Route for:
|
|
3124
|
+
* - GET `/skus/{sku.id}/subscriptions`
|
|
3125
|
+
*/
|
|
3126
|
+
skuSubscriptions(skuId) {
|
|
3127
|
+
return `/skus/${skuId}/subscriptions`;
|
|
3128
|
+
},
|
|
3129
|
+
/**
|
|
3130
|
+
* Route for:
|
|
3131
|
+
* - GET `/skus/{sku.id}/subscriptions/${subscription.id}`
|
|
3132
|
+
*/
|
|
3133
|
+
skuSubscription(skuId, subscriptionId) {
|
|
3134
|
+
return `/skus/${skuId}/subscriptions/${subscriptionId}`;
|
|
3084
3135
|
}
|
|
3085
3136
|
};
|
|
3086
3137
|
exports.StickerPackApplicationId = "710982414301790216";
|
|
@@ -3532,6 +3583,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3532
3583
|
import_v10.default.EmbedType;
|
|
3533
3584
|
import_v10.default.EntitlementOwnerType;
|
|
3534
3585
|
import_v10.default.EntitlementType;
|
|
3586
|
+
import_v10.default.EntryPointCommandHandlerType;
|
|
3535
3587
|
import_v10.default.FormattingPatterns;
|
|
3536
3588
|
import_v10.default.ForumLayoutType;
|
|
3537
3589
|
import_v10.default.GatewayCloseCodes;
|
|
@@ -3592,6 +3644,7 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3592
3644
|
import_v10.default.StickerFormatType;
|
|
3593
3645
|
import_v10.default.StickerPackApplicationId;
|
|
3594
3646
|
import_v10.default.StickerType;
|
|
3647
|
+
import_v10.default.SubscriptionStatus;
|
|
3595
3648
|
import_v10.default.TeamMemberMembershipState;
|
|
3596
3649
|
import_v10.default.TeamMemberRole;
|
|
3597
3650
|
import_v10.default.TextInputStyle;
|
|
@@ -3641,11 +3694,6 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3641
3694
|
this.hoistedOptions = this.hoistedOptions[0].options ?? [];
|
|
3642
3695
|
}
|
|
3643
3696
|
}
|
|
3644
|
-
/**
|
|
3645
|
-
* Gets an option by its name
|
|
3646
|
-
* @param name The name of the option
|
|
3647
|
-
* @param required Whether to throw an error if the option is not found
|
|
3648
|
-
*/
|
|
3649
3697
|
get(name, required = false) {
|
|
3650
3698
|
const option = this.hoistedOptions?.find((opt) => opt.name === name);
|
|
3651
3699
|
if (!option) {
|
|
@@ -3656,112 +3704,54 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3656
3704
|
}
|
|
3657
3705
|
return option;
|
|
3658
3706
|
}
|
|
3659
|
-
/**
|
|
3660
|
-
* Gets the selected subcommand
|
|
3661
|
-
* @param required Whether to throw an error if there is no subcommand
|
|
3662
|
-
*/
|
|
3663
3707
|
getSubcommand(required = true) {
|
|
3664
3708
|
if (required && !this.subcommand) {
|
|
3665
3709
|
throw new Error("A subcommand was not selected");
|
|
3666
3710
|
}
|
|
3667
3711
|
return this.subcommand;
|
|
3668
3712
|
}
|
|
3669
|
-
/**
|
|
3670
|
-
* Gets the selected subcommand group
|
|
3671
|
-
* @param required Whether to throw an error if there is no subcommand group
|
|
3672
|
-
*/
|
|
3673
3713
|
getSubcommandGroup(required = true) {
|
|
3674
3714
|
if (required && !this.group) {
|
|
3675
3715
|
throw new Error("A subcommand group was not selected");
|
|
3676
3716
|
}
|
|
3677
3717
|
return this.group;
|
|
3678
3718
|
}
|
|
3679
|
-
/**
|
|
3680
|
-
* Gets a boolean option
|
|
3681
|
-
* @param name The name of the option
|
|
3682
|
-
* @param required Whether to throw an error if the option is not found
|
|
3683
|
-
*/
|
|
3684
3719
|
getBoolean(name, required = false) {
|
|
3685
3720
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Boolean, required);
|
|
3686
3721
|
return option?.value ?? null;
|
|
3687
3722
|
}
|
|
3688
|
-
/**
|
|
3689
|
-
* Gets a channel option
|
|
3690
|
-
* @param name The name of the option
|
|
3691
|
-
* @param required Whether to throw an error if the option is not found
|
|
3692
|
-
*/
|
|
3693
3723
|
getChannel(name, required = false) {
|
|
3694
3724
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Channel, required);
|
|
3695
3725
|
return option && this.resolved && "channels" in this.resolved ? this.resolved.channels?.[option.value] ?? null : null;
|
|
3696
3726
|
}
|
|
3697
|
-
/**
|
|
3698
|
-
* Gets a string option
|
|
3699
|
-
* @param name The name of the option
|
|
3700
|
-
* @param required Whether to throw an error if the option is not found
|
|
3701
|
-
*/
|
|
3702
3727
|
getString(name, required = false) {
|
|
3703
3728
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.String, required);
|
|
3704
3729
|
return option?.value ?? null;
|
|
3705
3730
|
}
|
|
3706
|
-
/**
|
|
3707
|
-
* Gets an integer option
|
|
3708
|
-
* @param name The name of the option
|
|
3709
|
-
* @param required Whether to throw an error if the option is not found
|
|
3710
|
-
*/
|
|
3711
3731
|
getInteger(name, required = false) {
|
|
3712
3732
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Integer, required);
|
|
3713
3733
|
return option?.value ?? null;
|
|
3714
3734
|
}
|
|
3715
|
-
/**
|
|
3716
|
-
* Gets a number option
|
|
3717
|
-
* @param name The name of the option
|
|
3718
|
-
* @param required Whether to throw an error if the option is not found
|
|
3719
|
-
*/
|
|
3720
3735
|
getNumber(name, required = false) {
|
|
3721
3736
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Number, required);
|
|
3722
3737
|
return option?.value ?? null;
|
|
3723
3738
|
}
|
|
3724
|
-
/**
|
|
3725
|
-
* Gets a user option
|
|
3726
|
-
* @param name The name of the option
|
|
3727
|
-
* @param required Whether to throw an error if the option is not found
|
|
3728
|
-
*/
|
|
3729
3739
|
getUser(name, required = false) {
|
|
3730
3740
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.User, required);
|
|
3731
3741
|
return option && this.resolved && "users" in this.resolved ? this.resolved.users?.[option.value] ?? null : null;
|
|
3732
3742
|
}
|
|
3733
|
-
/**
|
|
3734
|
-
* Gets a member option
|
|
3735
|
-
* @param name The name of the option
|
|
3736
|
-
* @param required Whether to throw an error if the option is not found
|
|
3737
|
-
*/
|
|
3738
3743
|
getMember(name, required = false) {
|
|
3739
3744
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.User, required);
|
|
3740
3745
|
return option && this.resolved && "members" in this.resolved ? this.resolved.members?.[option.value] ?? null : null;
|
|
3741
3746
|
}
|
|
3742
|
-
/**
|
|
3743
|
-
* Gets a role option
|
|
3744
|
-
* @param name The name of the option
|
|
3745
|
-
* @param required Whether to throw an error if the option is not found
|
|
3746
|
-
*/
|
|
3747
3747
|
getRole(name, required = false) {
|
|
3748
3748
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Role, required);
|
|
3749
3749
|
return option && this.resolved && "roles" in this.resolved ? this.resolved.roles?.[option.value] ?? null : null;
|
|
3750
3750
|
}
|
|
3751
|
-
/**
|
|
3752
|
-
* Gets an attachment option
|
|
3753
|
-
* @param name The name of the option
|
|
3754
|
-
* @param required Whether to throw an error if the option is not found
|
|
3755
|
-
*/
|
|
3756
3751
|
getAttachment(name, required = false) {
|
|
3757
3752
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Attachment, required);
|
|
3758
3753
|
return option && this.resolved && "attachments" in this.resolved ? this.resolved.attachments?.[option.value] ?? null : null;
|
|
3759
3754
|
}
|
|
3760
|
-
/**
|
|
3761
|
-
* Gets a mentionable option
|
|
3762
|
-
* @param name The name of the option
|
|
3763
|
-
* @param required Whether to throw an error if the option is not found
|
|
3764
|
-
*/
|
|
3765
3755
|
getMentionable(name, required = false) {
|
|
3766
3756
|
const option = this.getTypedOption(name, ApplicationCommandOptionType.Mentionable, required);
|
|
3767
3757
|
if (!option || !this.resolved) {
|
|
@@ -3787,10 +3777,6 @@ var SapphireDiscordUtilities = (function (exports) {
|
|
|
3787
3777
|
}
|
|
3788
3778
|
return this.resolved.users[this.interaction.data.target_id];
|
|
3789
3779
|
}
|
|
3790
|
-
/**
|
|
3791
|
-
* Gets the target member for a context menu interaction
|
|
3792
|
-
* @param required Whether to throw an error if the member data is not present
|
|
3793
|
-
*/
|
|
3794
3780
|
getTargetMember(required = false) {
|
|
3795
3781
|
if (this.interaction.type !== InteractionType.ApplicationCommand || this.interaction.data.type !== ApplicationCommandType.User) {
|
|
3796
3782
|
throw new Error("This method can only be used on user context menu interactions");
|