lunibee 0.2.0 → 0.2.2
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/README.md +6 -6
- package/dist/builders/attachment.d.ts +5 -1
- package/dist/builders/commands.d.ts +131 -45
- package/dist/builders/components.d.ts +183 -41
- package/dist/builders/embed.d.ts +12 -8
- package/dist/builders/index.d.ts +9 -4
- package/dist/builders/index.js +234 -110
- package/dist/builders/index.js.map +8 -8
- package/dist/core/events.d.ts +28 -12
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +414 -78
- package/dist/core/index.js.map +18 -18
- package/dist/core/permissions.d.ts +6 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +869 -194
- package/dist/index.js.map +25 -24
- package/dist/managers/guild-resources.d.ts +22 -2
- package/dist/managers/guild.d.ts +3 -1
- package/dist/managers/index.d.ts +7 -3
- package/dist/managers/index.js +167 -33
- package/dist/managers/index.js.map +13 -13
- package/dist/managers/member.d.ts +13 -12
- package/dist/managers/message.d.ts +16 -4
- package/dist/rest/index.js +2 -2
- package/dist/rest/index.js.map +1 -1
- package/dist/sharding/index.js +3 -2
- package/dist/sharding/index.js.map +4 -4
- package/dist/structures/base.d.ts +36 -0
- package/dist/structures/index.d.ts +38 -3
- package/dist/structures/index.js +240 -34
- package/dist/structures/index.js.map +11 -11
- package/dist/structures/interactions.d.ts +110 -12
- package/dist/structures/options.d.ts +2 -0
- package/dist/structures/resources.d.ts +40 -4
- package/dist/types/gateway.d.ts +14 -0
- package/dist/types/index.d.ts +185 -10
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +4 -4
- package/dist/utils/args.d.ts +79 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +190 -2
- package/dist/utils/index.js.map +5 -4
- package/dist/ws/index.js +2 -1
- package/dist/ws/index.js.map +4 -4
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/core/src/permissions.ts
|
|
3
|
-
var
|
|
4
|
-
((
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})(
|
|
3
|
+
var PermissionOverwriteEnum;
|
|
4
|
+
((PermissionOverwriteEnum) => {
|
|
5
|
+
PermissionOverwriteEnum[PermissionOverwriteEnum["Role"] = 0] = "Role";
|
|
6
|
+
PermissionOverwriteEnum[PermissionOverwriteEnum["Member"] = 1] = "Member";
|
|
7
|
+
})(PermissionOverwriteEnum ||= {});
|
|
8
|
+
var PermissionOverwriteType = PermissionOverwriteEnum;
|
|
8
9
|
var Permission = {
|
|
9
10
|
createInstantInvite: 1n << 0n,
|
|
10
11
|
kickMembers: 1n << 1n,
|
|
@@ -396,6 +397,11 @@ class PermissionSet {
|
|
|
396
397
|
toArray() {
|
|
397
398
|
return Object.keys(Permission).filter((permission) => this.has(permission));
|
|
398
399
|
}
|
|
400
|
+
static #renamed = {
|
|
401
|
+
ManageEmojisAndStickers: "ManageGuildExpressions",
|
|
402
|
+
ManageEmojis: "ManageGuildExpressions",
|
|
403
|
+
UseSlashCommands: "UseApplicationCommands"
|
|
404
|
+
};
|
|
399
405
|
#resolve(permission) {
|
|
400
406
|
if (typeof permission === "bigint")
|
|
401
407
|
return permission;
|
|
@@ -410,6 +416,9 @@ class PermissionSet {
|
|
|
410
416
|
return bit;
|
|
411
417
|
}
|
|
412
418
|
if (typeof permission === "string") {
|
|
419
|
+
const renamed = PermissionSet.#renamed[permission];
|
|
420
|
+
if (renamed)
|
|
421
|
+
return this.#resolve(renamed);
|
|
413
422
|
if (permission in Permission)
|
|
414
423
|
return Permission[permission];
|
|
415
424
|
if (permission in Permissions)
|
|
@@ -806,7 +815,7 @@ var MessageFlags = {
|
|
|
806
815
|
Loading: 128,
|
|
807
816
|
IsComponentsV2: 32768
|
|
808
817
|
};
|
|
809
|
-
var
|
|
818
|
+
var ChannelEnum = {
|
|
810
819
|
GuildText: 0,
|
|
811
820
|
DM: 1,
|
|
812
821
|
GuildVoice: 2,
|
|
@@ -821,7 +830,7 @@ var ChannelType = {
|
|
|
821
830
|
GuildForum: 15,
|
|
822
831
|
GuildMedia: 16
|
|
823
832
|
};
|
|
824
|
-
var
|
|
833
|
+
var ButtonType = {
|
|
825
834
|
Primary: 1,
|
|
826
835
|
Secondary: 2,
|
|
827
836
|
Success: 3,
|
|
@@ -829,7 +838,7 @@ var ButtonStyle = {
|
|
|
829
838
|
Link: 5,
|
|
830
839
|
Premium: 6
|
|
831
840
|
};
|
|
832
|
-
var
|
|
841
|
+
var InteractionResponseEnum = {
|
|
833
842
|
Pong: 1,
|
|
834
843
|
ChannelMessage: 4,
|
|
835
844
|
DeferredChannelMessage: 5,
|
|
@@ -838,13 +847,13 @@ var InteractionResponseType = {
|
|
|
838
847
|
Autocomplete: 8,
|
|
839
848
|
Modal: 9
|
|
840
849
|
};
|
|
841
|
-
var
|
|
850
|
+
var StickerFormatEnum = {
|
|
842
851
|
PNG: 1,
|
|
843
852
|
APNG: 2,
|
|
844
853
|
Lottie: 3,
|
|
845
854
|
GIF: 4
|
|
846
855
|
};
|
|
847
|
-
var
|
|
856
|
+
var StickerEnum = {
|
|
848
857
|
Standard: 1,
|
|
849
858
|
Guild: 2
|
|
850
859
|
};
|
|
@@ -861,7 +870,15 @@ var PremiumTier = {
|
|
|
861
870
|
Tier2: 2,
|
|
862
871
|
Tier3: 3
|
|
863
872
|
};
|
|
864
|
-
var
|
|
873
|
+
var ActivityEnum = {
|
|
874
|
+
Playing: 0,
|
|
875
|
+
Streaming: 1,
|
|
876
|
+
Listening: 2,
|
|
877
|
+
Watching: 3,
|
|
878
|
+
Custom: 4,
|
|
879
|
+
Competing: 5
|
|
880
|
+
};
|
|
881
|
+
var ApplicationCommandOptionEnum = {
|
|
865
882
|
SubCommand: 1,
|
|
866
883
|
SubCommandGroup: 2,
|
|
867
884
|
String: 3,
|
|
@@ -874,11 +891,17 @@ var ApplicationCommandOptionType = {
|
|
|
874
891
|
Number: 10,
|
|
875
892
|
Attachment: 11
|
|
876
893
|
};
|
|
877
|
-
var
|
|
894
|
+
var ApplicationCommandEnum = {
|
|
878
895
|
ChatInput: 1,
|
|
879
896
|
User: 2,
|
|
880
897
|
Message: 3
|
|
881
898
|
};
|
|
899
|
+
var ChannelType = ChannelEnum;
|
|
900
|
+
var InteractionResponseType = InteractionResponseEnum;
|
|
901
|
+
var ApplicationCommandType = ApplicationCommandEnum;
|
|
902
|
+
var ApplicationCommandOptionType = ApplicationCommandOptionEnum;
|
|
903
|
+
var StickerType = StickerEnum;
|
|
904
|
+
var StickerFormatType = StickerFormatEnum;
|
|
882
905
|
// packages/collection/src/cache.ts
|
|
883
906
|
class Cache {
|
|
884
907
|
#entries = new Collection;
|
|
@@ -1627,7 +1650,7 @@ class ResourceManager extends Manager {
|
|
|
1627
1650
|
// packages/rest/package.json
|
|
1628
1651
|
var package_default = {
|
|
1629
1652
|
name: "@lunibee/rest",
|
|
1630
|
-
version: "0.2.
|
|
1653
|
+
version: "0.2.2",
|
|
1631
1654
|
type: "module",
|
|
1632
1655
|
module: "./src/index.ts",
|
|
1633
1656
|
types: "./src/index.ts",
|
|
@@ -2612,6 +2635,11 @@ class Channel extends BaseStructure {
|
|
|
2612
2635
|
editTopic(topic) {
|
|
2613
2636
|
return this.edit({ topic });
|
|
2614
2637
|
}
|
|
2638
|
+
editPermissionOverwrite(targetId, changes, options) {
|
|
2639
|
+
if (!this.#context?.editPermissionOverwrite)
|
|
2640
|
+
throw new Error("This channel is not attached to a client.");
|
|
2641
|
+
return this.#context.editPermissionOverwrite(this.id, targetId, changes, options);
|
|
2642
|
+
}
|
|
2615
2643
|
editParent(parentId) {
|
|
2616
2644
|
return this.edit({ parent_id: parentId });
|
|
2617
2645
|
}
|
|
@@ -2746,6 +2774,7 @@ class Guild extends BaseStructure {
|
|
|
2746
2774
|
return this.name;
|
|
2747
2775
|
}
|
|
2748
2776
|
}
|
|
2777
|
+
|
|
2749
2778
|
// packages/structures/src/resources.ts
|
|
2750
2779
|
function toDateOrNull(value) {
|
|
2751
2780
|
if (!value)
|
|
@@ -2761,13 +2790,15 @@ class GuildMember {
|
|
|
2761
2790
|
roleIds;
|
|
2762
2791
|
pending;
|
|
2763
2792
|
joinedAt;
|
|
2764
|
-
permissions;
|
|
2765
2793
|
avatarHash;
|
|
2766
2794
|
premiumSince;
|
|
2767
2795
|
timedOutUntil;
|
|
2768
2796
|
flags;
|
|
2769
|
-
|
|
2797
|
+
#suppliedPermissions;
|
|
2798
|
+
#context;
|
|
2799
|
+
constructor(data, context) {
|
|
2770
2800
|
this.user = new User(data.user);
|
|
2801
|
+
this.#context = context;
|
|
2771
2802
|
if (!/^\d{1,20}$/.test(data.guild_id))
|
|
2772
2803
|
throw new TypeError("Member guild_id must be a valid snowflake.");
|
|
2773
2804
|
this.guildId = data.guild_id;
|
|
@@ -2777,12 +2808,53 @@ class GuildMember {
|
|
|
2777
2808
|
this.joinedAt = data.joined_at ? new Date(data.joined_at) : undefined;
|
|
2778
2809
|
if (this.joinedAt?.toString() === "Invalid Date")
|
|
2779
2810
|
throw new RangeError("Member joined_at must be a valid date.");
|
|
2780
|
-
|
|
2811
|
+
if (data.permissions !== undefined)
|
|
2812
|
+
this.#suppliedPermissions = new PermissionsBitField(data.permissions);
|
|
2781
2813
|
this.avatarHash = data.avatar ?? null;
|
|
2782
2814
|
this.premiumSince = toDateOrNull(data.premium_since);
|
|
2783
2815
|
this.timedOutUntil = toDateOrNull(data.communication_disabled_until);
|
|
2784
2816
|
this.flags = data.flags ?? 0;
|
|
2785
2817
|
}
|
|
2818
|
+
get permissions() {
|
|
2819
|
+
if (this.#suppliedPermissions)
|
|
2820
|
+
return this.#suppliedPermissions;
|
|
2821
|
+
return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds) ?? 0n);
|
|
2822
|
+
}
|
|
2823
|
+
permissionsIn(channelId) {
|
|
2824
|
+
const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId);
|
|
2825
|
+
return computed ? new PermissionsBitField(computed) : null;
|
|
2826
|
+
}
|
|
2827
|
+
#action(name) {
|
|
2828
|
+
const action = this.#context?.[name];
|
|
2829
|
+
if (!action)
|
|
2830
|
+
throw new Error("This member is not attached to a client.");
|
|
2831
|
+
return action;
|
|
2832
|
+
}
|
|
2833
|
+
kick(reason) {
|
|
2834
|
+
return this.#action("kickMember")(this.guildId, this.user.id, reason);
|
|
2835
|
+
}
|
|
2836
|
+
ban(options = {}) {
|
|
2837
|
+
return this.#action("banMember")(this.guildId, this.user.id, options);
|
|
2838
|
+
}
|
|
2839
|
+
edit(options, reason) {
|
|
2840
|
+
return this.#action("editMember")(this.guildId, this.user.id, options, reason);
|
|
2841
|
+
}
|
|
2842
|
+
timeout(milliseconds, reason) {
|
|
2843
|
+
if (milliseconds !== null && !(milliseconds > 0))
|
|
2844
|
+
throw new RangeError("Timeout length must be a positive number of milliseconds.");
|
|
2845
|
+
return this.edit({
|
|
2846
|
+
communication_disabled_until: milliseconds === null ? null : new Date(Date.now() + milliseconds).toISOString()
|
|
2847
|
+
}, reason);
|
|
2848
|
+
}
|
|
2849
|
+
setNickname(nickname, reason) {
|
|
2850
|
+
return this.edit({ nick: nickname }, reason);
|
|
2851
|
+
}
|
|
2852
|
+
addRole(roleId, reason) {
|
|
2853
|
+
return this.#action("addMemberRole")(this.guildId, this.user.id, roleId, reason);
|
|
2854
|
+
}
|
|
2855
|
+
removeRole(roleId, reason) {
|
|
2856
|
+
return this.#action("removeMemberRole")(this.guildId, this.user.id, roleId, reason);
|
|
2857
|
+
}
|
|
2786
2858
|
get displayName() {
|
|
2787
2859
|
return this.nickname ?? this.user.displayName;
|
|
2788
2860
|
}
|
|
@@ -2885,7 +2957,7 @@ class Invite {
|
|
|
2885
2957
|
return this.url;
|
|
2886
2958
|
}
|
|
2887
2959
|
}
|
|
2888
|
-
var
|
|
2960
|
+
var WebhookEnum = {
|
|
2889
2961
|
Incoming: 1,
|
|
2890
2962
|
ChannelFollower: 2,
|
|
2891
2963
|
Application: 3
|
|
@@ -2901,7 +2973,7 @@ class Webhook extends BaseStructure {
|
|
|
2901
2973
|
token;
|
|
2902
2974
|
constructor(data) {
|
|
2903
2975
|
super(data.id);
|
|
2904
|
-
this.type = data.type ??
|
|
2976
|
+
this.type = data.type ?? WebhookEnum.Incoming;
|
|
2905
2977
|
this.name = data.name ?? null;
|
|
2906
2978
|
this.avatarHash = data.avatar ?? null;
|
|
2907
2979
|
this.channelId = data.channel_id ?? null;
|
|
@@ -3066,6 +3138,7 @@ class GuildOnboarding extends BaseStructure {
|
|
|
3066
3138
|
this.mode = data.mode;
|
|
3067
3139
|
}
|
|
3068
3140
|
}
|
|
3141
|
+
var WebhookType = WebhookEnum;
|
|
3069
3142
|
// packages/structures/src/channels.ts
|
|
3070
3143
|
class NewsChannel extends TextChannel {
|
|
3071
3144
|
}
|
|
@@ -3316,6 +3389,17 @@ class CommandOptions {
|
|
|
3316
3389
|
throw new TypeError(`Resolved mentionable for option "${name}" is missing.`);
|
|
3317
3390
|
return resolved;
|
|
3318
3391
|
}
|
|
3392
|
+
getMentionableType(name) {
|
|
3393
|
+
const opt = this.#get(name);
|
|
3394
|
+
if (!opt || opt.type !== OptionType.Mentionable)
|
|
3395
|
+
return null;
|
|
3396
|
+
const id = String(opt.value);
|
|
3397
|
+
if (this.#resolved?.users?.[id])
|
|
3398
|
+
return "user";
|
|
3399
|
+
if (this.#resolved?.roles?.[id])
|
|
3400
|
+
return "role";
|
|
3401
|
+
return null;
|
|
3402
|
+
}
|
|
3319
3403
|
getAttachment(name, required = false) {
|
|
3320
3404
|
const opt = this.#get(name);
|
|
3321
3405
|
if (!opt || opt.type !== OptionType.Attachment) {
|
|
@@ -3334,7 +3418,7 @@ class CommandOptions {
|
|
|
3334
3418
|
}
|
|
3335
3419
|
}
|
|
3336
3420
|
// packages/structures/src/interactions.ts
|
|
3337
|
-
var
|
|
3421
|
+
var InteractionEnum = {
|
|
3338
3422
|
Ping: 1,
|
|
3339
3423
|
ApplicationCommand: 2,
|
|
3340
3424
|
MessageComponent: 3,
|
|
@@ -3342,8 +3426,17 @@ var InteractionType = {
|
|
|
3342
3426
|
ModalSubmit: 5
|
|
3343
3427
|
};
|
|
3344
3428
|
var EPHEMERAL = 64;
|
|
3429
|
+
var COMMAND_CHAT_INPUT = 1;
|
|
3430
|
+
var COMMAND_USER = 2;
|
|
3431
|
+
var COMMAND_MESSAGE = 3;
|
|
3345
3432
|
var TOKEN_LIFETIME_MS = 15 * 60000;
|
|
3346
3433
|
var DISCORD_EPOCH = 1420070400000n;
|
|
3434
|
+
function splitWithResponse(options) {
|
|
3435
|
+
if (typeof options === "string")
|
|
3436
|
+
return { withResponse: false, rest: options };
|
|
3437
|
+
const { withResponse, ...rest } = options;
|
|
3438
|
+
return { withResponse: withResponse === true, rest };
|
|
3439
|
+
}
|
|
3347
3440
|
function toMessageData(options) {
|
|
3348
3441
|
if (typeof options === "string")
|
|
3349
3442
|
return { content: options };
|
|
@@ -3356,6 +3449,7 @@ function toMessageData(options) {
|
|
|
3356
3449
|
class InteractionResponse {
|
|
3357
3450
|
type;
|
|
3358
3451
|
data;
|
|
3452
|
+
withResponse = false;
|
|
3359
3453
|
constructor(type, data) {
|
|
3360
3454
|
if (!Number.isFinite(type))
|
|
3361
3455
|
throw new TypeError("Interaction response type must be finite.");
|
|
@@ -3366,13 +3460,13 @@ class InteractionResponse {
|
|
|
3366
3460
|
return this.data === undefined ? { type: this.type } : { type: this.type, data: this.data };
|
|
3367
3461
|
}
|
|
3368
3462
|
static message(options) {
|
|
3369
|
-
return new InteractionResponse(
|
|
3463
|
+
return new InteractionResponse(InteractionResponseEnum.ChannelMessage, toMessageData(options));
|
|
3370
3464
|
}
|
|
3371
3465
|
static defer(ephemeral = false) {
|
|
3372
|
-
return new InteractionResponse(
|
|
3466
|
+
return new InteractionResponse(InteractionResponseEnum.DeferredChannelMessage, ephemeral ? { flags: EPHEMERAL } : undefined);
|
|
3373
3467
|
}
|
|
3374
3468
|
static pong() {
|
|
3375
|
-
return new InteractionResponse(
|
|
3469
|
+
return new InteractionResponse(InteractionResponseEnum.Pong);
|
|
3376
3470
|
}
|
|
3377
3471
|
}
|
|
3378
3472
|
|
|
@@ -3400,17 +3494,53 @@ class Interaction {
|
|
|
3400
3494
|
this.type = data.type;
|
|
3401
3495
|
this.data = data;
|
|
3402
3496
|
}
|
|
3497
|
+
#commandType() {
|
|
3498
|
+
if (this.type !== InteractionEnum.ApplicationCommand)
|
|
3499
|
+
return 0;
|
|
3500
|
+
const type = this.data.data?.type;
|
|
3501
|
+
return typeof type === "number" ? type : COMMAND_CHAT_INPUT;
|
|
3502
|
+
}
|
|
3503
|
+
isCommand() {
|
|
3504
|
+
return this.type === InteractionEnum.ApplicationCommand;
|
|
3505
|
+
}
|
|
3403
3506
|
isChatInputCommand() {
|
|
3404
|
-
return this
|
|
3507
|
+
return this.#commandType() === COMMAND_CHAT_INPUT;
|
|
3508
|
+
}
|
|
3509
|
+
isContextMenuCommand() {
|
|
3510
|
+
const type = this.#commandType();
|
|
3511
|
+
return type === COMMAND_USER || type === COMMAND_MESSAGE;
|
|
3512
|
+
}
|
|
3513
|
+
isUserContextMenuCommand() {
|
|
3514
|
+
return this.#commandType() === COMMAND_USER;
|
|
3515
|
+
}
|
|
3516
|
+
isMessageContextMenuCommand() {
|
|
3517
|
+
return this.#commandType() === COMMAND_MESSAGE;
|
|
3518
|
+
}
|
|
3519
|
+
get resourceContext() {
|
|
3520
|
+
return this.#client.resourceContext;
|
|
3521
|
+
}
|
|
3522
|
+
awaitModalSubmit(options) {
|
|
3523
|
+
const collect = this.#client.resourceContext?.collectInteractions;
|
|
3524
|
+
if (!collect)
|
|
3525
|
+
return Promise.reject(new Error("This interaction is not attached to a client."));
|
|
3526
|
+
if (!(options.time > 0))
|
|
3527
|
+
return Promise.reject(new RangeError("awaitModalSubmit needs a positive time."));
|
|
3528
|
+
const userId = this.user?.id;
|
|
3529
|
+
const collector = collect({
|
|
3530
|
+
time: options.time,
|
|
3531
|
+
max: 1,
|
|
3532
|
+
filter: async (interaction) => interaction.isModalSubmit() && interaction.user?.id === userId && (options.customId === undefined || interaction.customId === options.customId) && (options.filter ? await options.filter(interaction) : true)
|
|
3533
|
+
});
|
|
3534
|
+
return collector.next();
|
|
3405
3535
|
}
|
|
3406
3536
|
isMessageComponent() {
|
|
3407
|
-
return this.type ===
|
|
3537
|
+
return this.type === InteractionEnum.MessageComponent;
|
|
3408
3538
|
}
|
|
3409
3539
|
isModalSubmit() {
|
|
3410
|
-
return this.type ===
|
|
3540
|
+
return this.type === InteractionEnum.ModalSubmit;
|
|
3411
3541
|
}
|
|
3412
3542
|
isAutocomplete() {
|
|
3413
|
-
return this.type ===
|
|
3543
|
+
return this.type === InteractionEnum.ApplicationCommandAutocomplete;
|
|
3414
3544
|
}
|
|
3415
3545
|
#componentType() {
|
|
3416
3546
|
return this.isMessageComponent() ? this.data.data?.component_type ?? 0 : 0;
|
|
@@ -3462,7 +3592,7 @@ class Interaction {
|
|
|
3462
3592
|
return new GuildMember({
|
|
3463
3593
|
...raw,
|
|
3464
3594
|
guild_id: this.guildId
|
|
3465
|
-
});
|
|
3595
|
+
}, this.#client.resourceContext);
|
|
3466
3596
|
}
|
|
3467
3597
|
get createdTimestamp() {
|
|
3468
3598
|
return Number((BigInt(this.id) >> 22n) + DISCORD_EPOCH);
|
|
@@ -3495,11 +3625,24 @@ class Interaction {
|
|
|
3495
3625
|
postResponse(response) {
|
|
3496
3626
|
return this.#client.postInteractionResponse(this.id, this.token, response);
|
|
3497
3627
|
}
|
|
3498
|
-
async
|
|
3499
|
-
|
|
3628
|
+
async acknowledgeWith(response, state, withResponse) {
|
|
3629
|
+
response.withResponse = withResponse;
|
|
3630
|
+
const result = await this.acknowledge(response, state);
|
|
3631
|
+
if (!withResponse)
|
|
3632
|
+
return result;
|
|
3633
|
+
const message = result?.resource?.message;
|
|
3634
|
+
return message ? new Message(message, this.#client.resourceContext) : null;
|
|
3500
3635
|
}
|
|
3501
|
-
async
|
|
3502
|
-
|
|
3636
|
+
async reply(options) {
|
|
3637
|
+
const { withResponse, rest } = splitWithResponse(options);
|
|
3638
|
+
return this.acknowledgeWith(InteractionResponse.message(toMessageData(rest)), "replied", withResponse);
|
|
3639
|
+
}
|
|
3640
|
+
async deferReply(options = false) {
|
|
3641
|
+
const ephemeral = typeof options === "boolean" ? options : options.ephemeral === true;
|
|
3642
|
+
const withResponse = typeof options === "object" && options.withResponse === true;
|
|
3643
|
+
const result = await this.acknowledgeWith(InteractionResponse.defer(ephemeral), "deferred", withResponse);
|
|
3644
|
+
if (withResponse)
|
|
3645
|
+
return result;
|
|
3503
3646
|
}
|
|
3504
3647
|
editReply(options) {
|
|
3505
3648
|
this.assertAcknowledged();
|
|
@@ -3513,10 +3656,12 @@ class Interaction {
|
|
|
3513
3656
|
return this.#client.followUpInteraction(this.token, toMessageData(options));
|
|
3514
3657
|
}
|
|
3515
3658
|
async update(options) {
|
|
3516
|
-
|
|
3659
|
+
const { withResponse, rest } = splitWithResponse(options);
|
|
3660
|
+
return this.acknowledgeWith(new InteractionResponse(InteractionResponseEnum.MessageUpdate, toMessageData(rest)), "replied", withResponse);
|
|
3517
3661
|
}
|
|
3518
3662
|
async showModal(modal) {
|
|
3519
|
-
|
|
3663
|
+
const data = "toJSON" in modal && typeof modal.toJSON === "function" ? modal.toJSON() : modal;
|
|
3664
|
+
return this.acknowledge(new InteractionResponse(InteractionResponseEnum.Modal, data), "replied");
|
|
3520
3665
|
}
|
|
3521
3666
|
}
|
|
3522
3667
|
|
|
@@ -3533,21 +3678,56 @@ class CommandInteraction extends Interaction {
|
|
|
3533
3678
|
}
|
|
3534
3679
|
}
|
|
3535
3680
|
|
|
3681
|
+
class ContextMenuCommandInteraction extends CommandInteraction {
|
|
3682
|
+
#resolved() {
|
|
3683
|
+
return this.data.data?.resolved ?? {};
|
|
3684
|
+
}
|
|
3685
|
+
get targetId() {
|
|
3686
|
+
const id = this.data.data?.target_id;
|
|
3687
|
+
return typeof id === "string" ? id : null;
|
|
3688
|
+
}
|
|
3689
|
+
get targetUser() {
|
|
3690
|
+
const id = this.targetId;
|
|
3691
|
+
const raw = id ? this.#resolved().users?.[id] : undefined;
|
|
3692
|
+
return raw ? new User(raw) : null;
|
|
3693
|
+
}
|
|
3694
|
+
get targetMember() {
|
|
3695
|
+
const id = this.targetId;
|
|
3696
|
+
const raw = id ? this.#resolved().members?.[id] : undefined;
|
|
3697
|
+
const user = id ? this.#resolved().users?.[id] : undefined;
|
|
3698
|
+
if (!raw || !user || !this.guildId)
|
|
3699
|
+
return null;
|
|
3700
|
+
return new GuildMember({
|
|
3701
|
+
...raw,
|
|
3702
|
+
user,
|
|
3703
|
+
guild_id: this.guildId
|
|
3704
|
+
}, this.resourceContext);
|
|
3705
|
+
}
|
|
3706
|
+
get targetMessage() {
|
|
3707
|
+
const id = this.targetId;
|
|
3708
|
+
const raw = id ? this.#resolved().messages?.[id] : undefined;
|
|
3709
|
+
return raw ? new Message(raw, this.resourceContext) : null;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3536
3713
|
class ComponentInteraction extends Interaction {
|
|
3537
3714
|
get customId() {
|
|
3538
3715
|
return this.data?.data?.custom_id ?? "";
|
|
3539
3716
|
}
|
|
3717
|
+
get messageId() {
|
|
3718
|
+
return this.data?.message?.id;
|
|
3719
|
+
}
|
|
3540
3720
|
get componentType() {
|
|
3541
3721
|
return this.data?.data?.component_type ?? 0;
|
|
3542
3722
|
}
|
|
3543
3723
|
get values() {
|
|
3544
3724
|
return this.data?.data?.values ?? [];
|
|
3545
3725
|
}
|
|
3546
|
-
async deferUpdate() {
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3726
|
+
async deferUpdate(options = {}) {
|
|
3727
|
+
const withResponse = options.withResponse === true;
|
|
3728
|
+
const result = await this.acknowledgeWith(new InteractionResponse(InteractionResponseEnum.DeferredMessageUpdate), "deferred", withResponse);
|
|
3729
|
+
if (withResponse)
|
|
3730
|
+
return result;
|
|
3551
3731
|
}
|
|
3552
3732
|
}
|
|
3553
3733
|
|
|
@@ -3589,7 +3769,7 @@ class AutocompleteInteraction extends Interaction {
|
|
|
3589
3769
|
async respond(choices) {
|
|
3590
3770
|
if (!Array.isArray(choices))
|
|
3591
3771
|
throw new TypeError("Autocomplete choices must be an array.");
|
|
3592
|
-
const response = new InteractionResponse(
|
|
3772
|
+
const response = new InteractionResponse(InteractionResponseEnum.Autocomplete, { choices });
|
|
3593
3773
|
await this.acknowledge(response, "replied");
|
|
3594
3774
|
}
|
|
3595
3775
|
}
|
|
@@ -3607,18 +3787,21 @@ function findFocused(options) {
|
|
|
3607
3787
|
}
|
|
3608
3788
|
function createInteraction(client, data) {
|
|
3609
3789
|
switch (data.type) {
|
|
3610
|
-
case
|
|
3611
|
-
|
|
3612
|
-
|
|
3790
|
+
case InteractionEnum.ApplicationCommand: {
|
|
3791
|
+
const commandType = data.data?.type;
|
|
3792
|
+
return commandType === COMMAND_USER || commandType === COMMAND_MESSAGE ? new ContextMenuCommandInteraction(client, data) : new CommandInteraction(client, data);
|
|
3793
|
+
}
|
|
3794
|
+
case InteractionEnum.ApplicationCommandAutocomplete:
|
|
3613
3795
|
return new AutocompleteInteraction(client, data);
|
|
3614
|
-
case
|
|
3796
|
+
case InteractionEnum.MessageComponent:
|
|
3615
3797
|
return new ComponentInteraction(client, data);
|
|
3616
|
-
case
|
|
3798
|
+
case InteractionEnum.ModalSubmit:
|
|
3617
3799
|
return new ModalSubmitInteraction(client, data);
|
|
3618
3800
|
default:
|
|
3619
3801
|
return new Interaction(client, data);
|
|
3620
3802
|
}
|
|
3621
3803
|
}
|
|
3804
|
+
var InteractionType = InteractionEnum;
|
|
3622
3805
|
// packages/structures/src/embed.ts
|
|
3623
3806
|
class Embed {
|
|
3624
3807
|
#data;
|
|
@@ -3787,6 +3970,7 @@ class AuditLog {
|
|
|
3787
3970
|
}
|
|
3788
3971
|
|
|
3789
3972
|
// packages/structures/src/index.ts
|
|
3973
|
+
var COMPONENT_COLLECTOR_DEFAULT_TIME = 15 * 60000;
|
|
3790
3974
|
var NON_SYSTEM_MESSAGE_TYPES = new Set([0, 19, 20, 23]);
|
|
3791
3975
|
|
|
3792
3976
|
class Message extends BaseStructure {
|
|
@@ -3807,6 +3991,10 @@ class Message extends BaseStructure {
|
|
|
3807
3991
|
reference;
|
|
3808
3992
|
components;
|
|
3809
3993
|
referencedMessage;
|
|
3994
|
+
stickers;
|
|
3995
|
+
poll;
|
|
3996
|
+
messageSnapshots;
|
|
3997
|
+
member;
|
|
3810
3998
|
#context;
|
|
3811
3999
|
constructor(data, context) {
|
|
3812
4000
|
super(data.id);
|
|
@@ -3827,8 +4015,20 @@ class Message extends BaseStructure {
|
|
|
3827
4015
|
this.mentionEveryone = data.mention_everyone ?? false;
|
|
3828
4016
|
this.type = data.type ?? 0;
|
|
3829
4017
|
this.reference = data.message_reference;
|
|
4018
|
+
this.stickers = data.sticker_items ?? (data.stickers ?? []).map(({ id, name, format_type }) => ({
|
|
4019
|
+
id,
|
|
4020
|
+
name,
|
|
4021
|
+
format_type
|
|
4022
|
+
}));
|
|
4023
|
+
this.poll = data.poll ?? null;
|
|
4024
|
+
this.messageSnapshots = data.message_snapshots ?? [];
|
|
3830
4025
|
this.referencedMessage = data.referenced_message ? new Message(data.referenced_message, context) : data.referenced_message === null ? null : undefined;
|
|
3831
4026
|
this.#context = context;
|
|
4027
|
+
this.member = data.member && data.guild_id ? new GuildMember({
|
|
4028
|
+
...data.member,
|
|
4029
|
+
user: data.member.user ?? data.author,
|
|
4030
|
+
guild_id: data.guild_id
|
|
4031
|
+
}, context) : null;
|
|
3832
4032
|
this.channel = new Channel({ id: data.channel_id, type: 0, guild_id: data.guild_id }, context);
|
|
3833
4033
|
}
|
|
3834
4034
|
get embedsSuppressed() {
|
|
@@ -3869,6 +4069,20 @@ class Message extends BaseStructure {
|
|
|
3869
4069
|
throw new Error("This message is not attached to a client.");
|
|
3870
4070
|
return this.#context.crosspostMessage(this.channelId, this.id);
|
|
3871
4071
|
}
|
|
4072
|
+
createComponentCollector(options = {}) {
|
|
4073
|
+
const collect = this.#context?.collectInteractions;
|
|
4074
|
+
if (!collect)
|
|
4075
|
+
throw new Error("This message is not attached to a client.");
|
|
4076
|
+
const { componentType, filter, ...rest } = options;
|
|
4077
|
+
return collect({
|
|
4078
|
+
...rest,
|
|
4079
|
+
time: rest.time ?? (rest.idle ? undefined : COMPONENT_COLLECTOR_DEFAULT_TIME),
|
|
4080
|
+
filter: async (interaction) => interaction.isMessageComponent() && interaction.messageId === this.id && (componentType === undefined || interaction.componentType === componentType) && (filter ? await filter(interaction) : true)
|
|
4081
|
+
});
|
|
4082
|
+
}
|
|
4083
|
+
awaitComponent(options = {}) {
|
|
4084
|
+
return this.createComponentCollector({ ...options, max: 1 }).next();
|
|
4085
|
+
}
|
|
3872
4086
|
react(emoji) {
|
|
3873
4087
|
if (!this.#context?.addReaction)
|
|
3874
4088
|
throw new Error("This message is not attached to a client.");
|
|
@@ -3942,15 +4156,33 @@ class Message extends BaseStructure {
|
|
|
3942
4156
|
}
|
|
3943
4157
|
|
|
3944
4158
|
// packages/managers/src/message.ts
|
|
4159
|
+
function toRequest(options, allowedMentions) {
|
|
4160
|
+
const { files, ...body } = options;
|
|
4161
|
+
if (allowedMentions !== undefined && body.allowed_mentions === undefined)
|
|
4162
|
+
body.allowed_mentions = allowedMentions;
|
|
4163
|
+
if (!files?.length)
|
|
4164
|
+
return body;
|
|
4165
|
+
return {
|
|
4166
|
+
body,
|
|
4167
|
+
files: files.map((file) => ({
|
|
4168
|
+
name: file.name,
|
|
4169
|
+
data: typeof file.data === "string" ? new TextEncoder().encode(file.data) : file.data,
|
|
4170
|
+
contentType: file.contentType
|
|
4171
|
+
}))
|
|
4172
|
+
};
|
|
4173
|
+
}
|
|
4174
|
+
|
|
3945
4175
|
class MessageManager {
|
|
3946
4176
|
cache;
|
|
3947
4177
|
#caching;
|
|
3948
4178
|
#rest;
|
|
3949
4179
|
#context;
|
|
3950
4180
|
#channelId;
|
|
3951
|
-
|
|
4181
|
+
#allowedMentions;
|
|
4182
|
+
constructor(rest, context, channelId, cache, allowedMentions) {
|
|
3952
4183
|
if (!channelId)
|
|
3953
4184
|
throw new TypeError("Channel ID is required.");
|
|
4185
|
+
this.#allowedMentions = allowedMentions;
|
|
3954
4186
|
this.#rest = rest;
|
|
3955
4187
|
this.#context = context;
|
|
3956
4188
|
this.#channelId = channelId;
|
|
@@ -3964,7 +4196,7 @@ class MessageManager {
|
|
|
3964
4196
|
return this.cache.get(messageId) ?? this.fetch(messageId);
|
|
3965
4197
|
}
|
|
3966
4198
|
async send(options) {
|
|
3967
|
-
const data = await this.#rest.post(Routes.channelMessages(this.#channelId), options);
|
|
4199
|
+
const data = await this.#rest.post(Routes.channelMessages(this.#channelId), toRequest(options, this.#allowedMentions));
|
|
3968
4200
|
return this.upsert(data);
|
|
3969
4201
|
}
|
|
3970
4202
|
async fetch(messageId) {
|
|
@@ -4245,14 +4477,20 @@ class MonetizationManager extends Manager {
|
|
|
4245
4477
|
// packages/managers/src/member.ts
|
|
4246
4478
|
class GuildMemberManager extends ResourceManager {
|
|
4247
4479
|
#rest;
|
|
4480
|
+
#context;
|
|
4248
4481
|
guildId;
|
|
4249
|
-
constructor(guildId, rest) {
|
|
4250
|
-
|
|
4482
|
+
constructor(guildId, rest, context = () => {
|
|
4483
|
+
return;
|
|
4484
|
+
}) {
|
|
4485
|
+
super((id) => rest.get(Routes.guildMember(guildId, id)).then((data) => new GuildMember({ ...data, guild_id: guildId }, context())), (member) => member.user.id);
|
|
4251
4486
|
this.guildId = guildId;
|
|
4252
4487
|
this.#rest = rest;
|
|
4488
|
+
this.#context = context;
|
|
4253
4489
|
}
|
|
4254
|
-
async kick(userId) {
|
|
4255
|
-
await this.#rest.delete(Routes.guildMember(this.guildId, userId)
|
|
4490
|
+
async kick(userId, reason) {
|
|
4491
|
+
await this.#rest.delete(Routes.guildMember(this.guildId, userId), {
|
|
4492
|
+
reason
|
|
4493
|
+
});
|
|
4256
4494
|
this.delete(userId);
|
|
4257
4495
|
}
|
|
4258
4496
|
async ban(userId, options = {}) {
|
|
@@ -4262,21 +4500,21 @@ class GuildMemberManager extends ResourceManager {
|
|
|
4262
4500
|
async unban(userId) {
|
|
4263
4501
|
await this.#rest.delete(Routes.guildBan(this.guildId, userId));
|
|
4264
4502
|
}
|
|
4265
|
-
async edit(userId, options) {
|
|
4266
|
-
const data = await this.#rest.patch(Routes.guildMember(this.guildId, userId), options);
|
|
4267
|
-
const member = new GuildMember({ ...data, guild_id: this.guildId });
|
|
4503
|
+
async edit(userId, options, reason) {
|
|
4504
|
+
const data = await this.#rest.patch(Routes.guildMember(this.guildId, userId), options, { reason });
|
|
4505
|
+
const member = new GuildMember({ ...data, guild_id: this.guildId }, this.#context());
|
|
4268
4506
|
this.set(member.user.id, member);
|
|
4269
4507
|
return member;
|
|
4270
4508
|
}
|
|
4271
|
-
async addRole(userId, roleId) {
|
|
4272
|
-
await this.#rest.put(Routes.guildMemberRole(this.guildId, userId, roleId));
|
|
4509
|
+
async addRole(userId, roleId, reason) {
|
|
4510
|
+
await this.#rest.put(Routes.guildMemberRole(this.guildId, userId, roleId), undefined, { reason });
|
|
4273
4511
|
}
|
|
4274
|
-
async removeRole(userId, roleId) {
|
|
4275
|
-
await this.#rest.delete(Routes.guildMemberRole(this.guildId, userId, roleId));
|
|
4512
|
+
async removeRole(userId, roleId, reason) {
|
|
4513
|
+
await this.#rest.delete(Routes.guildMemberRole(this.guildId, userId, roleId), { reason });
|
|
4276
4514
|
}
|
|
4277
|
-
async timeout(userId, milliseconds) {
|
|
4515
|
+
async timeout(userId, milliseconds, reason) {
|
|
4278
4516
|
const timeoutDate = milliseconds === null ? null : new Date(Date.now() + milliseconds).toISOString();
|
|
4279
|
-
return this.edit(userId, { communication_disabled_until: timeoutDate });
|
|
4517
|
+
return this.edit(userId, { communication_disabled_until: timeoutDate }, reason);
|
|
4280
4518
|
}
|
|
4281
4519
|
}
|
|
4282
4520
|
|
|
@@ -4447,10 +4685,25 @@ class StageInstanceManager extends Manager {
|
|
|
4447
4685
|
|
|
4448
4686
|
class PermissionOverwriteManager {
|
|
4449
4687
|
#rest;
|
|
4688
|
+
#current;
|
|
4450
4689
|
channelId;
|
|
4451
|
-
constructor(rest, channelId) {
|
|
4690
|
+
constructor(rest, channelId, current = () => {
|
|
4691
|
+
return;
|
|
4692
|
+
}) {
|
|
4452
4693
|
this.#rest = rest;
|
|
4453
4694
|
this.channelId = channelId;
|
|
4695
|
+
this.#current = current;
|
|
4696
|
+
}
|
|
4697
|
+
async update(overwriteId, changes, options = {}) {
|
|
4698
|
+
const overwrites = this.#current() ?? (await this.#rest.get(Routes.channel(this.channelId))).permission_overwrites ?? [];
|
|
4699
|
+
const existing = overwrites.find((entry) => entry.id === overwriteId);
|
|
4700
|
+
const type = existing?.type ?? options.type;
|
|
4701
|
+
if (type !== 0 && type !== 1)
|
|
4702
|
+
throw new TypeError("A new permission overwrite needs a type: 0 for a role, 1 for a member.");
|
|
4703
|
+
const touched = (changes.allow ?? 0n) | (changes.deny ?? 0n) | (changes.inherit ?? 0n);
|
|
4704
|
+
const allow = BigInt(existing?.allow ?? 0) & ~touched | (changes.allow ?? 0n);
|
|
4705
|
+
const deny = BigInt(existing?.deny ?? 0) & ~touched | (changes.deny ?? 0n);
|
|
4706
|
+
await this.edit(overwriteId, { type, allow, deny }, options.reason);
|
|
4454
4707
|
}
|
|
4455
4708
|
async edit(overwriteId, options, reason) {
|
|
4456
4709
|
await this.#rest.put(Routes.channelPermission(this.channelId, overwriteId), {
|
|
@@ -4482,6 +4735,10 @@ class GuildManager extends ResourceManager {
|
|
|
4482
4735
|
#voiceStates = new Map;
|
|
4483
4736
|
#autoModerationRules = new Map;
|
|
4484
4737
|
#invites = new Map;
|
|
4738
|
+
#context;
|
|
4739
|
+
attachContext(context) {
|
|
4740
|
+
this.#context = context;
|
|
4741
|
+
}
|
|
4485
4742
|
#perGuild(map, guildId, create) {
|
|
4486
4743
|
let manager = map.get(guildId);
|
|
4487
4744
|
if (!manager)
|
|
@@ -4507,7 +4764,7 @@ class GuildManager extends ResourceManager {
|
|
|
4507
4764
|
members(guildId) {
|
|
4508
4765
|
let manager = this.#members.get(guildId);
|
|
4509
4766
|
if (!manager)
|
|
4510
|
-
this.#members.set(guildId, manager = new GuildMemberManager(guildId, this.#rest));
|
|
4767
|
+
this.#members.set(guildId, manager = new GuildMemberManager(guildId, this.#rest, () => this.#context));
|
|
4511
4768
|
return manager;
|
|
4512
4769
|
}
|
|
4513
4770
|
roles(guildId) {
|
|
@@ -4735,10 +4992,12 @@ class ChannelManager extends Manager {
|
|
|
4735
4992
|
#context;
|
|
4736
4993
|
#messageManagers = new Map;
|
|
4737
4994
|
#messageCache;
|
|
4995
|
+
#allowedMentions;
|
|
4738
4996
|
constructor(rest, options = {}) {
|
|
4739
4997
|
super();
|
|
4740
4998
|
this.#rest = rest;
|
|
4741
4999
|
this.#messageCache = options.messageCache;
|
|
5000
|
+
this.#allowedMentions = options.allowedMentions;
|
|
4742
5001
|
this.#context = {
|
|
4743
5002
|
sendMessage: (channelId, options) => this.send(channelId, options),
|
|
4744
5003
|
editMessage: (channelId, messageId, options) => this.editMessage(channelId, messageId, options),
|
|
@@ -4757,13 +5016,13 @@ class ChannelManager extends Manager {
|
|
|
4757
5016
|
messages(channelId) {
|
|
4758
5017
|
let manager = this.#messageManagers.get(channelId);
|
|
4759
5018
|
if (!manager) {
|
|
4760
|
-
manager = new MessageManager(this.#rest, this.#context, channelId, this.#messageCache);
|
|
5019
|
+
manager = new MessageManager(this.#rest, this.#context, channelId, this.#messageCache, this.#allowedMentions);
|
|
4761
5020
|
this.#messageManagers.set(channelId, manager);
|
|
4762
5021
|
}
|
|
4763
5022
|
return manager;
|
|
4764
5023
|
}
|
|
4765
5024
|
permissionOverwrites(channelId) {
|
|
4766
|
-
return new PermissionOverwriteManager(this.#rest, channelId);
|
|
5025
|
+
return new PermissionOverwriteManager(this.#rest, channelId, () => this.get(channelId)?.permissionOverwrites);
|
|
4767
5026
|
}
|
|
4768
5027
|
threads(channelId) {
|
|
4769
5028
|
return new ThreadManager(this.#rest, this.#context, channelId);
|
|
@@ -4863,7 +5122,7 @@ class ChannelManager extends Manager {
|
|
|
4863
5122
|
return this.messages(data.channel_id).upsert(data);
|
|
4864
5123
|
}
|
|
4865
5124
|
async editMessage(channelId, messageId, options) {
|
|
4866
|
-
return this.messages(channelId).upsert(await this.#rest.patch(Routes.message(channelId, messageId), options));
|
|
5125
|
+
return this.messages(channelId).upsert(await this.#rest.patch(Routes.message(channelId, messageId), toRequest(options, this.#allowedMentions)));
|
|
4867
5126
|
}
|
|
4868
5127
|
async deleteMessage(channelId, messageId) {
|
|
4869
5128
|
await this.#rest.delete(Routes.message(channelId, messageId));
|
|
@@ -5912,6 +6171,7 @@ class Gateway {
|
|
|
5912
6171
|
#message(raw, token) {
|
|
5913
6172
|
if (!this.#session.owns(token))
|
|
5914
6173
|
return;
|
|
6174
|
+
this.#heartbeat.receivedMessage();
|
|
5915
6175
|
const { sequence, action } = classifyFrame(raw);
|
|
5916
6176
|
if (sequence !== null)
|
|
5917
6177
|
this.#session.recordSequence(sequence, token);
|
|
@@ -6180,7 +6440,8 @@ class Client extends EventEmitter2 {
|
|
|
6180
6440
|
this.users = new UserManager(this.rest);
|
|
6181
6441
|
this.guilds = new GuildManager(this.rest);
|
|
6182
6442
|
this.channels = new ChannelManager(this.rest, {
|
|
6183
|
-
messageCache: options.messageCache
|
|
6443
|
+
messageCache: options.messageCache,
|
|
6444
|
+
allowedMentions: options.allowedMentions
|
|
6184
6445
|
});
|
|
6185
6446
|
this.stageInstances = new StageInstanceManager(this.rest);
|
|
6186
6447
|
const placeholderAppCommands = new ApplicationCommandManager(this.rest, "0");
|
|
@@ -6197,8 +6458,32 @@ class Client extends EventEmitter2 {
|
|
|
6197
6458
|
removeReaction: (channelId, messageId, emoji, userId) => this.channels.removeReaction(channelId, messageId, emoji, userId),
|
|
6198
6459
|
removeAllReactions: (channelId, messageId) => this.channels.removeAllReactions(channelId, messageId),
|
|
6199
6460
|
pinMessage: (channelId, messageId) => this.channels.pinMessage(channelId, messageId),
|
|
6200
|
-
unpinMessage: (channelId, messageId) => this.channels.unpinMessage(channelId, messageId)
|
|
6461
|
+
unpinMessage: (channelId, messageId) => this.channels.unpinMessage(channelId, messageId),
|
|
6462
|
+
collectInteractions: (options) => this.createCollector("interactionCreate" /* InteractionCreate */, options),
|
|
6463
|
+
memberPermissions: (guildId, memberId, roleIds, channelId) => this.#memberPermissions(guildId, memberId, roleIds, channelId),
|
|
6464
|
+
kickMember: (guildId, userId, reason) => this.guilds.members(guildId).kick(userId, reason),
|
|
6465
|
+
banMember: (guildId, userId, options) => this.guilds.members(guildId).ban(userId, options),
|
|
6466
|
+
editMember: (guildId, userId, options, reason) => this.guilds.members(guildId).edit(userId, options, reason),
|
|
6467
|
+
addMemberRole: (guildId, userId, roleId, reason) => this.guilds.members(guildId).addRole(userId, roleId, reason),
|
|
6468
|
+
removeMemberRole: (guildId, userId, roleId, reason) => this.guilds.members(guildId).removeRole(userId, roleId, reason),
|
|
6469
|
+
editPermissionOverwrite: async (channelId, targetId, changes, options) => {
|
|
6470
|
+
const bits = { allow: 0n, deny: 0n, inherit: 0n };
|
|
6471
|
+
for (const [name, value] of Object.entries(changes)) {
|
|
6472
|
+
if (!/^[A-Za-z]+$/.test(name))
|
|
6473
|
+
throw new TypeError(`Unknown permission: ${name}`);
|
|
6474
|
+
let bit;
|
|
6475
|
+
try {
|
|
6476
|
+
bit = new PermissionSet(name).bitfield;
|
|
6477
|
+
} catch {
|
|
6478
|
+
throw new TypeError(`Unknown permission: ${name}`);
|
|
6479
|
+
}
|
|
6480
|
+
const key = value === true ? "allow" : value === false ? "deny" : "inherit";
|
|
6481
|
+
bits[key] |= bit;
|
|
6482
|
+
}
|
|
6483
|
+
return this.channels.permissionOverwrites(channelId).update(targetId, bits, options);
|
|
6484
|
+
}
|
|
6201
6485
|
};
|
|
6486
|
+
this.guilds.attachContext(this.#resourceContext);
|
|
6202
6487
|
this.#gateway = new Gateway({
|
|
6203
6488
|
token: options.token,
|
|
6204
6489
|
intents: options.intents,
|
|
@@ -6230,8 +6515,14 @@ class Client extends EventEmitter2 {
|
|
|
6230
6515
|
this.emit("close" /* Close */, data);
|
|
6231
6516
|
});
|
|
6232
6517
|
this.#gateway.on("MESSAGE_CREATE", (data) => {
|
|
6233
|
-
const
|
|
6518
|
+
const payload = data;
|
|
6519
|
+
const message = new Message(payload, this.#resourceContext);
|
|
6234
6520
|
this.#observeMessage(message);
|
|
6521
|
+
if (payload.member && payload.guild_id && this.guilds.has(payload.guild_id))
|
|
6522
|
+
this.#upsertMember(payload.guild_id, {
|
|
6523
|
+
...payload.member,
|
|
6524
|
+
user: payload.member.user ?? payload.author
|
|
6525
|
+
});
|
|
6235
6526
|
const cached = this.options.messageCache ? this.channels.messages(message.channelId).upsert(data) : message;
|
|
6236
6527
|
this.emit("messageCreate" /* MessageCreate */, cached);
|
|
6237
6528
|
});
|
|
@@ -6297,8 +6588,11 @@ class Client extends EventEmitter2 {
|
|
|
6297
6588
|
this.emit(wasCached ? "guildAvailable" /* GuildAvailable */ : "guildCreate" /* GuildCreate */, payload);
|
|
6298
6589
|
});
|
|
6299
6590
|
this.#gateway.on("GUILD_UPDATE", (data) => {
|
|
6300
|
-
|
|
6301
|
-
this.
|
|
6591
|
+
const payload = data;
|
|
6592
|
+
const cached = this.guilds.get(payload.id);
|
|
6593
|
+
const previous = cached ? this.#snapshot(cached) : null;
|
|
6594
|
+
this.guilds.patch(payload);
|
|
6595
|
+
this.emit("guildUpdate" /* GuildUpdate */, payload, previous);
|
|
6302
6596
|
});
|
|
6303
6597
|
this.#gateway.on("GUILD_DELETE", (data) => {
|
|
6304
6598
|
const payload = data;
|
|
@@ -6317,8 +6611,10 @@ class Client extends EventEmitter2 {
|
|
|
6317
6611
|
});
|
|
6318
6612
|
this.#gateway.on("GUILD_MEMBER_UPDATE", (data) => {
|
|
6319
6613
|
const member = data;
|
|
6614
|
+
const cached = this.#cache.members ? this.guilds.members(member.guild_id).get(member.user.id) : undefined;
|
|
6615
|
+
const previous = cached ? this.#snapshot(cached, new GuildMember({ user: member.user, guild_id: member.guild_id }, this.#resourceContext)) : null;
|
|
6320
6616
|
this.#upsertMember(member.guild_id, member);
|
|
6321
|
-
this.emit("guildMemberUpdate" /* GuildMemberUpdate */, member);
|
|
6617
|
+
this.emit("guildMemberUpdate" /* GuildMemberUpdate */, member, previous);
|
|
6322
6618
|
});
|
|
6323
6619
|
this.#gateway.on("GUILD_MEMBER_REMOVE", (data) => {
|
|
6324
6620
|
const member = data;
|
|
@@ -6353,18 +6649,24 @@ class Client extends EventEmitter2 {
|
|
|
6353
6649
|
});
|
|
6354
6650
|
this.#gateway.on("GUILD_ROLE_UPDATE", (data) => {
|
|
6355
6651
|
const event = data;
|
|
6652
|
+
const cached = this.#cache.roles ? this.guilds.roles(event.guild_id).get(event.role.id) : undefined;
|
|
6653
|
+
const previous = cached ? this.#snapshot(cached) : null;
|
|
6356
6654
|
this.#upsertRole(event.guild_id, event.role);
|
|
6357
|
-
this.emit("guildRoleUpdate" /* GuildRoleUpdate */, event);
|
|
6655
|
+
this.emit("guildRoleUpdate" /* GuildRoleUpdate */, event, previous);
|
|
6358
6656
|
});
|
|
6359
6657
|
this.#gateway.on("GUILD_ROLE_DELETE", (data) => {
|
|
6360
6658
|
const event = data;
|
|
6361
|
-
this.guilds.roles(event.guild_id)
|
|
6362
|
-
|
|
6659
|
+
const roles = this.guilds.roles(event.guild_id);
|
|
6660
|
+
const removed = roles.get(event.role_id) ?? null;
|
|
6661
|
+
roles.delete(event.role_id);
|
|
6662
|
+
this.emit("guildRoleDelete" /* GuildRoleDelete */, event, removed);
|
|
6363
6663
|
});
|
|
6364
6664
|
this.#gateway.on("GUILD_EMOJIS_UPDATE", (data) => {
|
|
6365
6665
|
const event = data;
|
|
6666
|
+
let previous = null;
|
|
6366
6667
|
if (this.#cache.emojis) {
|
|
6367
6668
|
const emojis = this.guilds.emojis(event.guild_id);
|
|
6669
|
+
previous = [...emojis.cache.values()].map((emoji) => this.#snapshot(emoji));
|
|
6368
6670
|
const current = new Set(event.emojis.map((emoji) => emoji.id));
|
|
6369
6671
|
for (const id of [...emojis.cache.keys()])
|
|
6370
6672
|
if (!current.has(id))
|
|
@@ -6372,12 +6674,14 @@ class Client extends EventEmitter2 {
|
|
|
6372
6674
|
for (const emoji of event.emojis)
|
|
6373
6675
|
emojis.upsert(emoji);
|
|
6374
6676
|
}
|
|
6375
|
-
this.emit("guildEmojisUpdate" /* GuildEmojisUpdate */, event);
|
|
6677
|
+
this.emit("guildEmojisUpdate" /* GuildEmojisUpdate */, event, previous);
|
|
6376
6678
|
});
|
|
6377
6679
|
this.#gateway.on("GUILD_STICKERS_UPDATE", (data) => {
|
|
6378
6680
|
const event = data;
|
|
6379
|
-
this.guilds.stickers(event.guild_id)
|
|
6380
|
-
|
|
6681
|
+
const stickers = this.guilds.stickers(event.guild_id);
|
|
6682
|
+
const previous = [...stickers.cache.values()];
|
|
6683
|
+
stickers.sync(event.stickers);
|
|
6684
|
+
this.emit("guildStickersUpdate" /* GuildStickersUpdate */, event, previous);
|
|
6381
6685
|
});
|
|
6382
6686
|
this.#gateway.on("GUILD_SOUNDBOARD_SOUND_CREATE", (data) => {
|
|
6383
6687
|
const sound = data;
|
|
@@ -6458,13 +6762,15 @@ class Client extends EventEmitter2 {
|
|
|
6458
6762
|
this.emit("channelCreate" /* ChannelCreate */, channel);
|
|
6459
6763
|
});
|
|
6460
6764
|
this.#gateway.on("CHANNEL_UPDATE", (data) => {
|
|
6765
|
+
const previous = this.#previousChannel(data);
|
|
6461
6766
|
const channel = this.channels.upsert(data);
|
|
6462
|
-
this.emit("channelUpdate" /* ChannelUpdate */, channel);
|
|
6767
|
+
this.emit("channelUpdate" /* ChannelUpdate */, channel, previous);
|
|
6463
6768
|
});
|
|
6464
6769
|
this.#gateway.on("CHANNEL_DELETE", (data) => {
|
|
6465
6770
|
const payload = data;
|
|
6771
|
+
const removed = this.channels.get(payload.id) ?? null;
|
|
6466
6772
|
this.channels.delete(payload.id);
|
|
6467
|
-
this.emit("channelDelete" /* ChannelDelete */, payload);
|
|
6773
|
+
this.emit("channelDelete" /* ChannelDelete */, payload, removed);
|
|
6468
6774
|
});
|
|
6469
6775
|
this.#gateway.on("CHANNEL_PINS_UPDATE", (data) => this.emit("channelPinsUpdate" /* ChannelPinsUpdate */, data));
|
|
6470
6776
|
this.#gateway.on("THREAD_CREATE", (data) => {
|
|
@@ -6472,13 +6778,15 @@ class Client extends EventEmitter2 {
|
|
|
6472
6778
|
this.emit("threadCreate" /* ThreadCreate */, channel);
|
|
6473
6779
|
});
|
|
6474
6780
|
this.#gateway.on("THREAD_UPDATE", (data) => {
|
|
6781
|
+
const previous = this.#previousChannel(data);
|
|
6475
6782
|
const channel = this.channels.upsert(data);
|
|
6476
|
-
this.emit("threadUpdate" /* ThreadUpdate */, channel);
|
|
6783
|
+
this.emit("threadUpdate" /* ThreadUpdate */, channel, previous);
|
|
6477
6784
|
});
|
|
6478
6785
|
this.#gateway.on("THREAD_DELETE", (data) => {
|
|
6479
6786
|
const payload = data;
|
|
6787
|
+
const removed = this.channels.get(payload.id) ?? null;
|
|
6480
6788
|
this.channels.delete(payload.id);
|
|
6481
|
-
this.emit("threadDelete" /* ThreadDelete */, payload);
|
|
6789
|
+
this.emit("threadDelete" /* ThreadDelete */, payload, removed);
|
|
6482
6790
|
});
|
|
6483
6791
|
this.#gateway.on("THREAD_LIST_SYNC", (data) => {
|
|
6484
6792
|
const sync = data;
|
|
@@ -6536,7 +6844,7 @@ class Client extends EventEmitter2 {
|
|
|
6536
6844
|
this.#merge(this.users, message.author.id, message.author);
|
|
6537
6845
|
}
|
|
6538
6846
|
#upsertMember(guildId, data) {
|
|
6539
|
-
const member = new GuildMember({ ...data, guild_id: guildId });
|
|
6847
|
+
const member = new GuildMember({ ...data, guild_id: guildId }, this.#resourceContext);
|
|
6540
6848
|
if (this.#cache.users)
|
|
6541
6849
|
this.#merge(this.users, member.user.id, member.user);
|
|
6542
6850
|
if (!this.#cache.members)
|
|
@@ -6555,6 +6863,15 @@ class Client extends EventEmitter2 {
|
|
|
6555
6863
|
return new Role(data);
|
|
6556
6864
|
return this.#merge(this.guilds.roles(guildId), data.id, new Role(data));
|
|
6557
6865
|
}
|
|
6866
|
+
#snapshot(cached, blank = Object.create(Object.getPrototypeOf(cached))) {
|
|
6867
|
+
return Object.assign(blank, cached);
|
|
6868
|
+
}
|
|
6869
|
+
#previousChannel(data) {
|
|
6870
|
+
const cached = this.channels.get(data.id);
|
|
6871
|
+
if (!cached)
|
|
6872
|
+
return null;
|
|
6873
|
+
return this.#snapshot(cached, createChannel({ id: cached.id, type: cached.type, guild_id: cached.guildId }, this.#resourceContext));
|
|
6874
|
+
}
|
|
6558
6875
|
#merge(manager, id, next) {
|
|
6559
6876
|
const existing = manager.get(id);
|
|
6560
6877
|
if (!existing) {
|
|
@@ -6579,6 +6896,29 @@ class Client extends EventEmitter2 {
|
|
|
6579
6896
|
collector.onDispose(() => this.off(event, listener));
|
|
6580
6897
|
return collector;
|
|
6581
6898
|
}
|
|
6899
|
+
get resourceContext() {
|
|
6900
|
+
return this.#resourceContext;
|
|
6901
|
+
}
|
|
6902
|
+
#memberPermissions(guildId, memberId, roleIds, channelId) {
|
|
6903
|
+
const guild = this.guilds.get(guildId);
|
|
6904
|
+
if (!guild)
|
|
6905
|
+
return null;
|
|
6906
|
+
let channel = channelId ? this.channels.get(channelId) : undefined;
|
|
6907
|
+
if (channelId) {
|
|
6908
|
+
if (channel?.isThread())
|
|
6909
|
+
channel = channel.parentId ? this.channels.get(channel.parentId) : undefined;
|
|
6910
|
+
if (!channel || channel.guildId !== guildId)
|
|
6911
|
+
return null;
|
|
6912
|
+
}
|
|
6913
|
+
return computePermissions({
|
|
6914
|
+
guildId,
|
|
6915
|
+
ownerId: guild.ownerId,
|
|
6916
|
+
memberId,
|
|
6917
|
+
memberRoleIds: [...roleIds],
|
|
6918
|
+
roles: this.guilds.roles(guildId).values(),
|
|
6919
|
+
overwrites: channel?.permissionOverwrites
|
|
6920
|
+
});
|
|
6921
|
+
}
|
|
6582
6922
|
permissionsFor(memberId, guildOrChannelId) {
|
|
6583
6923
|
let channel = this.channels.get(guildOrChannelId);
|
|
6584
6924
|
if (channel?.isThread()) {
|
|
@@ -6622,12 +6962,23 @@ class Client extends EventEmitter2 {
|
|
|
6622
6962
|
this.#gateway.close();
|
|
6623
6963
|
}
|
|
6624
6964
|
postInteractionResponse(id, token, response) {
|
|
6625
|
-
|
|
6965
|
+
const json = response.toJSON();
|
|
6966
|
+
const callback = response.withResponse ? `${Routes.interactionCallback(id, token)}?with_response=true` : Routes.interactionCallback(id, token);
|
|
6967
|
+
const carriesMessage = json.type === 4 || json.type === 7;
|
|
6968
|
+
const upload = json.data ? toRequest(json.data, carriesMessage ? this.options.allowedMentions : undefined) : undefined;
|
|
6969
|
+
if (upload && typeof upload === "object" && "files" in upload) {
|
|
6970
|
+
const { body, files } = upload;
|
|
6971
|
+
return this.rest.post(callback, {
|
|
6972
|
+
body: { ...json, data: body },
|
|
6973
|
+
files
|
|
6974
|
+
});
|
|
6975
|
+
}
|
|
6976
|
+
return this.rest.post(callback, upload === undefined ? json : { ...json, data: upload });
|
|
6626
6977
|
}
|
|
6627
6978
|
editInteractionReply(token, data) {
|
|
6628
6979
|
if (!this.user)
|
|
6629
6980
|
return Promise.reject(new Error("Client is unauthenticated."));
|
|
6630
|
-
return this.rest.patch(Routes.interactionOriginalResponse(this.user.id, token), data);
|
|
6981
|
+
return this.rest.patch(Routes.interactionOriginalResponse(this.user.id, token), toRequest(data, this.options.allowedMentions));
|
|
6631
6982
|
}
|
|
6632
6983
|
deleteInteractionReply(token) {
|
|
6633
6984
|
if (!this.user)
|
|
@@ -6637,14 +6988,14 @@ class Client extends EventEmitter2 {
|
|
|
6637
6988
|
followUpInteraction(token, data) {
|
|
6638
6989
|
if (!this.user)
|
|
6639
6990
|
return Promise.reject(new Error("Client is unauthenticated."));
|
|
6640
|
-
return this.rest.post(`/webhooks/${this.user.id}/${token}`, data);
|
|
6991
|
+
return this.rest.post(`/webhooks/${this.user.id}/${token}`, toRequest(data, this.options.allowedMentions));
|
|
6641
6992
|
}
|
|
6642
6993
|
interactionWebhookMessage(method, applicationId, token, messageId, data) {
|
|
6643
6994
|
const path = messageId === "@original" ? Routes.interactionOriginalResponse(applicationId, token) : Routes.webhookMessage(applicationId, token, messageId);
|
|
6644
6995
|
if (method === "GET")
|
|
6645
6996
|
return this.rest.get(path);
|
|
6646
6997
|
if (method === "PATCH")
|
|
6647
|
-
return this.rest.patch(path, data);
|
|
6998
|
+
return this.rest.patch(path, data ? toRequest(data, this.options.allowedMentions) : data);
|
|
6648
6999
|
return this.rest.delete(path);
|
|
6649
7000
|
}
|
|
6650
7001
|
fetchWebhook(id, token) {
|
|
@@ -6805,7 +7156,7 @@ class HandlerRegistry {
|
|
|
6805
7156
|
// packages/sharding/package.json
|
|
6806
7157
|
var package_default2 = {
|
|
6807
7158
|
name: "@lunibee/sharding",
|
|
6808
|
-
version: "0.2.
|
|
7159
|
+
version: "0.2.2",
|
|
6809
7160
|
type: "module",
|
|
6810
7161
|
module: "./src/index.ts",
|
|
6811
7162
|
types: "./src/index.ts",
|
|
@@ -7339,6 +7690,187 @@ class ShardManager {
|
|
|
7339
7690
|
});
|
|
7340
7691
|
}
|
|
7341
7692
|
}
|
|
7693
|
+
// packages/utils/src/args.ts
|
|
7694
|
+
var SNOWFLAKE = /^\d{16,22}$/;
|
|
7695
|
+
var TRUE_WORDS = new Set([
|
|
7696
|
+
"true",
|
|
7697
|
+
"yes",
|
|
7698
|
+
"y",
|
|
7699
|
+
"on",
|
|
7700
|
+
"1",
|
|
7701
|
+
"enable",
|
|
7702
|
+
"enabled"
|
|
7703
|
+
]);
|
|
7704
|
+
var FALSE_WORDS = new Set([
|
|
7705
|
+
"false",
|
|
7706
|
+
"no",
|
|
7707
|
+
"n",
|
|
7708
|
+
"off",
|
|
7709
|
+
"0",
|
|
7710
|
+
"disable",
|
|
7711
|
+
"disabled"
|
|
7712
|
+
]);
|
|
7713
|
+
function tokenizeArgs(input) {
|
|
7714
|
+
const args = [];
|
|
7715
|
+
let current = "";
|
|
7716
|
+
let quote = null;
|
|
7717
|
+
let started = false;
|
|
7718
|
+
for (let index = 0;index < input.length; index++) {
|
|
7719
|
+
const character = input[index];
|
|
7720
|
+
if (character === "\\" && index + 1 < input.length) {
|
|
7721
|
+
current += input[++index];
|
|
7722
|
+
started = true;
|
|
7723
|
+
} else if (quote) {
|
|
7724
|
+
if (character === quote)
|
|
7725
|
+
quote = null;
|
|
7726
|
+
else
|
|
7727
|
+
current += character;
|
|
7728
|
+
} else if (character === '"' || character === "'") {
|
|
7729
|
+
if (started)
|
|
7730
|
+
current += character;
|
|
7731
|
+
else {
|
|
7732
|
+
quote = character;
|
|
7733
|
+
started = true;
|
|
7734
|
+
}
|
|
7735
|
+
} else if (/\s/.test(character)) {
|
|
7736
|
+
if (started)
|
|
7737
|
+
args.push(current);
|
|
7738
|
+
current = "";
|
|
7739
|
+
started = false;
|
|
7740
|
+
} else {
|
|
7741
|
+
current += character;
|
|
7742
|
+
started = true;
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7745
|
+
if (started)
|
|
7746
|
+
args.push(current);
|
|
7747
|
+
return args;
|
|
7748
|
+
}
|
|
7749
|
+
function parseUserMention(value) {
|
|
7750
|
+
const id = /^<@!?(\d{16,22})>$/.exec(value)?.[1] ?? value;
|
|
7751
|
+
return SNOWFLAKE.test(id) ? id : null;
|
|
7752
|
+
}
|
|
7753
|
+
function parseRoleMention(value) {
|
|
7754
|
+
const id = /^<@&(\d{16,22})>$/.exec(value)?.[1] ?? value;
|
|
7755
|
+
return SNOWFLAKE.test(id) ? id : null;
|
|
7756
|
+
}
|
|
7757
|
+
function parseChannelMention(value) {
|
|
7758
|
+
const id = /^<#(\d{16,22})>$/.exec(value)?.[1] ?? value;
|
|
7759
|
+
return SNOWFLAKE.test(id) ? id : null;
|
|
7760
|
+
}
|
|
7761
|
+
function parseMentionable(value) {
|
|
7762
|
+
const role = /^<@&(\d{16,22})>$/.exec(value)?.[1];
|
|
7763
|
+
if (role)
|
|
7764
|
+
return { id: role, type: "role" };
|
|
7765
|
+
const user = parseUserMention(value);
|
|
7766
|
+
return user ? { id: user, type: "user" } : null;
|
|
7767
|
+
}
|
|
7768
|
+
function readOne(spec, raw) {
|
|
7769
|
+
switch (spec.type) {
|
|
7770
|
+
case "string":
|
|
7771
|
+
case "rest":
|
|
7772
|
+
if (spec.maxLength !== undefined && raw.length > spec.maxLength)
|
|
7773
|
+
return {
|
|
7774
|
+
error: `must be at most ${spec.maxLength} characters`
|
|
7775
|
+
};
|
|
7776
|
+
if (spec.choices && !spec.choices.some((choice) => String(choice).toLowerCase() === raw.toLowerCase()))
|
|
7777
|
+
return { error: `must be one of: ${spec.choices.join(", ")}` };
|
|
7778
|
+
return { value: raw };
|
|
7779
|
+
case "integer":
|
|
7780
|
+
case "number": {
|
|
7781
|
+
const value = Number(raw);
|
|
7782
|
+
if (!Number.isFinite(value) || raw.trim() === "")
|
|
7783
|
+
return { error: "must be a number" };
|
|
7784
|
+
if (spec.type === "integer" && !Number.isSafeInteger(value))
|
|
7785
|
+
return { error: "must be a whole number" };
|
|
7786
|
+
if (spec.min !== undefined && value < spec.min)
|
|
7787
|
+
return { error: `must be at least ${spec.min}` };
|
|
7788
|
+
if (spec.max !== undefined && value > spec.max)
|
|
7789
|
+
return { error: `must be at most ${spec.max}` };
|
|
7790
|
+
if (spec.choices && !spec.choices.includes(value))
|
|
7791
|
+
return { error: `must be one of: ${spec.choices.join(", ")}` };
|
|
7792
|
+
return { value };
|
|
7793
|
+
}
|
|
7794
|
+
case "boolean": {
|
|
7795
|
+
const word = raw.toLowerCase();
|
|
7796
|
+
if (TRUE_WORDS.has(word))
|
|
7797
|
+
return { value: true };
|
|
7798
|
+
if (FALSE_WORDS.has(word))
|
|
7799
|
+
return { value: false };
|
|
7800
|
+
return { error: "must be yes or no" };
|
|
7801
|
+
}
|
|
7802
|
+
case "user": {
|
|
7803
|
+
const id = parseUserMention(raw);
|
|
7804
|
+
return id ? { value: id } : { error: "must be a user mention or ID" };
|
|
7805
|
+
}
|
|
7806
|
+
case "role": {
|
|
7807
|
+
const id = parseRoleMention(raw);
|
|
7808
|
+
return id ? { value: id } : { error: "must be a role mention or ID" };
|
|
7809
|
+
}
|
|
7810
|
+
case "channel": {
|
|
7811
|
+
const id = parseChannelMention(raw);
|
|
7812
|
+
return id ? { value: id } : { error: "must be a channel mention or ID" };
|
|
7813
|
+
}
|
|
7814
|
+
case "mentionable": {
|
|
7815
|
+
const value = parseMentionable(raw);
|
|
7816
|
+
return value ? { value } : { error: "must be a user or role mention" };
|
|
7817
|
+
}
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
function parsePrefixArgs(input, specs) {
|
|
7821
|
+
const args = typeof input === "string" ? tokenizeArgs(input) : [...input];
|
|
7822
|
+
const values = {};
|
|
7823
|
+
let position = 0;
|
|
7824
|
+
for (const [index, spec] of specs.entries()) {
|
|
7825
|
+
if (spec.type === "rest" && index !== specs.length - 1)
|
|
7826
|
+
throw new TypeError(`The rest argument "${spec.name}" must be the last one.`);
|
|
7827
|
+
const raw = spec.type === "rest" ? args.slice(position).join(" ") : args[position];
|
|
7828
|
+
if (raw === undefined || raw === "") {
|
|
7829
|
+
if (spec.required)
|
|
7830
|
+
return { ok: false, arg: spec.name, error: "is required" };
|
|
7831
|
+
values[spec.name] = undefined;
|
|
7832
|
+
continue;
|
|
7833
|
+
}
|
|
7834
|
+
const read = readOne(spec, raw);
|
|
7835
|
+
if ("error" in read)
|
|
7836
|
+
return { ok: false, arg: spec.name, error: read.error };
|
|
7837
|
+
values[spec.name] = read.value;
|
|
7838
|
+
position += spec.type === "rest" ? args.length : 1;
|
|
7839
|
+
}
|
|
7840
|
+
return { ok: true, values };
|
|
7841
|
+
}
|
|
7842
|
+
var OPTION_TYPES = {
|
|
7843
|
+
3: "string",
|
|
7844
|
+
4: "integer",
|
|
7845
|
+
5: "boolean",
|
|
7846
|
+
6: "user",
|
|
7847
|
+
7: "channel",
|
|
7848
|
+
8: "role",
|
|
7849
|
+
9: "mentionable",
|
|
7850
|
+
10: "number"
|
|
7851
|
+
};
|
|
7852
|
+
function argsFromCommandOptions(options, restLast = false) {
|
|
7853
|
+
const specs = [];
|
|
7854
|
+
for (const option of options) {
|
|
7855
|
+
const type = OPTION_TYPES[option.type];
|
|
7856
|
+
if (!type)
|
|
7857
|
+
continue;
|
|
7858
|
+
specs.push({
|
|
7859
|
+
name: option.name,
|
|
7860
|
+
type,
|
|
7861
|
+
required: option.required,
|
|
7862
|
+
min: option.min_value,
|
|
7863
|
+
max: option.max_value,
|
|
7864
|
+
maxLength: option.max_length,
|
|
7865
|
+
choices: option.choices?.map((choice) => choice.value)
|
|
7866
|
+
});
|
|
7867
|
+
}
|
|
7868
|
+
const last = specs[specs.length - 1];
|
|
7869
|
+
if (restLast && last?.type === "string")
|
|
7870
|
+
last.type = "rest";
|
|
7871
|
+
return specs;
|
|
7872
|
+
}
|
|
7873
|
+
|
|
7342
7874
|
// packages/utils/src/index.ts
|
|
7343
7875
|
function sleep4(ms) {
|
|
7344
7876
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -7758,18 +8290,27 @@ function entersState(target, status, timeoutMs) {
|
|
|
7758
8290
|
});
|
|
7759
8291
|
}
|
|
7760
8292
|
// packages/builders/src/embed.ts
|
|
7761
|
-
class
|
|
8293
|
+
class CreateEmbed {
|
|
7762
8294
|
#data = {};
|
|
7763
8295
|
setTitle(value) {
|
|
7764
|
-
|
|
8296
|
+
if (value === null)
|
|
8297
|
+
delete this.#data.title;
|
|
8298
|
+
else
|
|
8299
|
+
this.#data.title = validate(value, 256, "Embed title");
|
|
7765
8300
|
return this;
|
|
7766
8301
|
}
|
|
7767
8302
|
setDescription(value) {
|
|
7768
|
-
|
|
8303
|
+
if (value === null)
|
|
8304
|
+
delete this.#data.description;
|
|
8305
|
+
else
|
|
8306
|
+
this.#data.description = validate(value, 4096, "Embed description");
|
|
7769
8307
|
return this;
|
|
7770
8308
|
}
|
|
7771
8309
|
setURL(value) {
|
|
7772
|
-
|
|
8310
|
+
if (value === null)
|
|
8311
|
+
delete this.#data.url;
|
|
8312
|
+
else
|
|
8313
|
+
this.#data.url = url(value, "Embed URL");
|
|
7773
8314
|
return this;
|
|
7774
8315
|
}
|
|
7775
8316
|
setColor(value) {
|
|
@@ -7801,11 +8342,19 @@ class EmbedBuilder {
|
|
|
7801
8342
|
return this;
|
|
7802
8343
|
}
|
|
7803
8344
|
setThumbnail(value) {
|
|
8345
|
+
if (value === null) {
|
|
8346
|
+
delete this.#data.thumbnail;
|
|
8347
|
+
return this;
|
|
8348
|
+
}
|
|
7804
8349
|
const valueURL = typeof value === "string" ? value : value.url;
|
|
7805
8350
|
this.#data.thumbnail = { url: url(valueURL, "Thumbnail URL") };
|
|
7806
8351
|
return this;
|
|
7807
8352
|
}
|
|
7808
8353
|
setImage(value) {
|
|
8354
|
+
if (value === null) {
|
|
8355
|
+
delete this.#data.image;
|
|
8356
|
+
return this;
|
|
8357
|
+
}
|
|
7809
8358
|
const valueURL = typeof value === "string" ? value : value.url;
|
|
7810
8359
|
this.#data.image = { url: url(valueURL, "Image URL") };
|
|
7811
8360
|
return this;
|
|
@@ -7872,8 +8421,9 @@ function url(value, field) {
|
|
|
7872
8421
|
throw new TypeError(`${field} must be a valid URL.`, { cause: error });
|
|
7873
8422
|
}
|
|
7874
8423
|
}
|
|
8424
|
+
var EmbedBuilder = CreateEmbed;
|
|
7875
8425
|
// packages/builders/src/components.ts
|
|
7876
|
-
var
|
|
8426
|
+
var ComponentEnum = {
|
|
7877
8427
|
ActionRow: 1,
|
|
7878
8428
|
Button: 2,
|
|
7879
8429
|
StringSelect: 3,
|
|
@@ -7891,9 +8441,9 @@ var ComponentType = {
|
|
|
7891
8441
|
ContentInventoryEntry: 16,
|
|
7892
8442
|
Container: 17
|
|
7893
8443
|
};
|
|
7894
|
-
var
|
|
8444
|
+
var TextInputType = { Short: 1, Paragraph: 2 };
|
|
7895
8445
|
|
|
7896
|
-
class
|
|
8446
|
+
class CreateActionRow {
|
|
7897
8447
|
#components = [];
|
|
7898
8448
|
addComponents(...components) {
|
|
7899
8449
|
if (!components.length)
|
|
@@ -7912,15 +8462,15 @@ class ActionRowBuilder {
|
|
|
7912
8462
|
if (components.length === 0)
|
|
7913
8463
|
throw new RangeError("An action row needs at least one component.");
|
|
7914
8464
|
const types = components.map((component) => component.type);
|
|
7915
|
-
if (types.some((type) => type !==
|
|
8465
|
+
if (types.some((type) => type !== ComponentEnum.Button) && components.length > 1)
|
|
7916
8466
|
throw new RangeError("A select menu or text input must be alone in its action row.");
|
|
7917
|
-
return { type:
|
|
8467
|
+
return { type: ComponentEnum.ActionRow, components };
|
|
7918
8468
|
}
|
|
7919
8469
|
}
|
|
7920
8470
|
|
|
7921
|
-
class
|
|
8471
|
+
class CreateStringSelect {
|
|
7922
8472
|
#data = {
|
|
7923
|
-
type:
|
|
8473
|
+
type: ComponentEnum.StringSelect
|
|
7924
8474
|
};
|
|
7925
8475
|
setCustomId(value) {
|
|
7926
8476
|
validateText(value, 100, "Component custom ID");
|
|
@@ -7979,18 +8529,18 @@ class StringSelectBuilder {
|
|
|
7979
8529
|
}
|
|
7980
8530
|
}
|
|
7981
8531
|
|
|
7982
|
-
class
|
|
8532
|
+
class CreateButton {
|
|
7983
8533
|
#data = {
|
|
7984
|
-
type:
|
|
7985
|
-
style:
|
|
8534
|
+
type: ComponentEnum.Button,
|
|
8535
|
+
style: ButtonType.Secondary
|
|
7986
8536
|
};
|
|
7987
8537
|
setStyle(style) {
|
|
7988
8538
|
const data = this.#data;
|
|
7989
8539
|
data.style = style;
|
|
7990
|
-
if (style ===
|
|
8540
|
+
if (style === ButtonType.Link) {
|
|
7991
8541
|
delete data.custom_id;
|
|
7992
8542
|
delete data.sku_id;
|
|
7993
|
-
} else if (style ===
|
|
8543
|
+
} else if (style === ButtonType.Premium) {
|
|
7994
8544
|
delete data.custom_id;
|
|
7995
8545
|
delete data.url;
|
|
7996
8546
|
delete data.label;
|
|
@@ -8003,7 +8553,7 @@ class ButtonBuilder {
|
|
|
8003
8553
|
}
|
|
8004
8554
|
setCustomId(value) {
|
|
8005
8555
|
validateText(value, 100, "Button custom ID");
|
|
8006
|
-
if (this.#data.style ===
|
|
8556
|
+
if (this.#data.style === ButtonType.Link)
|
|
8007
8557
|
throw new TypeError("Link buttons cannot use custom IDs.");
|
|
8008
8558
|
this.#data.custom_id = value;
|
|
8009
8559
|
return this;
|
|
@@ -8023,13 +8573,13 @@ class ButtonBuilder {
|
|
|
8023
8573
|
cause: error
|
|
8024
8574
|
});
|
|
8025
8575
|
}
|
|
8026
|
-
this.setStyle(
|
|
8576
|
+
this.setStyle(ButtonType.Link);
|
|
8027
8577
|
this.#data.url = url.toString();
|
|
8028
8578
|
return this;
|
|
8029
8579
|
}
|
|
8030
8580
|
setSKUId(skuId) {
|
|
8031
8581
|
validateText(skuId, 20, "Button SKU ID");
|
|
8032
|
-
this.setStyle(
|
|
8582
|
+
this.setStyle(ButtonType.Premium);
|
|
8033
8583
|
this.#data.sku_id = skuId;
|
|
8034
8584
|
return this;
|
|
8035
8585
|
}
|
|
@@ -8043,12 +8593,12 @@ class ButtonBuilder {
|
|
|
8043
8593
|
}
|
|
8044
8594
|
toJSON() {
|
|
8045
8595
|
const data = this.#data;
|
|
8046
|
-
if (data.style ===
|
|
8596
|
+
if (data.style === ButtonType.Link) {
|
|
8047
8597
|
if (!data.url)
|
|
8048
8598
|
throw new TypeError("Link buttons require a URL.");
|
|
8049
8599
|
if (data.custom_id || data.sku_id)
|
|
8050
8600
|
throw new TypeError("Link buttons cannot have a custom ID or SKU ID.");
|
|
8051
|
-
} else if (data.style ===
|
|
8601
|
+
} else if (data.style === ButtonType.Premium) {
|
|
8052
8602
|
if (!data.sku_id)
|
|
8053
8603
|
throw new TypeError("Premium buttons require a SKU ID.");
|
|
8054
8604
|
if (data.custom_id || data.url || data.label || data.emoji)
|
|
@@ -8059,16 +8609,16 @@ class ButtonBuilder {
|
|
|
8059
8609
|
if (data.url || data.sku_id)
|
|
8060
8610
|
throw new TypeError("Only link buttons have a URL and only premium buttons have a SKU ID.");
|
|
8061
8611
|
}
|
|
8062
|
-
if (data.style !==
|
|
8612
|
+
if (data.style !== ButtonType.Premium && !data.label && !data.emoji)
|
|
8063
8613
|
throw new TypeError("Buttons require a label or an emoji.");
|
|
8064
8614
|
return structuredClone(data);
|
|
8065
8615
|
}
|
|
8066
8616
|
}
|
|
8067
8617
|
|
|
8068
|
-
class
|
|
8618
|
+
class CreateEntitySelect {
|
|
8069
8619
|
#data;
|
|
8070
8620
|
constructor(type) {
|
|
8071
|
-
if (type !==
|
|
8621
|
+
if (type !== ComponentEnum.UserSelect && type !== ComponentEnum.RoleSelect && type !== ComponentEnum.MentionableSelect && type !== ComponentEnum.ChannelSelect)
|
|
8072
8622
|
throw new TypeError("Invalid select component type.");
|
|
8073
8623
|
this.#data = { type };
|
|
8074
8624
|
}
|
|
@@ -8110,7 +8660,7 @@ class EntitySelectBuilder {
|
|
|
8110
8660
|
}
|
|
8111
8661
|
}
|
|
8112
8662
|
|
|
8113
|
-
class
|
|
8663
|
+
class CreateModal {
|
|
8114
8664
|
#components = [];
|
|
8115
8665
|
#custom_id;
|
|
8116
8666
|
#title;
|
|
@@ -8132,6 +8682,9 @@ class ModalBuilder {
|
|
|
8132
8682
|
this.#components.push(...components);
|
|
8133
8683
|
return this;
|
|
8134
8684
|
}
|
|
8685
|
+
addTextInputs(...inputs) {
|
|
8686
|
+
return this.addComponents(...inputs.map((input) => new CreateActionRow().addComponents(input)));
|
|
8687
|
+
}
|
|
8135
8688
|
toJSON() {
|
|
8136
8689
|
if (!this.#custom_id || !this.#title)
|
|
8137
8690
|
throw new TypeError("Modals require a custom ID and a title.");
|
|
@@ -8139,17 +8692,17 @@ class ModalBuilder {
|
|
|
8139
8692
|
throw new RangeError("Modals require at least one component.");
|
|
8140
8693
|
return {
|
|
8141
8694
|
type: 9,
|
|
8142
|
-
|
|
8143
|
-
|
|
8695
|
+
custom_id: this.#custom_id,
|
|
8696
|
+
title: this.#title,
|
|
8144
8697
|
components: this.#components.map((component) => component.toJSON())
|
|
8145
8698
|
};
|
|
8146
8699
|
}
|
|
8147
8700
|
}
|
|
8148
8701
|
|
|
8149
|
-
class
|
|
8702
|
+
class CreateTextInput {
|
|
8150
8703
|
#data = {
|
|
8151
|
-
type:
|
|
8152
|
-
style:
|
|
8704
|
+
type: ComponentEnum.TextInput,
|
|
8705
|
+
style: TextInputType.Short
|
|
8153
8706
|
};
|
|
8154
8707
|
setStyle(style) {
|
|
8155
8708
|
this.#data.style = style;
|
|
@@ -8199,7 +8752,7 @@ class TextInputBuilder {
|
|
|
8199
8752
|
}
|
|
8200
8753
|
}
|
|
8201
8754
|
|
|
8202
|
-
class
|
|
8755
|
+
class CreateContainer {
|
|
8203
8756
|
#components = [];
|
|
8204
8757
|
#accentColor;
|
|
8205
8758
|
#spoiler;
|
|
@@ -8222,7 +8775,7 @@ class ContainerBuilder {
|
|
|
8222
8775
|
}
|
|
8223
8776
|
toJSON() {
|
|
8224
8777
|
const data = {
|
|
8225
|
-
type:
|
|
8778
|
+
type: ComponentEnum.Container,
|
|
8226
8779
|
components: this.#components.map((c) => c.toJSON())
|
|
8227
8780
|
};
|
|
8228
8781
|
if (this.#accentColor !== undefined)
|
|
@@ -8233,7 +8786,7 @@ class ContainerBuilder {
|
|
|
8233
8786
|
}
|
|
8234
8787
|
}
|
|
8235
8788
|
|
|
8236
|
-
class
|
|
8789
|
+
class CreateSection {
|
|
8237
8790
|
#components = [];
|
|
8238
8791
|
#accessory;
|
|
8239
8792
|
addComponents(...components) {
|
|
@@ -8248,14 +8801,14 @@ class SectionBuilder {
|
|
|
8248
8801
|
}
|
|
8249
8802
|
toJSON() {
|
|
8250
8803
|
return {
|
|
8251
|
-
type:
|
|
8804
|
+
type: ComponentEnum.Section,
|
|
8252
8805
|
components: this.#components.length ? this.#components.map((c) => c.toJSON()) : undefined,
|
|
8253
8806
|
accessory: this.#accessory?.toJSON()
|
|
8254
8807
|
};
|
|
8255
8808
|
}
|
|
8256
8809
|
}
|
|
8257
8810
|
|
|
8258
|
-
class
|
|
8811
|
+
class CreateTextDisplay {
|
|
8259
8812
|
#content = "";
|
|
8260
8813
|
setContent(content) {
|
|
8261
8814
|
validateText(content, 4000, "Text display content");
|
|
@@ -8264,13 +8817,13 @@ class TextDisplayBuilder {
|
|
|
8264
8817
|
}
|
|
8265
8818
|
toJSON() {
|
|
8266
8819
|
return {
|
|
8267
|
-
type:
|
|
8820
|
+
type: ComponentEnum.TextDisplay,
|
|
8268
8821
|
content: this.#content
|
|
8269
8822
|
};
|
|
8270
8823
|
}
|
|
8271
8824
|
}
|
|
8272
8825
|
|
|
8273
|
-
class
|
|
8826
|
+
class CreateMediaGallery {
|
|
8274
8827
|
#items = [];
|
|
8275
8828
|
addItems(...items) {
|
|
8276
8829
|
if (!items.length) {
|
|
@@ -8284,13 +8837,13 @@ class MediaGalleryBuilder {
|
|
|
8284
8837
|
}
|
|
8285
8838
|
toJSON() {
|
|
8286
8839
|
return {
|
|
8287
|
-
type:
|
|
8840
|
+
type: ComponentEnum.MediaGallery,
|
|
8288
8841
|
items: structuredClone(this.#items)
|
|
8289
8842
|
};
|
|
8290
8843
|
}
|
|
8291
8844
|
}
|
|
8292
8845
|
|
|
8293
|
-
class
|
|
8846
|
+
class CreateFileComponent {
|
|
8294
8847
|
#url = "";
|
|
8295
8848
|
#spoiler;
|
|
8296
8849
|
setUrl(url) {
|
|
@@ -8306,7 +8859,7 @@ class FileComponentBuilder {
|
|
|
8306
8859
|
if (!this.#url)
|
|
8307
8860
|
throw new Error("File component must have a URL.");
|
|
8308
8861
|
const data = {
|
|
8309
|
-
type:
|
|
8862
|
+
type: ComponentEnum.File,
|
|
8310
8863
|
file: { url: this.#url }
|
|
8311
8864
|
};
|
|
8312
8865
|
if (this.#spoiler !== undefined)
|
|
@@ -8315,7 +8868,7 @@ class FileComponentBuilder {
|
|
|
8315
8868
|
}
|
|
8316
8869
|
}
|
|
8317
8870
|
|
|
8318
|
-
class
|
|
8871
|
+
class CreateSeparator {
|
|
8319
8872
|
#spacing;
|
|
8320
8873
|
#divider;
|
|
8321
8874
|
setSpacing(spacing) {
|
|
@@ -8328,7 +8881,7 @@ class SeparatorBuilder {
|
|
|
8328
8881
|
}
|
|
8329
8882
|
toJSON() {
|
|
8330
8883
|
const data = {
|
|
8331
|
-
type:
|
|
8884
|
+
type: ComponentEnum.Separator
|
|
8332
8885
|
};
|
|
8333
8886
|
if (this.#spacing !== undefined)
|
|
8334
8887
|
data.spacing = this.#spacing;
|
|
@@ -8338,7 +8891,7 @@ class SeparatorBuilder {
|
|
|
8338
8891
|
}
|
|
8339
8892
|
}
|
|
8340
8893
|
|
|
8341
|
-
class
|
|
8894
|
+
class CreateThumbnail {
|
|
8342
8895
|
#url = "";
|
|
8343
8896
|
#description;
|
|
8344
8897
|
#spoiler;
|
|
@@ -8358,7 +8911,7 @@ class ThumbnailBuilder {
|
|
|
8358
8911
|
}
|
|
8359
8912
|
toJSON() {
|
|
8360
8913
|
const data = {
|
|
8361
|
-
type:
|
|
8914
|
+
type: ComponentEnum.Thumbnail,
|
|
8362
8915
|
url: this.#url
|
|
8363
8916
|
};
|
|
8364
8917
|
if (this.#description !== undefined)
|
|
@@ -8369,7 +8922,7 @@ class ThumbnailBuilder {
|
|
|
8369
8922
|
}
|
|
8370
8923
|
}
|
|
8371
8924
|
|
|
8372
|
-
class
|
|
8925
|
+
class CreateContentInventoryEntry {
|
|
8373
8926
|
#id = "";
|
|
8374
8927
|
setId(id) {
|
|
8375
8928
|
validateText(id, 100, "Content inventory entry ID");
|
|
@@ -8378,7 +8931,7 @@ class ContentInventoryEntryBuilder {
|
|
|
8378
8931
|
}
|
|
8379
8932
|
toJSON() {
|
|
8380
8933
|
return {
|
|
8381
|
-
type:
|
|
8934
|
+
type: ComponentEnum.ContentInventoryEntry,
|
|
8382
8935
|
id: this.#id
|
|
8383
8936
|
};
|
|
8384
8937
|
}
|
|
@@ -8399,27 +8952,27 @@ function validateLength(value, field, max = 4000) {
|
|
|
8399
8952
|
if (!Number.isInteger(value) || value < 0 || value > max)
|
|
8400
8953
|
throw new RangeError(`${field} must be an integer between 0 and ${max}.`);
|
|
8401
8954
|
}
|
|
8402
|
-
class
|
|
8955
|
+
class CreateUserSelectMenu extends CreateEntitySelect {
|
|
8403
8956
|
constructor() {
|
|
8404
|
-
super(
|
|
8957
|
+
super(ComponentEnum.UserSelect);
|
|
8405
8958
|
}
|
|
8406
8959
|
}
|
|
8407
8960
|
|
|
8408
|
-
class
|
|
8961
|
+
class CreateRoleSelectMenu extends CreateEntitySelect {
|
|
8409
8962
|
constructor() {
|
|
8410
|
-
super(
|
|
8963
|
+
super(ComponentEnum.RoleSelect);
|
|
8411
8964
|
}
|
|
8412
8965
|
}
|
|
8413
8966
|
|
|
8414
|
-
class
|
|
8967
|
+
class CreateMentionableSelectMenu extends CreateEntitySelect {
|
|
8415
8968
|
constructor() {
|
|
8416
|
-
super(
|
|
8969
|
+
super(ComponentEnum.MentionableSelect);
|
|
8417
8970
|
}
|
|
8418
8971
|
}
|
|
8419
8972
|
|
|
8420
|
-
class
|
|
8973
|
+
class CreateChannelSelectMenu extends CreateEntitySelect {
|
|
8421
8974
|
constructor() {
|
|
8422
|
-
super(
|
|
8975
|
+
super(ComponentEnum.ChannelSelect);
|
|
8423
8976
|
}
|
|
8424
8977
|
}
|
|
8425
8978
|
function assertSelect(data) {
|
|
@@ -8428,8 +8981,41 @@ function assertSelect(data) {
|
|
|
8428
8981
|
if ((data.min_values ?? 1) > (data.max_values ?? 1))
|
|
8429
8982
|
throw new RangeError("min_values cannot exceed max_values.");
|
|
8430
8983
|
}
|
|
8984
|
+
var IS_COMPONENTS_V2 = 1 << 15;
|
|
8985
|
+
function componentsV2Message(components, options) {
|
|
8986
|
+
const list = Array.isArray(components) ? components : [components];
|
|
8987
|
+
if (!list.length)
|
|
8988
|
+
throw new TypeError("A Components V2 message needs at least one component.");
|
|
8989
|
+
return {
|
|
8990
|
+
...options ?? {},
|
|
8991
|
+
components: list.map((component) => component.toJSON()),
|
|
8992
|
+
flags: (options?.flags ?? 0) | IS_COMPONENTS_V2
|
|
8993
|
+
};
|
|
8994
|
+
}
|
|
8995
|
+
var ButtonBuilder = CreateButton;
|
|
8996
|
+
var ChannelSelectMenuBuilder = CreateChannelSelectMenu;
|
|
8997
|
+
var ContainerBuilder = CreateContainer;
|
|
8998
|
+
var ContentInventoryEntryBuilder = CreateContentInventoryEntry;
|
|
8999
|
+
var EntitySelectBuilder = CreateEntitySelect;
|
|
9000
|
+
var FileComponentBuilder = CreateFileComponent;
|
|
9001
|
+
var MediaGalleryBuilder = CreateMediaGallery;
|
|
9002
|
+
var MentionableSelectMenuBuilder = CreateMentionableSelectMenu;
|
|
9003
|
+
var ModalBuilder = CreateModal;
|
|
9004
|
+
var RoleSelectMenuBuilder = CreateRoleSelectMenu;
|
|
9005
|
+
var SectionBuilder = CreateSection;
|
|
9006
|
+
var SeparatorBuilder = CreateSeparator;
|
|
9007
|
+
var StringSelectBuilder = CreateStringSelect;
|
|
9008
|
+
var StringSelectMenuBuilder = CreateStringSelect;
|
|
9009
|
+
var TextDisplayBuilder = CreateTextDisplay;
|
|
9010
|
+
var TextInputBuilder = CreateTextInput;
|
|
9011
|
+
var ThumbnailBuilder = CreateThumbnail;
|
|
9012
|
+
var UserSelectMenuBuilder = CreateUserSelectMenu;
|
|
9013
|
+
var ActionRowBuilder = CreateActionRow;
|
|
9014
|
+
var ButtonStyle = ButtonType;
|
|
9015
|
+
var TextInputStyle = TextInputType;
|
|
9016
|
+
var ComponentType = ComponentEnum;
|
|
8431
9017
|
// packages/builders/src/commands.ts
|
|
8432
|
-
var
|
|
9018
|
+
var ApplicationCommandOptionEnum2 = {
|
|
8433
9019
|
Subcommand: 1,
|
|
8434
9020
|
SubcommandGroup: 2,
|
|
8435
9021
|
String: 3,
|
|
@@ -8443,7 +9029,7 @@ var ApplicationCommandOptionType2 = {
|
|
|
8443
9029
|
Attachment: 11
|
|
8444
9030
|
};
|
|
8445
9031
|
|
|
8446
|
-
class
|
|
9032
|
+
class CreateSlashCommand {
|
|
8447
9033
|
#data = { type: 1 };
|
|
8448
9034
|
setName(name) {
|
|
8449
9035
|
validateName(name, "Command name");
|
|
@@ -8475,37 +9061,37 @@ class SlashCommandBuilder {
|
|
|
8475
9061
|
return this;
|
|
8476
9062
|
}
|
|
8477
9063
|
addStringOption(configure) {
|
|
8478
|
-
return this.addOption(configure(new
|
|
9064
|
+
return this.addOption(configure(new CreateStringOption));
|
|
8479
9065
|
}
|
|
8480
9066
|
addIntegerOption(configure) {
|
|
8481
|
-
return this.addOption(configure(new
|
|
9067
|
+
return this.addOption(configure(new CreateIntegerOption));
|
|
8482
9068
|
}
|
|
8483
9069
|
addNumberOption(configure) {
|
|
8484
|
-
return this.addOption(configure(new
|
|
9070
|
+
return this.addOption(configure(new CreateNumberOption));
|
|
8485
9071
|
}
|
|
8486
9072
|
addBooleanOption(configure) {
|
|
8487
|
-
return this.addOption(configure(new
|
|
9073
|
+
return this.addOption(configure(new CreateBooleanOption));
|
|
8488
9074
|
}
|
|
8489
9075
|
addUserOption(configure) {
|
|
8490
|
-
return this.addOption(configure(new
|
|
9076
|
+
return this.addOption(configure(new CreateUserOption));
|
|
8491
9077
|
}
|
|
8492
9078
|
addChannelOption(configure) {
|
|
8493
|
-
return this.addOption(configure(new
|
|
9079
|
+
return this.addOption(configure(new CreateChannelOption));
|
|
8494
9080
|
}
|
|
8495
9081
|
addRoleOption(configure) {
|
|
8496
|
-
return this.addOption(configure(new
|
|
9082
|
+
return this.addOption(configure(new CreateRoleOption));
|
|
8497
9083
|
}
|
|
8498
9084
|
addMentionableOption(configure) {
|
|
8499
|
-
return this.addOption(configure(new
|
|
9085
|
+
return this.addOption(configure(new CreateMentionableOption));
|
|
8500
9086
|
}
|
|
8501
9087
|
addAttachmentOption(configure) {
|
|
8502
|
-
return this.addOption(configure(new
|
|
9088
|
+
return this.addOption(configure(new CreateAttachmentOption));
|
|
8503
9089
|
}
|
|
8504
9090
|
addSubcommand(configure) {
|
|
8505
|
-
return this.addOption(configure(new
|
|
9091
|
+
return this.addOption(configure(new CreateSubcommand));
|
|
8506
9092
|
}
|
|
8507
9093
|
addSubcommandGroup(configure) {
|
|
8508
|
-
return this.addOption(configure(new
|
|
9094
|
+
return this.addOption(configure(new CreateSubcommandGroup));
|
|
8509
9095
|
}
|
|
8510
9096
|
toJSON() {
|
|
8511
9097
|
return structuredClone(this.#data);
|
|
@@ -8525,7 +9111,7 @@ class SlashCommandBuilder {
|
|
|
8525
9111
|
}
|
|
8526
9112
|
}
|
|
8527
9113
|
|
|
8528
|
-
class
|
|
9114
|
+
class CreateCommandOption {
|
|
8529
9115
|
data;
|
|
8530
9116
|
constructor(type) {
|
|
8531
9117
|
this.data = { type };
|
|
@@ -8553,9 +9139,9 @@ class CommandOptionBuilder {
|
|
|
8553
9139
|
}
|
|
8554
9140
|
}
|
|
8555
9141
|
|
|
8556
|
-
class
|
|
9142
|
+
class CreateStringOption extends CreateCommandOption {
|
|
8557
9143
|
constructor() {
|
|
8558
|
-
super(
|
|
9144
|
+
super(ApplicationCommandOptionEnum2.String);
|
|
8559
9145
|
}
|
|
8560
9146
|
addChoices(...choices) {
|
|
8561
9147
|
const current = this.data.choices ?? [];
|
|
@@ -8589,9 +9175,9 @@ class StringOptionBuilder extends CommandOptionBuilder {
|
|
|
8589
9175
|
}
|
|
8590
9176
|
}
|
|
8591
9177
|
|
|
8592
|
-
class
|
|
9178
|
+
class CreateIntegerOption extends CreateCommandOption {
|
|
8593
9179
|
constructor() {
|
|
8594
|
-
super(
|
|
9180
|
+
super(ApplicationCommandOptionEnum2.Integer);
|
|
8595
9181
|
}
|
|
8596
9182
|
setMinValue(value) {
|
|
8597
9183
|
validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", true);
|
|
@@ -8624,9 +9210,9 @@ class IntegerOptionBuilder extends CommandOptionBuilder {
|
|
|
8624
9210
|
}
|
|
8625
9211
|
}
|
|
8626
9212
|
|
|
8627
|
-
class
|
|
9213
|
+
class CreateNumberOption extends CreateCommandOption {
|
|
8628
9214
|
constructor() {
|
|
8629
|
-
super(
|
|
9215
|
+
super(ApplicationCommandOptionEnum2.Number);
|
|
8630
9216
|
}
|
|
8631
9217
|
setMinValue(value) {
|
|
8632
9218
|
validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", false);
|
|
@@ -8659,39 +9245,39 @@ class NumberOptionBuilder extends CommandOptionBuilder {
|
|
|
8659
9245
|
}
|
|
8660
9246
|
}
|
|
8661
9247
|
|
|
8662
|
-
class
|
|
9248
|
+
class CreateBooleanOption extends CreateCommandOption {
|
|
8663
9249
|
constructor() {
|
|
8664
|
-
super(
|
|
9250
|
+
super(ApplicationCommandOptionEnum2.Boolean);
|
|
8665
9251
|
}
|
|
8666
9252
|
}
|
|
8667
9253
|
|
|
8668
|
-
class
|
|
9254
|
+
class CreateUserOption extends CreateCommandOption {
|
|
8669
9255
|
constructor() {
|
|
8670
|
-
super(
|
|
9256
|
+
super(ApplicationCommandOptionEnum2.User);
|
|
8671
9257
|
}
|
|
8672
9258
|
}
|
|
8673
9259
|
|
|
8674
|
-
class
|
|
9260
|
+
class CreateRoleOption extends CreateCommandOption {
|
|
8675
9261
|
constructor() {
|
|
8676
|
-
super(
|
|
9262
|
+
super(ApplicationCommandOptionEnum2.Role);
|
|
8677
9263
|
}
|
|
8678
9264
|
}
|
|
8679
9265
|
|
|
8680
|
-
class
|
|
9266
|
+
class CreateMentionableOption extends CreateCommandOption {
|
|
8681
9267
|
constructor() {
|
|
8682
|
-
super(
|
|
9268
|
+
super(ApplicationCommandOptionEnum2.Mentionable);
|
|
8683
9269
|
}
|
|
8684
9270
|
}
|
|
8685
9271
|
|
|
8686
|
-
class
|
|
9272
|
+
class CreateAttachmentOption extends CreateCommandOption {
|
|
8687
9273
|
constructor() {
|
|
8688
|
-
super(
|
|
9274
|
+
super(ApplicationCommandOptionEnum2.Attachment);
|
|
8689
9275
|
}
|
|
8690
9276
|
}
|
|
8691
9277
|
|
|
8692
|
-
class
|
|
9278
|
+
class CreateChannelOption extends CreateCommandOption {
|
|
8693
9279
|
constructor() {
|
|
8694
|
-
super(
|
|
9280
|
+
super(ApplicationCommandOptionEnum2.Channel);
|
|
8695
9281
|
}
|
|
8696
9282
|
addChannelTypes(...types) {
|
|
8697
9283
|
if (types.some((type) => !Number.isInteger(type) || type < 0))
|
|
@@ -8701,36 +9287,36 @@ class ChannelOptionBuilder extends CommandOptionBuilder {
|
|
|
8701
9287
|
}
|
|
8702
9288
|
}
|
|
8703
9289
|
|
|
8704
|
-
class
|
|
9290
|
+
class CreateSubcommand extends CreateCommandOption {
|
|
8705
9291
|
constructor() {
|
|
8706
|
-
super(
|
|
9292
|
+
super(ApplicationCommandOptionEnum2.Subcommand);
|
|
8707
9293
|
}
|
|
8708
9294
|
addStringOption(configure) {
|
|
8709
|
-
return this.addChildOption(configure(new
|
|
9295
|
+
return this.addChildOption(configure(new CreateStringOption));
|
|
8710
9296
|
}
|
|
8711
9297
|
addIntegerOption(configure) {
|
|
8712
|
-
return this.addChildOption(configure(new
|
|
9298
|
+
return this.addChildOption(configure(new CreateIntegerOption));
|
|
8713
9299
|
}
|
|
8714
9300
|
addNumberOption(configure) {
|
|
8715
|
-
return this.addChildOption(configure(new
|
|
9301
|
+
return this.addChildOption(configure(new CreateNumberOption));
|
|
8716
9302
|
}
|
|
8717
9303
|
addBooleanOption(configure) {
|
|
8718
|
-
return this.addChildOption(configure(new
|
|
9304
|
+
return this.addChildOption(configure(new CreateBooleanOption));
|
|
8719
9305
|
}
|
|
8720
9306
|
addUserOption(configure) {
|
|
8721
|
-
return this.addChildOption(configure(new
|
|
9307
|
+
return this.addChildOption(configure(new CreateUserOption));
|
|
8722
9308
|
}
|
|
8723
9309
|
addChannelOption(configure) {
|
|
8724
|
-
return this.addChildOption(configure(new
|
|
9310
|
+
return this.addChildOption(configure(new CreateChannelOption));
|
|
8725
9311
|
}
|
|
8726
9312
|
addRoleOption(configure) {
|
|
8727
|
-
return this.addChildOption(configure(new
|
|
9313
|
+
return this.addChildOption(configure(new CreateRoleOption));
|
|
8728
9314
|
}
|
|
8729
9315
|
addMentionableOption(configure) {
|
|
8730
|
-
return this.addChildOption(configure(new
|
|
9316
|
+
return this.addChildOption(configure(new CreateMentionableOption));
|
|
8731
9317
|
}
|
|
8732
9318
|
addAttachmentOption(configure) {
|
|
8733
|
-
return this.addChildOption(configure(new
|
|
9319
|
+
return this.addChildOption(configure(new CreateAttachmentOption));
|
|
8734
9320
|
}
|
|
8735
9321
|
addChildOption(option) {
|
|
8736
9322
|
const options = this.data.options ?? [];
|
|
@@ -8741,7 +9327,7 @@ class SubcommandBuilder extends CommandOptionBuilder {
|
|
|
8741
9327
|
throw new RangeError(`Duplicate option name: ${String(payload.name)}.`);
|
|
8742
9328
|
if (payload.required === true && options.some((existing) => existing.required !== true))
|
|
8743
9329
|
throw new RangeError("Required subcommand options must be placed before optional options.");
|
|
8744
|
-
if (options.some((existing) => existing.type ===
|
|
9330
|
+
if (options.some((existing) => existing.type === ApplicationCommandOptionEnum2.Subcommand))
|
|
8745
9331
|
throw new RangeError("Subcommands cannot contain nested subcommands.");
|
|
8746
9332
|
options.push(payload);
|
|
8747
9333
|
this.data.options = options;
|
|
@@ -8749,18 +9335,18 @@ class SubcommandBuilder extends CommandOptionBuilder {
|
|
|
8749
9335
|
}
|
|
8750
9336
|
}
|
|
8751
9337
|
|
|
8752
|
-
class
|
|
9338
|
+
class CreateSubcommandGroup extends CreateCommandOption {
|
|
8753
9339
|
constructor() {
|
|
8754
|
-
super(
|
|
9340
|
+
super(ApplicationCommandOptionEnum2.SubcommandGroup);
|
|
8755
9341
|
}
|
|
8756
9342
|
addSubcommand(configure) {
|
|
8757
9343
|
const options = this.data.options ?? [];
|
|
8758
9344
|
if (options.length >= 25)
|
|
8759
9345
|
throw new RangeError("A subcommand group cannot contain more than 25 subcommands.");
|
|
8760
|
-
const payload = configure(new
|
|
9346
|
+
const payload = configure(new CreateSubcommand).toJSON();
|
|
8761
9347
|
if (options.some((existing) => existing.name === payload.name))
|
|
8762
9348
|
throw new RangeError(`Duplicate subcommand name: ${String(payload.name)}.`);
|
|
8763
|
-
if (payload.type !==
|
|
9349
|
+
if (payload.type !== ApplicationCommandOptionEnum2.Subcommand)
|
|
8764
9350
|
throw new TypeError("Subcommand group children must be subcommands.");
|
|
8765
9351
|
options.push(payload);
|
|
8766
9352
|
this.data.options = options;
|
|
@@ -8784,7 +9370,7 @@ function validateNumberRange(value, minimum, maximum, field, integerOnly = true)
|
|
|
8784
9370
|
throw new RangeError(`${field} must be ${integerOnly ? "an integer" : "a number"} between ${minimum} and ${maximum}.`);
|
|
8785
9371
|
}
|
|
8786
9372
|
|
|
8787
|
-
class
|
|
9373
|
+
class CreateContextMenuCommand {
|
|
8788
9374
|
data;
|
|
8789
9375
|
constructor(type = 2) {
|
|
8790
9376
|
this.data = { type };
|
|
@@ -8813,27 +9399,53 @@ class ContextMenuCommandBuilder {
|
|
|
8813
9399
|
this.data.integration_types = [...types];
|
|
8814
9400
|
return this;
|
|
8815
9401
|
}
|
|
9402
|
+
setContexts(...contexts) {
|
|
9403
|
+
if (contexts.some((context) => context !== 0 && context !== 1 && context !== 2))
|
|
9404
|
+
throw new RangeError("Command contexts must be 0, 1 or 2.");
|
|
9405
|
+
this.data.contexts = [...contexts];
|
|
9406
|
+
return this;
|
|
9407
|
+
}
|
|
9408
|
+
setNameLocalizations(localizations) {
|
|
9409
|
+
this.data.name_localizations = localizations === null ? null : { ...localizations };
|
|
9410
|
+
return this;
|
|
9411
|
+
}
|
|
8816
9412
|
toJSON() {
|
|
8817
9413
|
return structuredClone(this.data);
|
|
8818
9414
|
}
|
|
8819
9415
|
}
|
|
8820
9416
|
|
|
8821
|
-
class
|
|
9417
|
+
class CreateUserCommand extends CreateContextMenuCommand {
|
|
8822
9418
|
constructor() {
|
|
8823
9419
|
super(2);
|
|
8824
9420
|
}
|
|
8825
9421
|
}
|
|
8826
9422
|
|
|
8827
|
-
class
|
|
9423
|
+
class CreateMessageCommand extends CreateContextMenuCommand {
|
|
8828
9424
|
constructor() {
|
|
8829
9425
|
super(3);
|
|
8830
9426
|
}
|
|
8831
9427
|
}
|
|
9428
|
+
var AttachmentOptionBuilder = CreateAttachmentOption;
|
|
9429
|
+
var BooleanOptionBuilder = CreateBooleanOption;
|
|
9430
|
+
var ChannelOptionBuilder = CreateChannelOption;
|
|
9431
|
+
var CommandOptionBuilder = CreateCommandOption;
|
|
9432
|
+
var ContextMenuCommandBuilder = CreateContextMenuCommand;
|
|
9433
|
+
var IntegerOptionBuilder = CreateIntegerOption;
|
|
9434
|
+
var MentionableOptionBuilder = CreateMentionableOption;
|
|
9435
|
+
var MessageCommandBuilder = CreateMessageCommand;
|
|
9436
|
+
var NumberOptionBuilder = CreateNumberOption;
|
|
9437
|
+
var RoleOptionBuilder = CreateRoleOption;
|
|
9438
|
+
var SlashCommandBuilder = CreateSlashCommand;
|
|
9439
|
+
var StringOptionBuilder = CreateStringOption;
|
|
9440
|
+
var SubcommandBuilder = CreateSubcommand;
|
|
9441
|
+
var SubcommandGroupBuilder = CreateSubcommandGroup;
|
|
9442
|
+
var UserCommandBuilder = CreateUserCommand;
|
|
9443
|
+
var UserOptionBuilder = CreateUserOption;
|
|
8832
9444
|
// packages/builders/src/attachment.ts
|
|
8833
9445
|
import { readFile } from "fs/promises";
|
|
8834
9446
|
import { basename } from "path";
|
|
8835
9447
|
|
|
8836
|
-
class
|
|
9448
|
+
class CreateAttachment {
|
|
8837
9449
|
name;
|
|
8838
9450
|
description;
|
|
8839
9451
|
file;
|
|
@@ -8877,9 +9489,13 @@ class AttachmentBuilder {
|
|
|
8877
9489
|
throw new TypeError("Attachment file must be a supported binary value or file path.");
|
|
8878
9490
|
}
|
|
8879
9491
|
}
|
|
9492
|
+
var AttachmentBuilder = CreateAttachment;
|
|
8880
9493
|
export {
|
|
8881
9494
|
ActionRowBuilder,
|
|
9495
|
+
ActivityEnum,
|
|
9496
|
+
ApplicationCommandEnum,
|
|
8882
9497
|
ApplicationCommandManager,
|
|
9498
|
+
ApplicationCommandOptionEnum,
|
|
8883
9499
|
ApplicationCommandOptionType,
|
|
8884
9500
|
ApplicationCommandType,
|
|
8885
9501
|
AttachmentBuilder,
|
|
@@ -8895,10 +9511,13 @@ export {
|
|
|
8895
9511
|
BooleanOptionBuilder,
|
|
8896
9512
|
ButtonBuilder,
|
|
8897
9513
|
ButtonStyle,
|
|
9514
|
+
ButtonType,
|
|
9515
|
+
CDN_BASE,
|
|
8898
9516
|
Cache,
|
|
8899
9517
|
ResourceManager as CachedManager,
|
|
8900
9518
|
CategoryChannel,
|
|
8901
9519
|
Channel,
|
|
9520
|
+
ChannelEnum,
|
|
8902
9521
|
ChannelManager,
|
|
8903
9522
|
ChannelOptionBuilder,
|
|
8904
9523
|
ChannelSelectMenuBuilder,
|
|
@@ -8909,12 +9528,51 @@ export {
|
|
|
8909
9528
|
Collection,
|
|
8910
9529
|
Collector,
|
|
8911
9530
|
CommandInteraction,
|
|
9531
|
+
CommandOptionBuilder,
|
|
8912
9532
|
CommandOptions,
|
|
9533
|
+
ComponentEnum,
|
|
8913
9534
|
ComponentInteraction,
|
|
8914
9535
|
ComponentType,
|
|
8915
9536
|
ContainerBuilder,
|
|
8916
9537
|
ContentInventoryEntryBuilder,
|
|
8917
9538
|
ContextMenuCommandBuilder,
|
|
9539
|
+
ContextMenuCommandInteraction,
|
|
9540
|
+
CreateActionRow,
|
|
9541
|
+
CreateAttachment,
|
|
9542
|
+
CreateAttachmentOption,
|
|
9543
|
+
CreateBooleanOption,
|
|
9544
|
+
CreateButton,
|
|
9545
|
+
CreateChannelOption,
|
|
9546
|
+
CreateChannelSelectMenu,
|
|
9547
|
+
CreateContainer,
|
|
9548
|
+
CreateContentInventoryEntry,
|
|
9549
|
+
CreateContextMenuCommand,
|
|
9550
|
+
CreateEmbed,
|
|
9551
|
+
CreateEntitySelect,
|
|
9552
|
+
CreateFileComponent,
|
|
9553
|
+
CreateIntegerOption,
|
|
9554
|
+
CreateMediaGallery,
|
|
9555
|
+
CreateMentionableOption,
|
|
9556
|
+
CreateMentionableSelectMenu,
|
|
9557
|
+
CreateMessageCommand,
|
|
9558
|
+
CreateModal,
|
|
9559
|
+
CreateNumberOption,
|
|
9560
|
+
CreateRoleOption,
|
|
9561
|
+
CreateRoleSelectMenu,
|
|
9562
|
+
CreateSection,
|
|
9563
|
+
CreateSeparator,
|
|
9564
|
+
CreateSlashCommand,
|
|
9565
|
+
CreateStringOption,
|
|
9566
|
+
CreateStringSelect,
|
|
9567
|
+
CreateStringSelect as CreateStringSelectMenu,
|
|
9568
|
+
CreateSubcommand,
|
|
9569
|
+
CreateSubcommandGroup,
|
|
9570
|
+
CreateTextDisplay,
|
|
9571
|
+
CreateTextInput,
|
|
9572
|
+
CreateThumbnail,
|
|
9573
|
+
CreateUserCommand,
|
|
9574
|
+
CreateUserOption,
|
|
9575
|
+
CreateUserSelectMenu,
|
|
8918
9576
|
DMChannel,
|
|
8919
9577
|
RESTError as DiscordAPIError,
|
|
8920
9578
|
Embed,
|
|
@@ -8953,7 +9611,9 @@ export {
|
|
|
8953
9611
|
Intents,
|
|
8954
9612
|
IntentsBitField,
|
|
8955
9613
|
Interaction,
|
|
9614
|
+
InteractionEnum,
|
|
8956
9615
|
InteractionResponse,
|
|
9616
|
+
InteractionResponseEnum,
|
|
8957
9617
|
InteractionResponseType,
|
|
8958
9618
|
InteractionType,
|
|
8959
9619
|
Invite,
|
|
@@ -8976,6 +9636,7 @@ export {
|
|
|
8976
9636
|
OnboardingPromptOption,
|
|
8977
9637
|
Permission,
|
|
8978
9638
|
PermissionFlagsBits,
|
|
9639
|
+
PermissionOverwriteEnum,
|
|
8979
9640
|
PermissionOverwriteManager,
|
|
8980
9641
|
PermissionOverwriteType,
|
|
8981
9642
|
PermissionSet,
|
|
@@ -9005,17 +9666,20 @@ export {
|
|
|
9005
9666
|
StageChannel,
|
|
9006
9667
|
StageInstanceManager,
|
|
9007
9668
|
GatewayState as Status,
|
|
9669
|
+
StickerEnum,
|
|
9670
|
+
StickerFormatEnum,
|
|
9008
9671
|
StickerFormatType,
|
|
9009
9672
|
StickerType,
|
|
9010
9673
|
StringOptionBuilder,
|
|
9011
9674
|
StringSelectBuilder,
|
|
9012
|
-
|
|
9675
|
+
StringSelectMenuBuilder,
|
|
9013
9676
|
SubcommandBuilder,
|
|
9014
9677
|
SubcommandGroupBuilder,
|
|
9015
9678
|
TextChannel,
|
|
9016
9679
|
TextDisplayBuilder,
|
|
9017
9680
|
TextInputBuilder,
|
|
9018
9681
|
TextInputStyle,
|
|
9682
|
+
TextInputType,
|
|
9019
9683
|
ThreadChannel,
|
|
9020
9684
|
ThreadManager,
|
|
9021
9685
|
ThumbnailBuilder,
|
|
@@ -9035,18 +9699,22 @@ export {
|
|
|
9035
9699
|
WebSocketTransport,
|
|
9036
9700
|
Webhook,
|
|
9037
9701
|
WebhookClient,
|
|
9702
|
+
WebhookEnum,
|
|
9038
9703
|
WebhookType,
|
|
9039
9704
|
WelcomeScreenChannel,
|
|
9040
9705
|
ZlibStreamDecoder,
|
|
9041
9706
|
abortError,
|
|
9707
|
+
argsFromCommandOptions,
|
|
9042
9708
|
blockQuote,
|
|
9043
9709
|
bold,
|
|
9044
9710
|
bulletList,
|
|
9711
|
+
cdnURL,
|
|
9045
9712
|
channelMention,
|
|
9046
9713
|
classifyCloseCode,
|
|
9047
9714
|
classifyFrame,
|
|
9048
9715
|
classifyPayload,
|
|
9049
9716
|
codeBlock,
|
|
9717
|
+
componentsV2Message,
|
|
9050
9718
|
computePermissions,
|
|
9051
9719
|
createAudioPlayer,
|
|
9052
9720
|
createAudioResource,
|
|
@@ -9070,6 +9738,11 @@ export {
|
|
|
9070
9738
|
masked,
|
|
9071
9739
|
normalizeRoutePath,
|
|
9072
9740
|
orderedList,
|
|
9741
|
+
parseChannelMention,
|
|
9742
|
+
parseMentionable,
|
|
9743
|
+
parsePrefixArgs,
|
|
9744
|
+
parseRoleMention,
|
|
9745
|
+
parseUserMention,
|
|
9073
9746
|
randomInt,
|
|
9074
9747
|
redactPath,
|
|
9075
9748
|
resolveGatewayIntents,
|
|
@@ -9082,8 +9755,10 @@ export {
|
|
|
9082
9755
|
strikethrough,
|
|
9083
9756
|
subtext,
|
|
9084
9757
|
timestamp,
|
|
9758
|
+
toRequest,
|
|
9759
|
+
tokenizeArgs,
|
|
9085
9760
|
underline,
|
|
9086
9761
|
userMention
|
|
9087
9762
|
};
|
|
9088
9763
|
|
|
9089
|
-
//# debugId=
|
|
9764
|
+
//# debugId=FC58C0F70BD3B2A964756E2164756E21
|