lunibee 0.3.3 → 0.4.0

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.
Files changed (125) hide show
  1. package/README.md +1 -1
  2. package/dist/builders/commands.d.ts +1 -1
  3. package/dist/builders/components.d.ts +9 -11
  4. package/dist/builders/embed.d.ts +1 -1
  5. package/dist/builders/index.d.ts +1 -1
  6. package/dist/builders/index.js +87 -1298
  7. package/dist/builders/index.js.map +3 -11
  8. package/dist/chunks/index-0wn81eng.js +2492 -0
  9. package/dist/chunks/index-0wn81eng.js.map +17 -0
  10. package/dist/chunks/index-2en489j6.js +40 -0
  11. package/dist/chunks/index-2en489j6.js.map +10 -0
  12. package/dist/chunks/index-3hyps48a.js +203 -0
  13. package/dist/chunks/index-3hyps48a.js.map +11 -0
  14. package/dist/chunks/index-57c5n3ms.js +2274 -0
  15. package/dist/chunks/index-57c5n3ms.js.map +19 -0
  16. package/dist/chunks/index-5yx92e36.js +1170 -0
  17. package/dist/chunks/index-5yx92e36.js.map +14 -0
  18. package/dist/chunks/index-690bp093.js +95 -0
  19. package/dist/chunks/index-690bp093.js.map +10 -0
  20. package/dist/chunks/index-7fp2hvmg.js +2155 -0
  21. package/dist/chunks/index-7fp2hvmg.js.map +24 -0
  22. package/dist/chunks/index-cnmsajvk.js +1119 -0
  23. package/dist/chunks/index-cnmsajvk.js.map +12 -0
  24. package/dist/chunks/index-fdvgk2sw.js +1310 -0
  25. package/dist/chunks/index-fdvgk2sw.js.map +21 -0
  26. package/dist/chunks/index-gyvps8b9.js +214 -0
  27. package/dist/chunks/index-gyvps8b9.js.map +12 -0
  28. package/dist/chunks/index-jzg4bh99.js +1533 -0
  29. package/dist/chunks/index-jzg4bh99.js.map +21 -0
  30. package/dist/chunks/index-mgw2yvrm.js +3547 -0
  31. package/dist/chunks/index-mgw2yvrm.js.map +25 -0
  32. package/dist/chunks/index-yh76b55h.js +3449 -0
  33. package/dist/chunks/index-yh76b55h.js.map +29 -0
  34. package/dist/collection/index.js +9 -1118
  35. package/dist/collection/index.js.map +3 -6
  36. package/dist/core/api.d.ts +3 -3
  37. package/dist/core/channel-create.d.ts +2 -2
  38. package/dist/core/commands.d.ts +3 -3
  39. package/dist/core/events.d.ts +4 -4
  40. package/dist/core/handles.d.ts +4 -4
  41. package/dist/core/index.d.ts +25 -20
  42. package/dist/core/index.js +68 -10130
  43. package/dist/core/index.js.map +3 -65
  44. package/dist/core/permissions.d.ts +1 -1
  45. package/dist/core/redis-cache.d.ts +1 -1
  46. package/dist/formatters/index.js +41 -110
  47. package/dist/formatters/index.js.map +3 -4
  48. package/dist/handlers/index.js +5 -37
  49. package/dist/handlers/index.js.map +3 -4
  50. package/dist/index.d.ts +21 -21
  51. package/dist/index.js +641 -16325
  52. package/dist/index.js.map +3 -92
  53. package/dist/managers/advanced.d.ts +3 -3
  54. package/dist/managers/application.d.ts +2 -2
  55. package/dist/managers/base.d.ts +1 -1
  56. package/dist/managers/emoji.d.ts +2 -2
  57. package/dist/managers/guild-resources.d.ts +6 -6
  58. package/dist/managers/guild.d.ts +3 -3
  59. package/dist/managers/index.d.ts +4 -8
  60. package/dist/managers/index.js +51 -4060
  61. package/dist/managers/index.js.map +3 -29
  62. package/dist/managers/member.d.ts +2 -2
  63. package/dist/managers/message.d.ts +14 -6
  64. package/dist/managers/role.d.ts +2 -2
  65. package/dist/managers/thread.d.ts +3 -3
  66. package/dist/managers/user.d.ts +7 -4
  67. package/dist/rest/index.d.ts +10 -35
  68. package/dist/rest/index.js +57 -2184
  69. package/dist/rest/index.js.map +3 -18
  70. package/dist/rest/limiter.d.ts +9 -1
  71. package/dist/rest/webhook.d.ts +2 -8
  72. package/dist/sharding/bus.d.ts +2 -2
  73. package/dist/sharding/cluster.d.ts +45 -5
  74. package/dist/sharding/context.d.ts +45 -3
  75. package/dist/sharding/gateway-bot.d.ts +2 -1
  76. package/dist/sharding/health.d.ts +1 -1
  77. package/dist/sharding/identify.d.ts +12 -0
  78. package/dist/sharding/index.d.ts +44 -11
  79. package/dist/sharding/index.js +60 -4620
  80. package/dist/sharding/index.js.map +3 -33
  81. package/dist/sharding/supervisor.d.ts +4 -2
  82. package/dist/structures/audit-log.d.ts +1 -1
  83. package/dist/structures/base.d.ts +6 -6
  84. package/dist/structures/channels.d.ts +1 -1
  85. package/dist/structures/embed.d.ts +1 -1
  86. package/dist/structures/index.d.ts +14 -14
  87. package/dist/structures/index.js +109 -2382
  88. package/dist/structures/index.js.map +3 -16
  89. package/dist/structures/interactions.d.ts +13 -9
  90. package/dist/structures/options.d.ts +1 -1
  91. package/dist/structures/permissions.d.ts +2 -2
  92. package/dist/structures/resources.d.ts +10 -10
  93. package/dist/structures/sticker.d.ts +1 -1
  94. package/dist/types/gateway.d.ts +2 -79
  95. package/dist/types/index.d.ts +0 -6
  96. package/dist/types/index.js +41 -272
  97. package/dist/types/index.js.map +3 -6
  98. package/dist/utils/index.js +23 -209
  99. package/dist/utils/index.js.map +3 -5
  100. package/dist/voice/connection.d.ts +200 -0
  101. package/dist/voice/crypto.d.ts +50 -0
  102. package/dist/voice/dave.d.ts +85 -0
  103. package/dist/voice/effects.d.ts +31 -0
  104. package/dist/voice/emitter.d.ts +14 -0
  105. package/dist/voice/gateway.d.ts +59 -0
  106. package/dist/voice/index.d.ts +25 -228
  107. package/dist/voice/index.js +111 -442
  108. package/dist/voice/index.js.map +3 -4
  109. package/dist/voice/libopus.d.ts +88 -0
  110. package/dist/voice/networking.d.ts +80 -0
  111. package/dist/voice/ogg.d.ts +24 -0
  112. package/dist/voice/opus.d.ts +18 -0
  113. package/dist/voice/player.d.ts +79 -0
  114. package/dist/voice/protocol.d.ts +76 -0
  115. package/dist/voice/receiver.d.ts +59 -0
  116. package/dist/voice/resource.d.ts +102 -0
  117. package/dist/voice/udp.d.ts +40 -0
  118. package/dist/ws/close-codes.d.ts +1 -1
  119. package/dist/ws/index.d.ts +25 -4
  120. package/dist/ws/index.js +47 -1336
  121. package/dist/ws/index.js.map +3 -17
  122. package/dist/ws/protocol.d.ts +1 -1
  123. package/dist/ws/send-budget.d.ts +0 -2
  124. package/dist/ws/state.d.ts +0 -10
  125. package/package.json +19 -16
@@ -1,2386 +1,113 @@
1
1
  // @bun
2
- // packages/types/src/channel-kind.ts
3
- var ChannelKinds = {
4
- text: [0],
5
- dm: [1],
6
- voice: [2],
7
- "group-dm": [3],
8
- category: [4],
9
- announcement: [5],
10
- thread: [10, 11, 12],
11
- stage: [13],
12
- directory: [14],
13
- forum: [15],
14
- media: [16]
15
- };
16
- var KIND_OF_TYPE = new Map(Object.keys(ChannelKinds).flatMap((kind) => ChannelKinds[kind].map((type) => [type, kind])));
17
- function channelKindOf(type) {
18
- return KIND_OF_TYPE.get(type) ?? "unknown";
19
- }
20
- // packages/types/src/gateway.ts
21
- var GatewayIntentBits = {
22
- Guilds: 1 << 0,
23
- GuildMembers: 1 << 1,
24
- GuildModeration: 1 << 2,
25
- GuildExpressions: 1 << 3,
26
- GuildIntegrations: 1 << 4,
27
- GuildWebhooks: 1 << 5,
28
- GuildInvites: 1 << 6,
29
- GuildVoiceStates: 1 << 7,
30
- GuildPresences: 1 << 8,
31
- GuildMessages: 1 << 9,
32
- GuildMessageReactions: 1 << 10,
33
- GuildMessageTyping: 1 << 11,
34
- DirectMessages: 1 << 12,
35
- DirectMessageReactions: 1 << 13,
36
- DirectMessageTyping: 1 << 14,
37
- MessageContent: 1 << 15,
38
- GuildScheduledEvents: 1 << 16,
39
- AutoModerationConfiguration: 1 << 20,
40
- AutoModerationExecution: 1 << 21,
41
- GuildMessagePolls: 1 << 24,
42
- DirectMessagePolls: 1 << 25
43
- };
44
- var IntentBits = {
45
- guild: 1 << 0,
46
- guilds: 1 << 0,
47
- guildMembers: 1 << 1,
48
- guildModeration: 1 << 2,
49
- guildBans: 1 << 2,
50
- guildExpressions: 1 << 3,
51
- guildEmojis: 1 << 3,
52
- guildEmojisAndStickers: 1 << 3,
53
- guildIntegrations: 1 << 4,
54
- guildWebhooks: 1 << 5,
55
- guildInvites: 1 << 6,
56
- guildVoiceStates: 1 << 7,
57
- guildPresences: 1 << 8,
58
- guildMessages: 1 << 9,
59
- guildMessage: 1 << 9,
60
- guildMessageReactions: 1 << 10,
61
- guildMessageTyping: 1 << 11,
62
- directMessages: 1 << 12,
63
- directMessageReactions: 1 << 13,
64
- directMessageTyping: 1 << 14,
65
- messageContent: 1 << 15,
66
- guildScheduledEvents: 1 << 16,
67
- autoModerationConfiguration: 1 << 20,
68
- autoModerationExecution: 1 << 21,
69
- guildMessagePolls: 1 << 24,
70
- directMessagePolls: 1 << 25
71
- };
72
- // packages/types/src/index.ts
73
- var InteractionResponseEnum = {
74
- Pong: 1,
75
- ChannelMessage: 4,
76
- DeferredChannelMessage: 5,
77
- DeferredMessageUpdate: 6,
78
- MessageUpdate: 7,
79
- Autocomplete: 8,
80
- Modal: 9
81
- };
82
- var StickerFormatEnum = {
83
- PNG: 1,
84
- APNG: 2,
85
- Lottie: 3,
86
- GIF: 4
87
- };
88
-
89
- // packages/structures/src/base.ts
90
- class BaseStructure {
91
- id;
92
- constructor(id) {
93
- if (!/^\d{1,20}$/.test(id))
94
- throw new TypeError("A Discord structure requires a valid snowflake ID.");
95
- this.id = id;
96
- }
97
- toString() {
98
- return this.id;
99
- }
100
- get createdTimestamp() {
101
- return Number((BigInt(this.id) >> 22n) + 1420070400000n);
102
- }
103
- get createdAt() {
104
- return new Date(this.createdTimestamp);
105
- }
106
- }
107
- var CDN_BASE = "https://cdn.discordapp.com";
108
- function cdnURL(path, hash, options = {}) {
109
- const isAnimated = hash.startsWith("a_") && !options.forceStatic;
110
- const ext = options.extension ?? (isAnimated ? "gif" : "png");
111
- const size = options.size ? `?size=${options.size}` : "";
112
- return `${CDN_BASE}${path}/${encodeURIComponent(hash)}.${ext}${size}`;
113
- }
114
-
115
- class User extends BaseStructure {
116
- username;
117
- globalName;
118
- avatar;
119
- bot;
120
- system;
121
- flags;
122
- discriminator;
123
- constructor(data) {
124
- super(data.id);
125
- if (!data.username)
126
- throw new TypeError("A Discord user requires a username.");
127
- this.username = data.username;
128
- this.globalName = data.global_name ?? null;
129
- this.avatar = data.avatar ?? null;
130
- this.bot = data.bot ?? false;
131
- this.system = data.system ?? false;
132
- this.flags = data.public_flags ?? 0;
133
- this.discriminator = data.discriminator && data.discriminator !== "0" ? data.discriminator : null;
134
- }
135
- get displayName() {
136
- return this.globalName ?? this.username;
137
- }
138
- avatarURL(options = {}) {
139
- if (!this.avatar)
140
- return null;
141
- return cdnURL(`/avatars/${this.id}`, this.avatar, options);
142
- }
143
- defaultAvatarURL() {
144
- const index = this.discriminator ? Number(this.discriminator) % 5 : Number((BigInt(this.id) >> 22n) % 6n);
145
- return `${CDN_BASE}/embed/avatars/${index}.png`;
146
- }
147
- displayAvatarURL(options = {}) {
148
- return this.avatarURL(options) ?? this.defaultAvatarURL();
149
- }
150
- toString() {
151
- return `<@${this.id}>`;
152
- }
153
- }
154
-
155
- class Channel extends BaseStructure {
156
- type;
157
- name;
158
- guildId;
159
- topic;
160
- parentId;
161
- nsfw;
162
- rateLimitPerUser;
163
- position;
164
- permissionOverwrites;
165
- partial;
166
- #context;
167
- constructor(data, context, options) {
168
- super(data.id);
169
- if (!Number.isInteger(data.type) || data.type < 0)
170
- throw new RangeError("A Discord channel requires a valid channel type.");
171
- this.type = data.type;
172
- this.name = data.name;
173
- this.guildId = data.guild_id;
174
- this.topic = data.topic;
175
- this.parentId = data.parent_id;
176
- this.nsfw = data.nsfw;
177
- this.rateLimitPerUser = data.rate_limit_per_user;
178
- this.position = data.position;
179
- this.permissionOverwrites = (data.permission_overwrites ?? []).map((overwrite) => ({ ...overwrite }));
180
- this.partial = options?.partial ?? false;
181
- this.#context = context;
182
- }
183
- send(options) {
184
- if (!this.#context)
185
- throw new Error("This channel is not attached to a client.");
186
- return this.#context.sendMessage(this.id, options);
187
- }
188
- edit(options) {
189
- if (!this.#context?.editChannel)
190
- throw new Error("This channel is not attached to a client.");
191
- return this.#context.editChannel(this.id, options);
192
- }
193
- editName(name) {
194
- if (!name.trim())
195
- throw new TypeError("Channel name cannot be empty.");
196
- return this.edit({ name });
197
- }
198
- editTopic(topic) {
199
- return this.edit({ topic });
200
- }
201
- editPermissionOverwrite(targetId, changes, options) {
202
- if (!this.#context?.editPermissionOverwrite)
203
- throw new Error("This channel is not attached to a client.");
204
- return this.#context.editPermissionOverwrite(this.id, targetId, changes, options);
205
- }
206
- editParent(parentId) {
207
- return this.edit({ parent_id: parentId });
208
- }
209
- delete(reason) {
210
- if (!this.#context?.deleteChannel)
211
- throw new Error("This channel is not attached to a client.");
212
- return this.#context.deleteChannel(this.id, reason);
213
- }
214
- update(options) {
215
- return this.edit(options);
216
- }
217
- get kind() {
218
- return channelKindOf(this.type);
219
- }
220
- is(...kinds) {
221
- return kinds.includes(this.kind);
222
- }
223
- as(...kinds) {
224
- if (!this.is(...kinds))
225
- throw new TypeError(`Channel ${this.id} is a ${this.kind} channel, not ${kinds.join(" or ")}.`);
226
- return this;
227
- }
228
- isThread() {
229
- return this.type === 10 || this.type === 11 || this.type === 12;
230
- }
231
- isTextBased() {
232
- return [0, 1, 2, 3, 5, 10, 11, 12, 13].includes(this.type);
233
- }
234
- isVoiceBased() {
235
- return this.type === 2 || this.type === 13;
236
- }
237
- isDMBased() {
238
- return this.type === 1 || this.type === 3;
239
- }
240
- toString() {
241
- return `<#${this.id}>`;
242
- }
243
- }
244
-
245
- class Guild extends BaseStructure {
246
- name;
247
- icon;
248
- splash;
249
- banner;
250
- description;
251
- preferredLocale;
252
- ownerId;
253
- features;
254
- verificationLevel;
255
- premiumTier;
256
- premiumSubscriptionCount;
257
- memberCount;
258
- approximateMemberCount;
259
- approximatePresenceCount;
260
- vanityUrlCode;
261
- nsfwLevel;
262
- discoverySplash;
263
- rulesChannelId;
264
- systemChannelId;
265
- systemChannelFlags;
266
- maxMembers;
267
- mfaLevel;
268
- explicitContentFilter;
269
- defaultMessageNotifications;
270
- afkChannelId;
271
- afkTimeout;
272
- widgetEnabled;
273
- widgetChannelId;
274
- applicationId;
275
- publicUpdatesChannelId;
276
- safetyAlertsChannelId;
277
- maxPresences;
278
- maxVideoChannelUsers;
279
- premiumProgressBarEnabled;
280
- constructor(data) {
281
- super(data.id);
282
- if (!data.name)
283
- throw new TypeError("A Discord guild requires a name.");
284
- this.name = data.name;
285
- this.icon = data.icon ?? null;
286
- this.splash = data.splash ?? null;
287
- this.banner = data.banner ?? null;
288
- this.description = data.description ?? null;
289
- this.preferredLocale = data.preferred_locale ?? "en-US";
290
- this.ownerId = data.owner_id;
291
- this.features = data.features ?? [];
292
- this.verificationLevel = data.verification_level ?? 0;
293
- this.premiumTier = data.premium_tier ?? 0;
294
- this.premiumSubscriptionCount = data.premium_subscription_count ?? 0;
295
- this.memberCount = data.member_count ?? data.approximate_member_count;
296
- this.approximateMemberCount = data.approximate_member_count;
297
- this.approximatePresenceCount = data.approximate_presence_count;
298
- this.vanityUrlCode = data.vanity_url_code ?? null;
299
- this.nsfwLevel = data.nsfw_level ?? 0;
300
- this.discoverySplash = data.discovery_splash ?? null;
301
- this.rulesChannelId = data.rules_channel_id ?? null;
302
- this.systemChannelId = data.system_channel_id ?? null;
303
- this.systemChannelFlags = data.system_channel_flags ?? 0;
304
- this.maxMembers = data.max_members ?? 0;
305
- this.mfaLevel = data.mfa_level ?? 0;
306
- this.explicitContentFilter = data.explicit_content_filter ?? 0;
307
- this.defaultMessageNotifications = data.default_message_notifications ?? 0;
308
- this.afkChannelId = data.afk_channel_id ?? null;
309
- this.afkTimeout = data.afk_timeout;
310
- this.widgetEnabled = data.widget_enabled ?? false;
311
- this.widgetChannelId = data.widget_channel_id ?? null;
312
- this.applicationId = data.application_id ?? null;
313
- this.publicUpdatesChannelId = data.public_updates_channel_id ?? null;
314
- this.safetyAlertsChannelId = data.safety_alerts_channel_id ?? null;
315
- this.maxPresences = data.max_presences ?? null;
316
- this.maxVideoChannelUsers = data.max_video_channel_users;
317
- this.premiumProgressBarEnabled = data.premium_progress_bar_enabled ?? false;
318
- }
319
- iconURL(options = {}) {
320
- if (!this.icon)
321
- return null;
322
- return cdnURL(`/icons/${this.id}`, this.icon, options);
323
- }
324
- splashURL(options = {}) {
325
- if (!this.splash)
326
- return null;
327
- return cdnURL(`/splashes/${this.id}`, this.splash, options);
328
- }
329
- bannerURL(options = {}) {
330
- if (!this.banner)
331
- return null;
332
- return cdnURL(`/banners/${this.id}`, this.banner, options);
333
- }
334
- discoverySplashURL(options = {}) {
335
- if (!this.discoverySplash)
336
- return null;
337
- return cdnURL(`/discovery-splashes/${this.id}`, this.discoverySplash, options);
338
- }
339
- widgetImageURL(style = "shield") {
340
- return `https://discord.com/api/guilds/${this.id}/widget.png?style=${style}`;
341
- }
342
- hasFeature(feature) {
343
- return this.features.includes(feature);
344
- }
345
- get isCommunity() {
346
- return this.hasFeature("COMMUNITY");
347
- }
348
- get isPartnered() {
349
- return this.hasFeature("PARTNERED");
350
- }
351
- get isVerified() {
352
- return this.hasFeature("VERIFIED");
353
- }
354
- get isBoosted() {
355
- return this.premiumSubscriptionCount > 0;
356
- }
357
- get boostLevel() {
358
- return this.premiumTier;
359
- }
360
- get hasVanityUrl() {
361
- return this.vanityUrlCode !== null;
362
- }
363
- get vanityURL() {
364
- return this.vanityUrlCode ? `https://discord.gg/${this.vanityUrlCode}` : null;
365
- }
366
- toString() {
367
- return this.name;
368
- }
369
- }
370
-
371
- // packages/structures/src/permissions.ts
372
- var PermissionOverwriteEnum;
373
- ((PermissionOverwriteEnum) => {
374
- PermissionOverwriteEnum[PermissionOverwriteEnum["Role"] = 0] = "Role";
375
- PermissionOverwriteEnum[PermissionOverwriteEnum["Member"] = 1] = "Member";
376
- })(PermissionOverwriteEnum ||= {});
377
- var Permission = {
378
- createInstantInvite: 1n << 0n,
379
- kickMembers: 1n << 1n,
380
- banMembers: 1n << 2n,
381
- administrator: 1n << 3n,
382
- manageChannels: 1n << 4n,
383
- manageGuild: 1n << 5n,
384
- addReactions: 1n << 6n,
385
- viewAuditLog: 1n << 7n,
386
- prioritySpeaker: 1n << 8n,
387
- stream: 1n << 9n,
388
- viewChannel: 1n << 10n,
389
- sendMessages: 1n << 11n,
390
- sendTTSMessages: 1n << 12n,
391
- manageMessages: 1n << 13n,
392
- embedLinks: 1n << 14n,
393
- attachFiles: 1n << 15n,
394
- readMessageHistory: 1n << 16n,
395
- mentionEveryone: 1n << 17n,
396
- useExternalEmojis: 1n << 18n,
397
- viewGuildInsights: 1n << 19n,
398
- connect: 1n << 20n,
399
- speak: 1n << 21n,
400
- muteMembers: 1n << 22n,
401
- deafenMembers: 1n << 23n,
402
- moveMembers: 1n << 24n,
403
- useVAD: 1n << 25n,
404
- changeNickname: 1n << 26n,
405
- manageNicknames: 1n << 27n,
406
- manageRoles: 1n << 28n,
407
- manageWebhooks: 1n << 29n,
408
- manageGuildExpressions: 1n << 30n,
409
- useApplicationCommands: 1n << 31n,
410
- requestToSpeak: 1n << 32n,
411
- manageEvents: 1n << 33n,
412
- manageThreads: 1n << 34n,
413
- createPublicThreads: 1n << 35n,
414
- createPrivateThreads: 1n << 36n,
415
- useExternalStickers: 1n << 37n,
416
- sendMessagesInThreads: 1n << 38n,
417
- useEmbeddedActivities: 1n << 39n,
418
- moderateMembers: 1n << 40n,
419
- viewCreatorMonetizationAnalytics: 1n << 41n,
420
- useSoundboard: 1n << 42n,
421
- createGuildExpressions: 1n << 43n,
422
- createEvents: 1n << 44n,
423
- useExternalSounds: 1n << 45n,
424
- sendVoiceMessages: 1n << 46n,
425
- setVoiceChannelStatus: 1n << 48n,
426
- sendPolls: 1n << 49n,
427
- useExternalApps: 1n << 50n,
428
- pinMessages: 1n << 51n,
429
- bypassSlowmode: 1n << 52n
430
- };
431
- var Permissions = {
432
- CreateInstantInvite: 1n << 0n,
433
- KickMembers: 1n << 1n,
434
- BanMembers: 1n << 2n,
435
- Administrator: 1n << 3n,
436
- ManageChannels: 1n << 4n,
437
- ManageGuild: 1n << 5n,
438
- AddReactions: 1n << 6n,
439
- ViewAuditLog: 1n << 7n,
440
- PrioritySpeaker: 1n << 8n,
441
- Stream: 1n << 9n,
442
- ViewChannel: 1n << 10n,
443
- SendMessages: 1n << 11n,
444
- SendTTSMessages: 1n << 12n,
445
- ManageMessages: 1n << 13n,
446
- EmbedLinks: 1n << 14n,
447
- AttachFiles: 1n << 15n,
448
- ReadMessageHistory: 1n << 16n,
449
- MentionEveryone: 1n << 17n,
450
- UseExternalEmojis: 1n << 18n,
451
- ViewGuildInsights: 1n << 19n,
452
- Connect: 1n << 20n,
453
- Speak: 1n << 21n,
454
- MuteMembers: 1n << 22n,
455
- DeafenMembers: 1n << 23n,
456
- MoveMembers: 1n << 24n,
457
- UseVAD: 1n << 25n,
458
- ChangeNickname: 1n << 26n,
459
- ManageNicknames: 1n << 27n,
460
- ManageRoles: 1n << 28n,
461
- ManageWebhooks: 1n << 29n,
462
- ManageGuildExpressions: 1n << 30n,
463
- UseApplicationCommands: 1n << 31n,
464
- RequestToSpeak: 1n << 32n,
465
- ManageEvents: 1n << 33n,
466
- ManageThreads: 1n << 34n,
467
- CreatePublicThreads: 1n << 35n,
468
- CreatePrivateThreads: 1n << 36n,
469
- UseExternalStickers: 1n << 37n,
470
- SendMessagesInThreads: 1n << 38n,
471
- UseEmbeddedActivities: 1n << 39n,
472
- ModerateMembers: 1n << 40n,
473
- ViewCreatorMonetizationAnalytics: 1n << 41n,
474
- UseSoundboard: 1n << 42n,
475
- CreateGuildExpressions: 1n << 43n,
476
- CreateEvents: 1n << 44n,
477
- UseExternalSounds: 1n << 45n,
478
- SendVoiceMessages: 1n << 46n,
479
- SetVoiceChannelStatus: 1n << 48n,
480
- SendPolls: 1n << 49n,
481
- UseExternalApps: 1n << 50n,
482
- PinMessages: 1n << 51n,
483
- BypassSlowmode: 1n << 52n
484
- };
485
- var PermissionFlagsBits = Permissions;
486
-
487
- class PermissionSet {
488
- bitfield;
489
- constructor(value = 0n) {
490
- try {
491
- if (Array.isArray(value)) {
492
- let bit = 0n;
493
- for (const item of value) {
494
- bit |= this.#resolve(item);
495
- }
496
- this.bitfield = bit;
497
- } else if (value instanceof PermissionSet) {
498
- this.bitfield = value.bitfield;
499
- } else {
500
- const bitfield = this.#resolve(value);
501
- if (bitfield < 0n)
502
- throw new RangeError("Permission bitfield cannot be negative.");
503
- this.bitfield = bitfield;
504
- }
505
- } catch (error) {
506
- if (error instanceof RangeError)
507
- throw error;
508
- throw new TypeError("Permission bitfield must be a valid non-negative integer.", { cause: error });
509
- }
510
- }
511
- get createInstantInvite() {
512
- return (this.bitfield & Permission.createInstantInvite) === Permission.createInstantInvite;
513
- }
514
- get kickMembers() {
515
- return (this.bitfield & Permission.kickMembers) === Permission.kickMembers;
516
- }
517
- get banMembers() {
518
- return (this.bitfield & Permission.banMembers) === Permission.banMembers;
519
- }
520
- get administrator() {
521
- return (this.bitfield & Permission.administrator) === Permission.administrator;
522
- }
523
- get manageChannels() {
524
- return (this.bitfield & Permission.manageChannels) === Permission.manageChannels;
525
- }
526
- get manageGuild() {
527
- return (this.bitfield & Permission.manageGuild) === Permission.manageGuild;
528
- }
529
- get addReactions() {
530
- return (this.bitfield & Permission.addReactions) === Permission.addReactions;
531
- }
532
- get viewAuditLog() {
533
- return (this.bitfield & Permission.viewAuditLog) === Permission.viewAuditLog;
534
- }
535
- get prioritySpeaker() {
536
- return (this.bitfield & Permission.prioritySpeaker) === Permission.prioritySpeaker;
537
- }
538
- get stream() {
539
- return (this.bitfield & Permission.stream) === Permission.stream;
540
- }
541
- get viewChannel() {
542
- return (this.bitfield & Permission.viewChannel) === Permission.viewChannel;
543
- }
544
- get sendMessages() {
545
- return (this.bitfield & Permission.sendMessages) === Permission.sendMessages;
546
- }
547
- get sendTTSMessages() {
548
- return (this.bitfield & Permission.sendTTSMessages) === Permission.sendTTSMessages;
549
- }
550
- get manageMessages() {
551
- return (this.bitfield & Permission.manageMessages) === Permission.manageMessages;
552
- }
553
- get embedLinks() {
554
- return (this.bitfield & Permission.embedLinks) === Permission.embedLinks;
555
- }
556
- get attachFiles() {
557
- return (this.bitfield & Permission.attachFiles) === Permission.attachFiles;
558
- }
559
- get readMessageHistory() {
560
- return (this.bitfield & Permission.readMessageHistory) === Permission.readMessageHistory;
561
- }
562
- get mentionEveryone() {
563
- return (this.bitfield & Permission.mentionEveryone) === Permission.mentionEveryone;
564
- }
565
- get useExternalEmojis() {
566
- return (this.bitfield & Permission.useExternalEmojis) === Permission.useExternalEmojis;
567
- }
568
- get viewGuildInsights() {
569
- return (this.bitfield & Permission.viewGuildInsights) === Permission.viewGuildInsights;
570
- }
571
- get connect() {
572
- return (this.bitfield & Permission.connect) === Permission.connect;
573
- }
574
- get speak() {
575
- return (this.bitfield & Permission.speak) === Permission.speak;
576
- }
577
- get muteMembers() {
578
- return (this.bitfield & Permission.muteMembers) === Permission.muteMembers;
579
- }
580
- get deafenMembers() {
581
- return (this.bitfield & Permission.deafenMembers) === Permission.deafenMembers;
582
- }
583
- get moveMembers() {
584
- return (this.bitfield & Permission.moveMembers) === Permission.moveMembers;
585
- }
586
- get useVAD() {
587
- return (this.bitfield & Permission.useVAD) === Permission.useVAD;
588
- }
589
- get changeNickname() {
590
- return (this.bitfield & Permission.changeNickname) === Permission.changeNickname;
591
- }
592
- get manageNicknames() {
593
- return (this.bitfield & Permission.manageNicknames) === Permission.manageNicknames;
594
- }
595
- get manageRoles() {
596
- return (this.bitfield & Permission.manageRoles) === Permission.manageRoles;
597
- }
598
- get manageWebhooks() {
599
- return (this.bitfield & Permission.manageWebhooks) === Permission.manageWebhooks;
600
- }
601
- get manageGuildExpressions() {
602
- return (this.bitfield & Permission.manageGuildExpressions) === Permission.manageGuildExpressions;
603
- }
604
- get useApplicationCommands() {
605
- return (this.bitfield & Permission.useApplicationCommands) === Permission.useApplicationCommands;
606
- }
607
- get requestToSpeak() {
608
- return (this.bitfield & Permission.requestToSpeak) === Permission.requestToSpeak;
609
- }
610
- get manageEvents() {
611
- return (this.bitfield & Permission.manageEvents) === Permission.manageEvents;
612
- }
613
- get manageThreads() {
614
- return (this.bitfield & Permission.manageThreads) === Permission.manageThreads;
615
- }
616
- get createPublicThreads() {
617
- return (this.bitfield & Permission.createPublicThreads) === Permission.createPublicThreads;
618
- }
619
- get createPrivateThreads() {
620
- return (this.bitfield & Permission.createPrivateThreads) === Permission.createPrivateThreads;
621
- }
622
- get useExternalStickers() {
623
- return (this.bitfield & Permission.useExternalStickers) === Permission.useExternalStickers;
624
- }
625
- get sendMessagesInThreads() {
626
- return (this.bitfield & Permission.sendMessagesInThreads) === Permission.sendMessagesInThreads;
627
- }
628
- get useEmbeddedActivities() {
629
- return (this.bitfield & Permission.useEmbeddedActivities) === Permission.useEmbeddedActivities;
630
- }
631
- get moderateMembers() {
632
- return (this.bitfield & Permission.moderateMembers) === Permission.moderateMembers;
633
- }
634
- get viewCreatorMonetizationAnalytics() {
635
- return (this.bitfield & Permission.viewCreatorMonetizationAnalytics) === Permission.viewCreatorMonetizationAnalytics;
636
- }
637
- get useSoundboard() {
638
- return (this.bitfield & Permission.useSoundboard) === Permission.useSoundboard;
639
- }
640
- get createGuildExpressions() {
641
- return (this.bitfield & Permission.createGuildExpressions) === Permission.createGuildExpressions;
642
- }
643
- get createEvents() {
644
- return (this.bitfield & Permission.createEvents) === Permission.createEvents;
645
- }
646
- get useExternalSounds() {
647
- return (this.bitfield & Permission.useExternalSounds) === Permission.useExternalSounds;
648
- }
649
- get sendVoiceMessages() {
650
- return (this.bitfield & Permission.sendVoiceMessages) === Permission.sendVoiceMessages;
651
- }
652
- get sendPolls() {
653
- return (this.bitfield & Permission.sendPolls) === Permission.sendPolls;
654
- }
655
- get useExternalApps() {
656
- return (this.bitfield & Permission.useExternalApps) === Permission.useExternalApps;
657
- }
658
- get setVoiceChannelStatus() {
659
- return (this.bitfield & Permission.setVoiceChannelStatus) === Permission.setVoiceChannelStatus;
660
- }
661
- get pinMessages() {
662
- return (this.bitfield & Permission.pinMessages) === Permission.pinMessages;
663
- }
664
- get bypassSlowmode() {
665
- return (this.bitfield & Permission.bypassSlowmode) === Permission.bypassSlowmode;
666
- }
667
- has(...permissions) {
668
- if (permissions.length === 1) {
669
- const p = permissions[0];
670
- const bit = typeof p === "bigint" ? p : this.#resolve(p);
671
- return (this.bitfield & bit) === bit;
672
- }
673
- for (let i = 0;i < permissions.length; i++) {
674
- const p = permissions[i];
675
- const bit = typeof p === "bigint" ? p : this.#resolve(p);
676
- if ((this.bitfield & bit) !== bit)
677
- return false;
678
- }
679
- return true;
680
- }
681
- any(...permissions) {
682
- if (permissions.length === 1) {
683
- const p = permissions[0];
684
- const bit = typeof p === "bigint" ? p : this.#resolve(p);
685
- return (this.bitfield & bit) !== 0n;
686
- }
687
- for (let i = 0;i < permissions.length; i++) {
688
- const p = permissions[i];
689
- const bit = typeof p === "bigint" ? p : this.#resolve(p);
690
- if ((this.bitfield & bit) !== 0n)
691
- return true;
692
- }
693
- return false;
694
- }
695
- missing(...permissions) {
696
- const wanted = new PermissionSet(permissions);
697
- return wanted.toArray().filter((name) => !this.has(name));
698
- }
699
- add(...permissions) {
700
- let bitfield = this.bitfield;
701
- for (let i = 0;i < permissions.length; i++) {
702
- const p = permissions[i];
703
- bitfield |= typeof p === "bigint" ? p : this.#resolve(p);
704
- }
705
- return new PermissionSet(bitfield);
706
- }
707
- remove(...permissions) {
708
- let bitfield = this.bitfield;
709
- for (let i = 0;i < permissions.length; i++) {
710
- const p = permissions[i];
711
- bitfield &= ~(typeof p === "bigint" ? p : this.#resolve(p));
712
- }
713
- return new PermissionSet(bitfield);
714
- }
715
- equals(other) {
716
- return this.bitfield === (other instanceof PermissionSet ? other.bitfield : new PermissionSet(other).bitfield);
717
- }
718
- toString() {
719
- return this.bitfield.toString();
720
- }
721
- toArray() {
722
- return Object.keys(Permission).filter((permission) => this.has(permission));
723
- }
724
- static #renamed = {
725
- ManageEmojisAndStickers: "ManageGuildExpressions",
726
- ManageEmojis: "ManageGuildExpressions",
727
- UseSlashCommands: "UseApplicationCommands"
728
- };
729
- #resolve(permission) {
730
- if (typeof permission === "bigint")
731
- return permission;
732
- if (typeof permission === "number")
733
- return BigInt(permission);
734
- if (permission instanceof PermissionSet)
735
- return permission.bitfield;
736
- if (Array.isArray(permission)) {
737
- let bit = 0n;
738
- for (let i = 0;i < permission.length; i++)
739
- bit |= this.#resolve(permission[i]);
740
- return bit;
741
- }
742
- if (typeof permission === "string") {
743
- const renamed = PermissionSet.#renamed[permission];
744
- if (renamed)
745
- return this.#resolve(renamed);
746
- if (permission in Permission)
747
- return Permission[permission];
748
- if (permission in Permissions)
749
- return Permissions[permission];
750
- if (permission in PermissionFlagsBits)
751
- return PermissionFlagsBits[permission];
752
- const lower = permission.charAt(0).toLowerCase() + permission.slice(1);
753
- if (lower in Permission)
754
- return Permission[lower];
755
- return BigInt(permission);
756
- }
757
- return 0n;
758
- }
759
- }
760
-
761
- class PermissionsBitField extends PermissionSet {
762
- static Flags = PermissionFlagsBits;
763
- static All = Permission;
764
- constructor(value = 0n) {
765
- super(value);
766
- }
767
- }
768
- var ALL_PERMISSIONS = Object.values(Permission).reduce((bits, bit) => bits | bit, 0n);
769
- var bits = (value) => new PermissionSet(value).bitfield;
770
- function computePermissions(context) {
771
- if (context.ownerId !== undefined && context.ownerId === context.memberId)
772
- return new PermissionSet(ALL_PERMISSIONS);
773
- const roles = new Map(context.roles.map((role) => [role.id, role]));
774
- let base = bits(roles.get(context.guildId)?.permissions ?? 0n);
775
- for (const id of context.memberRoleIds)
776
- base |= bits(roles.get(id)?.permissions ?? 0n);
777
- if (base & Permission.administrator)
778
- return new PermissionSet(ALL_PERMISSIONS);
779
- const overwrites = context.overwrites ?? [];
780
- const everyone = overwrites.find((o) => o.id === context.guildId);
781
- if (everyone)
782
- base = base & ~bits(everyone.deny) | bits(everyone.allow);
783
- const memberRoles = new Set(context.memberRoleIds);
784
- let allow = 0n;
785
- let deny = 0n;
786
- for (const overwrite of overwrites)
787
- if (overwrite.type === 0 /* Role */ && overwrite.id !== context.guildId && memberRoles.has(overwrite.id)) {
788
- allow |= bits(overwrite.allow);
789
- deny |= bits(overwrite.deny);
790
- }
791
- base = base & ~deny | allow;
792
- const member = overwrites.find((o) => o.type === 1 /* Member */ && o.id === context.memberId);
793
- if (member)
794
- base = base & ~bits(member.deny) | bits(member.allow);
795
- const until = context.timedOutUntil instanceof Date ? context.timedOutUntil.getTime() : context.timedOutUntil ?? 0;
796
- if (until > Date.now())
797
- base &= Permission.viewChannel | Permission.readMessageHistory;
798
- return new PermissionSet(base);
799
- }
800
-
801
- // packages/structures/src/resources.ts
802
- function toDateOrNull(value) {
803
- if (!value)
804
- return null;
805
- const date = new Date(value);
806
- return Number.isNaN(date.getTime()) ? null : date;
807
- }
808
-
809
- class GuildMember {
810
- user;
811
- guildId;
812
- nickname;
813
- roleIds;
814
- pending;
815
- joinedAt;
816
- avatarHash;
817
- premiumSince;
818
- timedOutUntil;
819
- flags;
820
- #suppliedPermissions;
821
- #context;
822
- constructor(data, context) {
823
- this.user = new User(data.user);
824
- this.#context = context;
825
- if (!/^\d{1,20}$/.test(data.guild_id))
826
- throw new TypeError("Member guild_id must be a valid snowflake.");
827
- this.guildId = data.guild_id;
828
- this.nickname = data.nick ?? null;
829
- this.roleIds = [...data.roles ?? []];
830
- this.pending = data.pending ?? false;
831
- this.joinedAt = data.joined_at ? new Date(data.joined_at) : undefined;
832
- if (this.joinedAt?.toString() === "Invalid Date")
833
- throw new RangeError("Member joined_at must be a valid date.");
834
- if (data.permissions !== undefined)
835
- this.#suppliedPermissions = new PermissionsBitField(data.permissions);
836
- this.avatarHash = data.avatar ?? null;
837
- this.premiumSince = toDateOrNull(data.premium_since);
838
- this.timedOutUntil = toDateOrNull(data.communication_disabled_until);
839
- this.flags = data.flags ?? 0;
840
- }
841
- get permissions() {
842
- if (this.#suppliedPermissions)
843
- return this.#suppliedPermissions;
844
- return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, undefined, this.timedOutUntil) ?? 0n);
845
- }
846
- permissionsIn(channelId) {
847
- const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId, this.timedOutUntil);
848
- return computed ? new PermissionsBitField(computed) : null;
849
- }
850
- #action(name) {
851
- const action = this.#context?.[name];
852
- if (!action)
853
- throw new Error("This member is not attached to a client.");
854
- return action;
855
- }
856
- kick(reason) {
857
- return this.#action("kickMember")(this.guildId, this.user.id, reason);
858
- }
859
- ban(options = {}) {
860
- return this.#action("banMember")(this.guildId, this.user.id, options);
861
- }
862
- edit(options, reason) {
863
- return this.#action("editMember")(this.guildId, this.user.id, options, reason);
864
- }
865
- timeout(milliseconds, reason) {
866
- if (milliseconds !== null && !(milliseconds > 0))
867
- throw new RangeError("Timeout length must be a positive number of milliseconds.");
868
- return this.edit({
869
- communication_disabled_until: milliseconds === null ? null : new Date(Date.now() + milliseconds).toISOString()
870
- }, reason);
871
- }
872
- setNickname(nickname, reason) {
873
- return this.edit({ nick: nickname }, reason);
874
- }
875
- addRole(roleId, reason) {
876
- return this.#action("addMemberRole")(this.guildId, this.user.id, roleId, reason);
877
- }
878
- removeRole(roleId, reason) {
879
- return this.#action("removeMemberRole")(this.guildId, this.user.id, roleId, reason);
880
- }
881
- get displayName() {
882
- return this.nickname ?? this.user.displayName;
883
- }
884
- get isTimedOut() {
885
- return this.timedOutUntil !== null && this.timedOutUntil > new Date;
886
- }
887
- avatarURL(options = {}) {
888
- if (this.avatarHash)
889
- return cdnURL(`/guilds/${this.guildId}/users/${this.user.id}/avatars`, this.avatarHash, options);
890
- return this.user.avatarURL(options);
891
- }
892
- displayAvatarURL(options = {}) {
893
- return this.avatarURL(options) ?? this.user.displayAvatarURL(options);
894
- }
895
- toString() {
896
- return this.user.toString();
897
- }
898
- }
899
-
900
- class Role extends BaseStructure {
901
- name;
902
- color;
903
- hoist;
904
- permissions;
905
- managed;
906
- mentionable;
907
- position;
908
- unicodeEmoji;
909
- iconHash;
910
- colors;
911
- tags;
912
- constructor(data) {
913
- super(data.id);
914
- if (!data.name)
915
- throw new TypeError("Role name cannot be empty.");
916
- this.name = data.name;
917
- this.color = data.color ?? 0;
918
- this.hoist = data.hoist ?? false;
919
- this.permissions = new PermissionsBitField(data.permissions ?? 0n);
920
- this.managed = data.managed ?? false;
921
- this.mentionable = data.mentionable ?? false;
922
- this.position = data.position ?? 0;
923
- this.unicodeEmoji = data.unicode_emoji ?? null;
924
- this.colors = data.colors ? {
925
- primary: data.colors.primary_color,
926
- secondary: data.colors.secondary_color,
927
- tertiary: data.colors.tertiary_color
928
- } : null;
929
- this.iconHash = data.icon ?? null;
930
- this.tags = data.tags ?? null;
931
- }
932
- get colorHex() {
933
- return `#${this.color.toString(16).padStart(6, "0").toUpperCase()}`;
934
- }
935
- iconURL(options = {}) {
936
- if (!this.iconHash)
937
- return null;
938
- return cdnURL(`/role-icons/${this.id}`, this.iconHash, options);
939
- }
940
- isEveryone(guildId) {
941
- return this.id === guildId;
942
- }
943
- toString() {
944
- return `<@&${this.id}>`;
945
- }
946
- }
947
-
948
- class TextChannel extends Channel {
949
- constructor(data, context) {
950
- super(data, context);
951
- }
952
- toString() {
953
- return `<#${this.id}>`;
954
- }
955
- }
956
-
957
- class Invite {
958
- code;
959
- guildId;
960
- channelId;
961
- inviter;
962
- uses;
963
- maxUses;
964
- maxAge;
965
- temporary;
966
- createdAt;
967
- expiresAt;
968
- constructor(data) {
969
- if (!data.code)
970
- throw new TypeError("An invite requires a code.");
971
- this.code = data.code;
972
- this.guildId = data.guild?.id ?? null;
973
- this.channelId = data.channel?.id ?? null;
974
- this.inviter = data.inviter ? new User(data.inviter) : null;
975
- this.uses = data.uses ?? 0;
976
- this.maxUses = data.max_uses ?? 0;
977
- this.maxAge = data.max_age ?? 0;
978
- this.temporary = data.temporary ?? false;
979
- this.createdAt = data.created_at ? new Date(data.created_at) : null;
980
- this.expiresAt = data.expires_at ? new Date(data.expires_at) : null;
981
- }
982
- get url() {
983
- return `https://discord.gg/${this.code}`;
984
- }
985
- toString() {
986
- return this.url;
987
- }
988
- }
989
- var WebhookEnum = {
990
- Incoming: 1,
991
- ChannelFollower: 2,
992
- Application: 3
993
- };
994
-
995
- class Webhook extends BaseStructure {
996
- type;
997
- name;
998
- avatarHash;
999
- channelId;
1000
- guildId;
1001
- applicationId;
1002
- token;
1003
- constructor(data) {
1004
- super(data.id);
1005
- this.type = data.type ?? WebhookEnum.Incoming;
1006
- this.name = data.name ?? null;
1007
- this.avatarHash = data.avatar ?? null;
1008
- this.channelId = data.channel_id ?? null;
1009
- this.guildId = data.guild_id ?? null;
1010
- this.applicationId = data.application_id ?? null;
1011
- this.token = data.token ?? null;
1012
- }
1013
- avatarURL(options = {}) {
1014
- if (!this.avatarHash)
1015
- return null;
1016
- return cdnURL(`/avatars/${this.id}`, this.avatarHash, options);
1017
- }
1018
- get url() {
1019
- return this.token ? `https://discord.com/api/webhooks/${this.id}/${this.token}` : null;
1020
- }
1021
- toString() {
1022
- return this.url ?? this.id;
1023
- }
1024
- }
1025
-
1026
- class Emoji extends BaseStructure {
1027
- name;
1028
- roleIds;
1029
- user;
1030
- requireColons;
1031
- managed;
1032
- animated;
1033
- available;
1034
- constructor(data) {
1035
- super(data.id ?? "0");
1036
- if (data.id === null)
1037
- this.id = "unicode";
1038
- this.name = data.name;
1039
- this.roleIds = data.roles ?? [];
1040
- this.user = data.user ? new User(data.user) : null;
1041
- this.requireColons = data.require_colons ?? false;
1042
- this.managed = data.managed ?? false;
1043
- this.animated = data.animated ?? false;
1044
- this.available = data.available ?? true;
1045
- }
1046
- url(options = {}) {
1047
- if (!this.id || this.id === "unicode")
1048
- return null;
1049
- const ext = options.extension ?? (this.animated ? "gif" : "png");
1050
- const size = options.size ? `?size=${options.size}` : "";
1051
- return `${CDN_BASE}/emojis/${this.id}.${ext}${size}`;
1052
- }
1053
- toString() {
1054
- return this.id !== "unicode" ? `<${this.animated ? "a" : ""}:${this.name}:${this.id}>` : this.name ?? "";
1055
- }
1056
- }
1057
-
1058
- class AutoModerationRule extends BaseStructure {
1059
- guildId;
1060
- name;
1061
- creatorId;
1062
- eventType;
1063
- triggerType;
1064
- triggerMetadata;
1065
- actions;
1066
- enabled;
1067
- exemptRoles;
1068
- exemptChannels;
1069
- constructor(data) {
1070
- super(data.id);
1071
- if (!/^\d{1,20}$/.test(data.guild_id))
1072
- throw new TypeError("AutoModerationRule guild_id must be a valid snowflake.");
1073
- this.guildId = data.guild_id;
1074
- this.name = data.name;
1075
- this.creatorId = data.creator_id;
1076
- this.eventType = data.event_type;
1077
- this.triggerType = data.trigger_type;
1078
- this.triggerMetadata = data.trigger_metadata;
1079
- this.actions = data.actions;
1080
- this.enabled = data.enabled;
1081
- this.exemptRoles = data.exempt_roles;
1082
- this.exemptChannels = data.exempt_channels;
1083
- }
1084
- toJSON() {
1085
- return {
1086
- id: this.id,
1087
- guildId: this.guildId,
1088
- name: this.name,
1089
- creatorId: this.creatorId,
1090
- eventType: this.eventType,
1091
- triggerType: this.triggerType,
1092
- triggerMetadata: this.triggerMetadata,
1093
- actions: this.actions,
1094
- enabled: this.enabled,
1095
- exemptRoles: this.exemptRoles,
1096
- exemptChannels: this.exemptChannels
1097
- };
1098
- }
1099
- }
1100
-
1101
- class WelcomeScreenChannel {
1102
- channelId;
1103
- description;
1104
- emojiId;
1105
- emojiName;
1106
- constructor(data) {
1107
- this.channelId = data.channel_id;
1108
- this.description = data.description;
1109
- this.emojiId = data.emoji_id;
1110
- this.emojiName = data.emoji_name;
1111
- }
1112
- }
1113
-
1114
- class GuildWelcomeScreen {
1115
- description;
1116
- channels;
1117
- constructor(data) {
1118
- this.description = data.description;
1119
- this.channels = data.welcome_channels.map((c) => new WelcomeScreenChannel(c));
1120
- }
1121
- }
1122
-
1123
- class OnboardingPromptOption extends BaseStructure {
1124
- channelIds;
1125
- roleIds;
1126
- emoji;
1127
- title;
1128
- description;
1129
- constructor(data) {
1130
- super(data.id);
1131
- this.channelIds = data.channel_ids;
1132
- this.roleIds = data.role_ids;
1133
- this.emoji = data.emoji;
1134
- this.title = data.title;
1135
- this.description = data.description;
1136
- }
1137
- }
1138
-
1139
- class OnboardingPrompt extends BaseStructure {
1140
- type;
1141
- options;
1142
- title;
1143
- singleSelect;
1144
- required;
1145
- inOnboarding;
1146
- constructor(data) {
1147
- super(data.id);
1148
- this.type = data.type;
1149
- this.options = data.options.map((o) => new OnboardingPromptOption(o));
1150
- this.title = data.title;
1151
- this.singleSelect = data.single_select;
1152
- this.required = data.required;
1153
- this.inOnboarding = data.in_onboarding;
1154
- }
1155
- }
1156
-
1157
- class GuildOnboarding extends BaseStructure {
1158
- prompts;
1159
- defaultChannelIds;
1160
- enabled;
1161
- mode;
1162
- constructor(data) {
1163
- super(data.guild_id);
1164
- this.prompts = data.prompts.map((p) => new OnboardingPrompt(p));
1165
- this.defaultChannelIds = data.default_channel_ids;
1166
- this.enabled = data.enabled;
1167
- this.mode = data.mode;
1168
- }
1169
- }
1170
- // packages/structures/src/channels.ts
1171
- class NewsChannel extends TextChannel {
1172
- }
1173
-
1174
- class DMChannel extends Channel {
1175
- recipients;
1176
- ownerId;
1177
- constructor(data, context) {
1178
- super(data, context);
1179
- this.recipients = (data.recipients ?? []).map((u) => new User(u));
1180
- this.ownerId = data.owner_id ?? null;
1181
- }
1182
- }
1183
-
1184
- class VoiceChannel extends Channel {
1185
- bitrate;
1186
- userLimit;
1187
- rtcRegion;
1188
- videoQualityMode;
1189
- constructor(data, context) {
1190
- super(data, context);
1191
- this.bitrate = data.bitrate ?? 64000;
1192
- this.userLimit = data.user_limit ?? 0;
1193
- this.rtcRegion = data.rtc_region ?? null;
1194
- this.videoQualityMode = data.video_quality_mode ?? 1;
1195
- }
1196
- }
1197
-
1198
- class StageChannel extends VoiceChannel {
1199
- }
1200
-
1201
- class CategoryChannel extends Channel {
1202
- }
1203
-
1204
- class ThreadChannel extends Channel {
1205
- ownerId;
1206
- messageCount;
1207
- memberCount;
1208
- metadata;
1209
- constructor(data, context) {
1210
- super(data, context);
1211
- this.ownerId = data.owner_id ?? null;
1212
- this.messageCount = data.message_count ?? 0;
1213
- this.memberCount = data.member_count ?? 0;
1214
- this.metadata = data.thread_metadata ?? null;
1215
- }
1216
- get archived() {
1217
- return this.metadata?.archived ?? false;
1218
- }
1219
- get locked() {
1220
- return this.metadata?.locked ?? false;
1221
- }
1222
- get autoArchiveDuration() {
1223
- return this.metadata?.auto_archive_duration ?? null;
1224
- }
1225
- }
1226
-
1227
- class ForumChannel extends Channel {
1228
- availableTags;
1229
- defaultReactionEmoji;
1230
- defaultThreadRateLimitPerUser;
1231
- defaultAutoArchiveDuration;
1232
- constructor(data, context) {
1233
- super(data, context);
1234
- this.availableTags = data.available_tags ?? [];
1235
- this.defaultReactionEmoji = data.default_reaction_emoji ?? null;
1236
- this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user ?? 0;
1237
- this.defaultAutoArchiveDuration = data.default_auto_archive_duration ?? null;
1238
- }
1239
- }
1240
-
1241
- class MediaChannel extends ForumChannel {
1242
- }
1243
- function createChannel(data, context) {
1244
- switch (data.type) {
1245
- case 0:
1246
- return new TextChannel(data, context);
1247
- case 1:
1248
- case 3:
1249
- return new DMChannel(data, context);
1250
- case 2:
1251
- return new VoiceChannel(data, context);
1252
- case 4:
1253
- return new CategoryChannel(data, context);
1254
- case 5:
1255
- return new NewsChannel(data, context);
1256
- case 10:
1257
- case 11:
1258
- case 12:
1259
- return new ThreadChannel(data, context);
1260
- case 13:
1261
- return new StageChannel(data, context);
1262
- case 15:
1263
- return new ForumChannel(data, context);
1264
- case 16:
1265
- return new MediaChannel(data, context);
1266
- default:
1267
- return new Channel(data, context);
1268
- }
1269
- }
1270
- // packages/structures/src/options.ts
1271
- var OptionType = {
1272
- SubCommand: 1,
1273
- SubCommandGroup: 2,
1274
- String: 3,
1275
- Integer: 4,
1276
- Boolean: 5,
1277
- User: 6,
1278
- Channel: 7,
1279
- Role: 8,
1280
- Mentionable: 9,
1281
- Number: 10,
1282
- Attachment: 11
1283
- };
1284
-
1285
- class CommandOptions {
1286
- #options;
1287
- #resolved;
1288
- #lookup(kind, id) {
1289
- const group = this.#resolved?.[kind];
1290
- if (typeof group !== "object" || group === null)
1291
- return;
1292
- const entry = group[id];
1293
- return typeof entry === "object" && entry !== null ? entry : undefined;
1294
- }
1295
- constructor(options, resolved = {}) {
1296
- let currentOptions = options;
1297
- let group = null;
1298
- let sub = null;
1299
- while (currentOptions.length === 1) {
1300
- const opt = currentOptions[0];
1301
- if (opt.type === OptionType.SubCommandGroup) {
1302
- group = opt.name;
1303
- currentOptions = opt.options ?? [];
1304
- } else if (opt.type === OptionType.SubCommand) {
1305
- sub = opt.name;
1306
- currentOptions = opt.options ?? [];
1307
- } else {
1308
- break;
1309
- }
1310
- }
1311
- this.#options = currentOptions;
1312
- this.#resolved = resolved;
1313
- this.#subcommandGroup = group;
1314
- this.#subcommand = sub;
1315
- }
1316
- #subcommandGroup;
1317
- #subcommand;
1318
- #get(name) {
1319
- return this.#options.find((o) => o.name.toLowerCase() === name.toLowerCase());
1320
- }
1321
- getSubcommand(required = false) {
1322
- if (!this.#subcommand && required) {
1323
- throw new TypeError("No subcommand was provided.");
1324
- }
1325
- return this.#subcommand;
1326
- }
1327
- getSubcommandGroup(required = false) {
1328
- if (!this.#subcommandGroup && required) {
1329
- throw new TypeError("No subcommand group was provided.");
1330
- }
1331
- return this.#subcommandGroup;
1332
- }
1333
- getFocused(full = false) {
1334
- const focused = this.#options.find((o) => o.focused);
1335
- if (!focused)
1336
- throw new TypeError("No focused option was provided.");
1337
- return full ? focused : focused.value ?? "";
1338
- }
1339
- getString(name, required = false) {
1340
- const opt = this.#get(name);
1341
- if (!opt || opt.type !== OptionType.String) {
1342
- if (required)
1343
- throw new TypeError(`Required option "${name}" (string) is missing.`);
1344
- return null;
1345
- }
1346
- return typeof opt.value === "string" ? opt.value : null;
1347
- }
1348
- getInteger(name, required = false) {
1349
- const opt = this.#get(name);
1350
- if (!opt || opt.type !== OptionType.Integer) {
1351
- if (required)
1352
- throw new TypeError(`Required option "${name}" (integer) is missing.`);
1353
- return null;
1354
- }
1355
- return typeof opt.value === "number" ? Math.trunc(opt.value) : null;
1356
- }
1357
- getNumber(name, required = false) {
1358
- const opt = this.#get(name);
1359
- if (!opt || opt.type !== OptionType.Number) {
1360
- if (required)
1361
- throw new TypeError(`Required option "${name}" (number) is missing.`);
1362
- return null;
1363
- }
1364
- return typeof opt.value === "number" ? opt.value : null;
1365
- }
1366
- getBoolean(name, required = false) {
1367
- const opt = this.#get(name);
1368
- if (!opt || opt.type !== OptionType.Boolean) {
1369
- if (required)
1370
- throw new TypeError(`Required option "${name}" (boolean) is missing.`);
1371
- return null;
1372
- }
1373
- return typeof opt.value === "boolean" ? opt.value : null;
1374
- }
1375
- getUser(name, required = false) {
1376
- const opt = this.#get(name);
1377
- if (!opt || opt.type !== OptionType.User) {
1378
- if (required)
1379
- throw new TypeError(`Required option "${name}" (user) is missing.`);
1380
- return null;
1381
- }
1382
- const userId = String(opt.value);
1383
- const resolved = this.#lookup("users", userId) ?? null;
1384
- if (!resolved && required)
1385
- throw new TypeError(`Resolved user for option "${name}" is missing.`);
1386
- return resolved;
1387
- }
1388
- getChannel(name, required = false) {
1389
- const opt = this.#get(name);
1390
- if (!opt || opt.type !== OptionType.Channel) {
1391
- if (required)
1392
- throw new TypeError(`Required option "${name}" (channel) is missing.`);
1393
- return null;
1394
- }
1395
- const channelId = String(opt.value);
1396
- const resolved = this.#lookup("channels", channelId) ?? null;
1397
- if (!resolved && required)
1398
- throw new TypeError(`Resolved channel for option "${name}" is missing.`);
1399
- return resolved;
1400
- }
1401
- getRole(name, required = false) {
1402
- const opt = this.#get(name);
1403
- if (!opt || opt.type !== OptionType.Role) {
1404
- if (required)
1405
- throw new TypeError(`Required option "${name}" (role) is missing.`);
1406
- return null;
1407
- }
1408
- const roleId = String(opt.value);
1409
- const resolved = this.#lookup("roles", roleId) ?? null;
1410
- if (!resolved && required)
1411
- throw new TypeError(`Resolved role for option "${name}" is missing.`);
1412
- return resolved;
1413
- }
1414
- getMentionable(name, required = false) {
1415
- const opt = this.#get(name);
1416
- if (!opt || opt.type !== OptionType.Mentionable) {
1417
- if (required)
1418
- throw new TypeError(`Required option "${name}" (mentionable) is missing.`);
1419
- return null;
1420
- }
1421
- const id = String(opt.value);
1422
- const resolved = this.#lookup("users", id) ?? this.#lookup("roles", id) ?? null;
1423
- if (!resolved && required)
1424
- throw new TypeError(`Resolved mentionable for option "${name}" is missing.`);
1425
- return resolved;
1426
- }
1427
- getMentionableType(name) {
1428
- const opt = this.#get(name);
1429
- if (!opt || opt.type !== OptionType.Mentionable)
1430
- return null;
1431
- const id = String(opt.value);
1432
- if (this.#lookup("users", id))
1433
- return "user";
1434
- if (this.#lookup("roles", id))
1435
- return "role";
1436
- return null;
1437
- }
1438
- getAttachment(name, required = false) {
1439
- const opt = this.#get(name);
1440
- if (!opt || opt.type !== OptionType.Attachment) {
1441
- if (required)
1442
- throw new TypeError(`Required option "${name}" (attachment) is missing.`);
1443
- return null;
1444
- }
1445
- const attachmentId = String(opt.value);
1446
- const resolved = this.#lookup("attachments", attachmentId) ?? null;
1447
- if (!resolved && required)
1448
- throw new TypeError(`Resolved attachment for option "${name}" is missing.`);
1449
- return resolved;
1450
- }
1451
- get raw() {
1452
- return this.#options;
1453
- }
1454
- }
1455
- // packages/structures/src/interactions.ts
1456
- var InteractionEnum = {
1457
- Ping: 1,
1458
- ApplicationCommand: 2,
1459
- MessageComponent: 3,
1460
- ApplicationCommandAutocomplete: 4,
1461
- ModalSubmit: 5
1462
- };
1463
- var EPHEMERAL = 64;
1464
- var COMMAND_CHAT_INPUT = 1;
1465
- var COMMAND_USER = 2;
1466
- var COMMAND_MESSAGE = 3;
1467
- var TOKEN_LIFETIME_MS = 15 * 60000;
1468
- var DISCORD_EPOCH = 1420070400000n;
1469
- function splitWithResponse(options) {
1470
- if (typeof options === "string")
1471
- return { withResponse: false, rest: options };
1472
- const { withResponse, ...rest } = options;
1473
- return { withResponse: withResponse === true, rest };
1474
- }
1475
- function toMessageData(options) {
1476
- if (typeof options === "string")
1477
- return { content: options };
1478
- const { ephemeral, ...data } = options;
1479
- if (ephemeral)
1480
- data.flags = (typeof data.flags === "number" ? data.flags : 0) | EPHEMERAL;
1481
- return data;
1482
- }
1483
-
1484
- class InteractionResponse {
1485
- type;
1486
- data;
1487
- withResponse = false;
1488
- constructor(type, data) {
1489
- if (!Number.isFinite(type))
1490
- throw new TypeError("Interaction response type must be finite.");
1491
- this.type = type;
1492
- this.data = data;
1493
- }
1494
- toJSON() {
1495
- return this.data === undefined ? { type: this.type } : { type: this.type, data: this.data };
1496
- }
1497
- static message(options) {
1498
- return new InteractionResponse(InteractionResponseEnum.ChannelMessage, toMessageData(options));
1499
- }
1500
- static defer(ephemeral = false) {
1501
- return new InteractionResponse(InteractionResponseEnum.DeferredChannelMessage, ephemeral ? { flags: EPHEMERAL } : undefined);
1502
- }
1503
- static pong() {
1504
- return new InteractionResponse(InteractionResponseEnum.Pong);
1505
- }
1506
- }
1507
-
1508
- class Interaction {
1509
- id;
1510
- applicationId;
1511
- token;
1512
- guildId;
1513
- channelId;
1514
- type;
1515
- data;
1516
- replied = false;
1517
- deferred = false;
1518
- #client;
1519
- #acknowledging = false;
1520
- constructor(client, data) {
1521
- if (!data.id || !data.token)
1522
- throw new TypeError("Interaction ID and token are required.");
1523
- this.#client = client;
1524
- this.id = data.id;
1525
- this.applicationId = data.application_id;
1526
- this.token = data.token;
1527
- this.guildId = data.guild_id;
1528
- this.channelId = data.channel_id;
1529
- this.type = data.type;
1530
- this.data = data;
1531
- }
1532
- get entitlements() {
1533
- const entitlements = this.data.entitlements;
1534
- return Array.isArray(entitlements) ? entitlements : [];
1535
- }
1536
- hasEntitlement(skuId) {
1537
- const now = Date.now();
1538
- return this.entitlements.some((entitlement) => entitlement.sku_id === skuId && !entitlement.deleted && (!entitlement.ends_at || Date.parse(entitlement.ends_at) > now));
1539
- }
1540
- #commandType() {
1541
- if (this.type !== InteractionEnum.ApplicationCommand)
1542
- return 0;
1543
- const type = this.data.data?.type;
1544
- return typeof type === "number" ? type : COMMAND_CHAT_INPUT;
1545
- }
1546
- isCommand() {
1547
- return this.type === InteractionEnum.ApplicationCommand;
1548
- }
1549
- isChatInputCommand() {
1550
- return this.#commandType() === COMMAND_CHAT_INPUT;
1551
- }
1552
- isContextMenuCommand() {
1553
- const type = this.#commandType();
1554
- return type === COMMAND_USER || type === COMMAND_MESSAGE;
1555
- }
1556
- isUserContextMenuCommand() {
1557
- return this.#commandType() === COMMAND_USER;
1558
- }
1559
- isMessageContextMenuCommand() {
1560
- return this.#commandType() === COMMAND_MESSAGE;
1561
- }
1562
- get resourceContext() {
1563
- return this.#client.resourceContext;
1564
- }
1565
- awaitModalSubmit(options) {
1566
- const collect = this.#client.resourceContext?.collectInteractions;
1567
- if (!collect)
1568
- return Promise.reject(new Error("This interaction is not attached to a client."));
1569
- if (!(options.time > 0))
1570
- return Promise.reject(new RangeError("awaitModalSubmit needs a positive time."));
1571
- const userId = this.user?.id;
1572
- const collector = collect({
1573
- time: options.time,
1574
- max: 1,
1575
- filter: async (interaction) => interaction.isModalSubmit() && interaction.user?.id === userId && (options.customId === undefined || interaction.customId === options.customId) && (options.filter ? await options.filter(interaction) : true)
1576
- });
1577
- return collector.next();
1578
- }
1579
- isMessageComponent() {
1580
- return this.type === InteractionEnum.MessageComponent;
1581
- }
1582
- isModalSubmit() {
1583
- return this.type === InteractionEnum.ModalSubmit;
1584
- }
1585
- isAutocomplete() {
1586
- return this.type === InteractionEnum.ApplicationCommandAutocomplete;
1587
- }
1588
- #componentType() {
1589
- return this.isMessageComponent() ? this.data.data?.component_type ?? 0 : 0;
1590
- }
1591
- isButton() {
1592
- return this.#componentType() === 2;
1593
- }
1594
- isStringSelectMenu() {
1595
- return this.#componentType() === 3;
1596
- }
1597
- isUserSelectMenu() {
1598
- return this.#componentType() === 5;
1599
- }
1600
- isRoleSelectMenu() {
1601
- return this.#componentType() === 6;
1602
- }
1603
- isMentionableSelectMenu() {
1604
- return this.#componentType() === 7;
1605
- }
1606
- isChannelSelectMenu() {
1607
- return this.#componentType() === 8;
1608
- }
1609
- isAnySelectMenu() {
1610
- return [3, 5, 6, 7, 8].includes(this.#componentType());
1611
- }
1612
- assertUnacknowledged() {
1613
- if (this.replied || this.deferred || this.#acknowledging)
1614
- throw new Error("Interaction has already been acknowledged.");
1615
- }
1616
- async acknowledge(response, state) {
1617
- this.assertUnacknowledged();
1618
- this.#acknowledging = true;
1619
- try {
1620
- const result = await this.postResponse(response);
1621
- this[state] = true;
1622
- return result;
1623
- } finally {
1624
- this.#acknowledging = false;
1625
- }
1626
- }
1627
- get user() {
1628
- const raw = this.data.member?.user ?? this.data.user;
1629
- return raw ? new User(raw) : null;
1630
- }
1631
- get member() {
1632
- const raw = this.data.member;
1633
- if (!raw || !this.guildId)
1634
- return null;
1635
- return new GuildMember({
1636
- ...raw,
1637
- guild_id: this.guildId
1638
- }, this.#client.resourceContext);
1639
- }
1640
- get createdTimestamp() {
1641
- return Number((BigInt(this.id) >> 22n) + DISCORD_EPOCH);
1642
- }
1643
- get expiresAt() {
1644
- return new Date(this.createdTimestamp + TOKEN_LIFETIME_MS);
1645
- }
1646
- get isExpired() {
1647
- return Date.now() >= this.createdTimestamp + TOKEN_LIFETIME_MS;
1648
- }
1649
- #webhookMessage(method, messageId, data) {
1650
- if (!this.#client.interactionWebhookMessage)
1651
- return Promise.reject(new Error("This interaction client does not support webhook message access."));
1652
- return this.#client.interactionWebhookMessage(method, this.applicationId, this.token, messageId, data);
1653
- }
1654
- fetchReply() {
1655
- this.assertAcknowledged();
1656
- return this.#webhookMessage("GET", "@original");
1657
- }
1658
- editFollowUp(messageId, options) {
1659
- return this.#webhookMessage("PATCH", messageId, toMessageData(options));
1660
- }
1661
- async deleteFollowUp(messageId) {
1662
- await this.#webhookMessage("DELETE", messageId);
1663
- }
1664
- assertAcknowledged() {
1665
- if (!this.replied && !this.deferred)
1666
- throw new Error("Interaction has not been acknowledged.");
1667
- }
1668
- postResponse(response) {
1669
- return this.#client.postInteractionResponse(this.id, this.token, response);
1670
- }
1671
- async acknowledgeWith(response, state, withResponse) {
1672
- response.withResponse = withResponse;
1673
- const result = await this.acknowledge(response, state);
1674
- if (!withResponse)
1675
- return result;
1676
- const message = result?.resource?.message;
1677
- return message ? new Message(message, this.#client.resourceContext) : null;
1678
- }
1679
- async reply(options) {
1680
- const { withResponse, rest } = splitWithResponse(options);
1681
- return this.acknowledgeWith(InteractionResponse.message(toMessageData(rest)), "replied", withResponse);
1682
- }
1683
- async deferReply(options = false) {
1684
- const ephemeral = typeof options === "boolean" ? options : options.ephemeral === true;
1685
- const withResponse = typeof options === "object" && options.withResponse === true;
1686
- const result = await this.acknowledgeWith(InteractionResponse.defer(ephemeral), "deferred", withResponse);
1687
- if (withResponse)
1688
- return result;
1689
- }
1690
- editReply(options) {
1691
- this.assertAcknowledged();
1692
- return this.#client.editInteractionReply(this.token, toMessageData(options));
1693
- }
1694
- deleteReply() {
1695
- this.assertAcknowledged();
1696
- return this.#client.deleteInteractionReply(this.token);
1697
- }
1698
- followUp(options) {
1699
- return this.#client.followUpInteraction(this.token, toMessageData(options));
1700
- }
1701
- async update(options) {
1702
- const { withResponse, rest } = splitWithResponse(options);
1703
- return this.acknowledgeWith(new InteractionResponse(InteractionResponseEnum.MessageUpdate, toMessageData(rest)), "replied", withResponse);
1704
- }
1705
- async showModal(modal) {
1706
- const data = "toJSON" in modal && typeof modal.toJSON === "function" ? modal.toJSON() : modal;
1707
- return this.acknowledge(new InteractionResponse(InteractionResponseEnum.Modal, data), "replied");
1708
- }
1709
- }
1710
-
1711
- class CommandInteraction extends Interaction {
1712
- options;
1713
- get commandName() {
1714
- return typeof this.data.data?.name === "string" ? this.data.data.name : "";
1715
- }
1716
- constructor(client, data) {
1717
- super(client, data);
1718
- const rawOptions = data.data?.options ?? [];
1719
- const resolved = data.data?.resolved ?? {};
1720
- this.options = new CommandOptions(rawOptions, resolved);
1721
- }
1722
- }
1723
-
1724
- class ContextMenuCommandInteraction extends CommandInteraction {
1725
- #resolved() {
1726
- return this.data.data?.resolved ?? {};
1727
- }
1728
- get targetId() {
1729
- const id = this.data.data?.target_id;
1730
- return typeof id === "string" ? id : null;
1731
- }
1732
- get targetUser() {
1733
- const id = this.targetId;
1734
- const raw = id ? this.#resolved().users?.[id] : undefined;
1735
- return raw ? new User(raw) : null;
1736
- }
1737
- get targetMember() {
1738
- const id = this.targetId;
1739
- const raw = id ? this.#resolved().members?.[id] : undefined;
1740
- const user = id ? this.#resolved().users?.[id] : undefined;
1741
- if (!raw || !user || !this.guildId)
1742
- return null;
1743
- return new GuildMember({
1744
- ...raw,
1745
- user,
1746
- guild_id: this.guildId
1747
- }, this.resourceContext);
1748
- }
1749
- get targetMessage() {
1750
- const id = this.targetId;
1751
- const raw = id ? this.#resolved().messages?.[id] : undefined;
1752
- return raw ? new Message(raw, this.resourceContext) : null;
1753
- }
1754
- }
1755
-
1756
- class ComponentInteraction extends Interaction {
1757
- get customId() {
1758
- const id = this.data.data?.custom_id;
1759
- return typeof id === "string" ? id : "";
1760
- }
1761
- get messageId() {
1762
- return this.data.message?.id;
1763
- }
1764
- get componentType() {
1765
- const type = this.data.data?.component_type;
1766
- return typeof type === "number" ? type : 0;
1767
- }
1768
- get values() {
1769
- const values = this.data.data?.values;
1770
- return Array.isArray(values) ? values : [];
1771
- }
1772
- async deferUpdate(options = {}) {
1773
- const withResponse = options.withResponse === true;
1774
- const result = await this.acknowledgeWith(new InteractionResponse(InteractionResponseEnum.DeferredMessageUpdate), "deferred", withResponse);
1775
- if (withResponse)
1776
- return result;
1777
- }
1778
- }
1779
-
1780
- class ModalSubmitInteraction extends Interaction {
1781
- get customId() {
1782
- const id = this.data.data?.custom_id;
1783
- return typeof id === "string" ? id : "";
1784
- }
1785
- getInputValue(customId) {
1786
- const rows = this.data.data?.components ?? [];
1787
- for (const row of rows) {
1788
- for (const comp of row.components ?? []) {
1789
- if (comp.custom_id === customId)
1790
- return comp.value;
1791
- }
1792
- }
1793
- return;
1794
- }
1795
- getRequiredInputValue(customId) {
1796
- const value = this.getInputValue(customId);
1797
- if (value === undefined)
1798
- throw new TypeError(`Modal input "${customId}" was not found in the submission.`);
1799
- return value;
1800
- }
1801
- }
1802
-
1803
- class AutocompleteInteraction extends Interaction {
1804
- options;
1805
- constructor(client, data) {
1806
- super(client, data);
1807
- this.options = new CommandOptions(data.data?.options ?? []);
1808
- }
1809
- get commandName() {
1810
- const name = this.data.data?.name;
1811
- return typeof name === "string" ? name : "";
1812
- }
1813
- get focusedOption() {
1814
- const options = this.data.data?.options;
1815
- return findFocused(Array.isArray(options) ? options : []);
1816
- }
1817
- async respond(choices) {
1818
- if (!Array.isArray(choices))
1819
- throw new TypeError("Autocomplete choices must be an array.");
1820
- const response = new InteractionResponse(InteractionResponseEnum.Autocomplete, { choices });
1821
- await this.acknowledge(response, "replied");
1822
- }
1823
- }
1824
- function findFocused(options) {
1825
- for (const opt of options) {
1826
- if (opt.focused)
1827
- return { name: opt.name, value: opt.value, type: opt.type };
1828
- if (Array.isArray(opt.options)) {
1829
- const found = findFocused(opt.options);
1830
- if (found)
1831
- return found;
1832
- }
1833
- }
1834
- return;
1835
- }
1836
- function createInteraction(client, data) {
1837
- switch (data.type) {
1838
- case InteractionEnum.ApplicationCommand: {
1839
- const commandType = data.data?.type;
1840
- return commandType === COMMAND_USER || commandType === COMMAND_MESSAGE ? new ContextMenuCommandInteraction(client, data) : new CommandInteraction(client, data);
1841
- }
1842
- case InteractionEnum.ApplicationCommandAutocomplete:
1843
- return new AutocompleteInteraction(client, data);
1844
- case InteractionEnum.MessageComponent:
1845
- return new ComponentInteraction(client, data);
1846
- case InteractionEnum.ModalSubmit:
1847
- return new ModalSubmitInteraction(client, data);
1848
- default:
1849
- return new Interaction(client, data);
1850
- }
1851
- }
1852
- // packages/structures/src/embed.ts
1853
- class Embed {
1854
- #data;
1855
- constructor(data = {}) {
1856
- this.#data = { ...data };
1857
- if (this.#data.fields)
1858
- this.#data.fields = [...this.#data.fields];
1859
- }
1860
- get title() {
1861
- return this.#data.title;
1862
- }
1863
- get description() {
1864
- return this.#data.description;
1865
- }
1866
- get url() {
1867
- return this.#data.url;
1868
- }
1869
- get color() {
1870
- return this.#data.color;
1871
- }
1872
- get timestamp() {
1873
- return this.#data.timestamp;
1874
- }
1875
- get createdAt() {
1876
- return this.#data.timestamp ? new Date(this.#data.timestamp) : undefined;
1877
- }
1878
- get footer() {
1879
- return this.#data.footer;
1880
- }
1881
- get image() {
1882
- return this.#data.image;
1883
- }
1884
- get thumbnail() {
1885
- return this.#data.thumbnail;
1886
- }
1887
- get video() {
1888
- return this.#data.video;
1889
- }
1890
- get author() {
1891
- return this.#data.author;
1892
- }
1893
- get fields() {
1894
- return this.#data.fields ?? [];
1895
- }
1896
- setTitle(title) {
1897
- if (title.length > 256)
1898
- throw new TypeError("Embed title must not exceed 256 characters.");
1899
- this.#data.title = title;
1900
- return this;
1901
- }
1902
- setDescription(description) {
1903
- if (description.length > 4096)
1904
- throw new TypeError("Embed description must not exceed 4096 characters.");
1905
- this.#data.description = description;
1906
- return this;
1907
- }
1908
- setURL(url) {
1909
- this.#data.url = url;
1910
- return this;
1911
- }
1912
- setColor(color) {
1913
- if (typeof color === "string") {
1914
- const hex = color.replace(/^#/, "");
1915
- this.#data.color = parseInt(hex, 16);
1916
- } else {
1917
- this.#data.color = color;
1918
- }
1919
- return this;
1920
- }
1921
- setTimestamp(timestamp = Date.now()) {
1922
- this.#data.timestamp = new Date(timestamp).toISOString();
1923
- return this;
1924
- }
1925
- setFooter(text, iconURL) {
1926
- if (text.length > 2048)
1927
- throw new TypeError("Embed footer text must not exceed 2048 characters.");
1928
- this.#data.footer = iconURL ? { text, icon_url: iconURL } : { text };
1929
- return this;
1930
- }
1931
- setImage(url) {
1932
- this.#data.image = { url };
1933
- return this;
1934
- }
1935
- setThumbnail(url) {
1936
- this.#data.thumbnail = { url };
1937
- return this;
1938
- }
1939
- setAuthor(name, options = {}) {
1940
- if (name.length > 256)
1941
- throw new TypeError("Embed author name must not exceed 256 characters.");
1942
- this.#data.author = {
1943
- name,
1944
- url: options.url,
1945
- icon_url: options.iconURL
1946
- };
1947
- return this;
1948
- }
1949
- addFields(...fields) {
1950
- const existing = this.#data.fields ?? [];
1951
- if (existing.length + fields.length > 25)
1952
- throw new TypeError("Embeds cannot have more than 25 fields.");
1953
- for (const field of fields) {
1954
- if (field.name.length > 256)
1955
- throw new TypeError("Embed field name must not exceed 256 characters.");
1956
- if (field.value.length > 1024)
1957
- throw new TypeError("Embed field value must not exceed 1024 characters.");
1958
- }
1959
- this.#data.fields = [...existing, ...fields];
1960
- return this;
1961
- }
1962
- clearFields() {
1963
- this.#data.fields = [];
1964
- return this;
1965
- }
1966
- spliceFields(index, deleteCount, ...fields) {
1967
- const next = [...this.#data.fields ?? []];
1968
- next.splice(index, deleteCount, ...fields);
1969
- if (next.length > 25)
1970
- throw new TypeError("Embeds cannot have more than 25 fields.");
1971
- for (const field of fields) {
1972
- if (field.name.length > 256)
1973
- throw new TypeError("Embed field name must not exceed 256 characters.");
1974
- if (field.value.length > 1024)
1975
- throw new TypeError("Embed field value must not exceed 1024 characters.");
1976
- }
1977
- this.#data.fields = next;
1978
- return this;
1979
- }
1980
- toJSON() {
1981
- const json = { ...this.#data };
1982
- if (json.fields)
1983
- json.fields = [...json.fields];
1984
- return json;
1985
- }
1986
- static from(data) {
1987
- return new Embed(data);
1988
- }
1989
- }
1990
- // packages/structures/src/audit-log.ts
1991
- function int(value) {
1992
- return Number(value ?? 0);
1993
- }
1994
- function parseInfo(type, options) {
1995
- if (!options)
1996
- return;
1997
- switch (type) {
1998
- case 13:
1999
- case 14:
2000
- case 15:
2001
- return {
2002
- id: options.id ?? "",
2003
- type: int(options.type),
2004
- roleName: options.role_name
2005
- };
2006
- case 21:
2007
- return {
2008
- deleteMemberDays: int(options.delete_member_days),
2009
- membersRemoved: int(options.members_removed)
2010
- };
2011
- case 26:
2012
- case 72:
2013
- return {
2014
- channelId: options.channel_id ?? "",
2015
- count: int(options.count)
2016
- };
2017
- case 27:
2018
- case 73:
2019
- return { count: int(options.count) };
2020
- case 74:
2021
- case 75:
2022
- return {
2023
- channelId: options.channel_id ?? "",
2024
- messageId: options.message_id ?? ""
2025
- };
2026
- case 83:
2027
- case 84:
2028
- case 85:
2029
- return { channelId: options.channel_id ?? "" };
2030
- case 121:
2031
- return { applicationId: options.app_id ?? "" };
2032
- case 143:
2033
- case 144:
2034
- case 145:
2035
- return {
2036
- ruleName: options.auto_moderation_rule_name ?? "",
2037
- ruleTriggerType: int(options.auto_moderation_rule_trigger_type),
2038
- channelId: options.channel_id
2039
- };
2040
- default:
2041
- return;
2042
- }
2043
- }
2044
-
2045
- class AuditLogEntry extends BaseStructure {
2046
- targetId;
2047
- userId;
2048
- actionType;
2049
- changes;
2050
- options;
2051
- info;
2052
- reason;
2053
- constructor(data) {
2054
- super(data.id);
2055
- this.targetId = data.target_id;
2056
- this.userId = data.user_id;
2057
- this.actionType = data.action_type;
2058
- this.info = parseInfo(data.action_type, data.options);
2059
- this.changes = data.changes ?? [];
2060
- this.options = data.options ?? null;
2061
- this.reason = data.reason ?? null;
2062
- }
2063
- is(type) {
2064
- return this.actionType === type;
2065
- }
2066
- change(key) {
2067
- const found = this.changes.find((change) => change.key === key);
2068
- return found && { old: found.old_value, new: found.new_value };
2069
- }
2070
- }
2071
-
2072
- class AuditLog {
2073
- entries;
2074
- constructor(data) {
2075
- this.entries = new Map;
2076
- for (const entryData of data.audit_log_entries) {
2077
- this.entries.set(entryData.id, new AuditLogEntry(entryData));
2078
- }
2079
- }
2080
- filter(query) {
2081
- const types = query.type === undefined ? undefined : Array.isArray(query.type) ? query.type : [query.type];
2082
- const since = query.since === undefined ? undefined : new Date(query.since).getTime();
2083
- const matches = [];
2084
- for (const entry of this.entries.values()) {
2085
- if (types && !types.includes(entry.actionType))
2086
- continue;
2087
- if (query.targetId !== undefined && entry.targetId !== query.targetId)
2088
- continue;
2089
- if (query.userId !== undefined && entry.userId !== query.userId)
2090
- continue;
2091
- if (since !== undefined && entry.createdAt.getTime() < since)
2092
- continue;
2093
- matches.push(entry);
2094
- }
2095
- return matches;
2096
- }
2097
- find(query) {
2098
- return this.filter(query)[0];
2099
- }
2100
- }
2101
- // packages/structures/src/sticker.ts
2102
- function stickerURL(id, format, options = {}) {
2103
- const size = options.size === undefined ? "" : `?size=${options.size}`;
2104
- if (format === StickerFormatEnum.Lottie)
2105
- return `https://cdn.discordapp.com/stickers/${id}.json`;
2106
- if (format === StickerFormatEnum.GIF)
2107
- return `https://media.discordapp.net/stickers/${id}.gif${size}`;
2108
- return `https://cdn.discordapp.com/stickers/${id}.png${size}`;
2109
- }
2110
-
2111
- class Sticker extends BaseStructure {
2112
- name;
2113
- description;
2114
- tags;
2115
- type;
2116
- formatType;
2117
- available;
2118
- guildId;
2119
- packId;
2120
- sortValue;
2121
- user;
2122
- constructor(data) {
2123
- super(data.id);
2124
- this.name = data.name;
2125
- this.description = data.description ?? null;
2126
- this.tags = data.tags ?? "";
2127
- this.type = data.type ?? 2;
2128
- this.formatType = data.format_type;
2129
- this.available = data.available ?? true;
2130
- this.guildId = data.guild_id ?? null;
2131
- this.packId = data.pack_id ?? null;
2132
- this.sortValue = data.sort_value ?? null;
2133
- this.user = data.user ?? null;
2134
- }
2135
- get animated() {
2136
- return this.formatType !== StickerFormatEnum.PNG;
2137
- }
2138
- url(options = {}) {
2139
- return stickerURL(this.id, this.formatType, options);
2140
- }
2141
- toItem() {
2142
- return { id: this.id, name: this.name, format_type: this.formatType };
2143
- }
2144
- }
2145
-
2146
- // packages/structures/src/index.ts
2147
- var COMPONENT_COLLECTOR_DEFAULT_TIME = 15 * 60000;
2148
- var NON_SYSTEM_MESSAGE_TYPES = new Set([0, 19, 20, 23]);
2149
-
2150
- class Message extends BaseStructure {
2151
- content;
2152
- author;
2153
- channelId;
2154
- channel;
2155
- guildId;
2156
- flags;
2157
- timestamp;
2158
- attachments;
2159
- embeds;
2160
- mentions;
2161
- mentionRoles;
2162
- pinned;
2163
- mentionEveryone;
2164
- type;
2165
- reference;
2166
- components;
2167
- referencedMessage;
2168
- stickers;
2169
- poll;
2170
- messageSnapshots;
2171
- member;
2172
- #context;
2173
- constructor(data, context) {
2174
- super(data.id);
2175
- if (!/^\d{1,20}$/.test(data.channel_id))
2176
- throw new TypeError("Message channel_id must be a valid snowflake.");
2177
- this.content = data.content ?? "";
2178
- this.author = new User(data.author);
2179
- this.channelId = data.channel_id;
2180
- this.guildId = data.guild_id;
2181
- this.flags = data.flags ?? 0;
2182
- this.timestamp = new Date(data.timestamp ?? Number((BigInt(this.id) >> 22n) + 1420070400000n));
2183
- this.attachments = data.attachments ?? [];
2184
- this.embeds = data.embeds ?? [];
2185
- this.components = data.components ?? [];
2186
- this.mentions = (data.mentions ?? []).map((user) => new User(user));
2187
- this.mentionRoles = data.mention_roles ?? [];
2188
- this.pinned = data.pinned ?? false;
2189
- this.mentionEveryone = data.mention_everyone ?? false;
2190
- this.type = data.type ?? 0;
2191
- this.reference = data.message_reference;
2192
- this.stickers = data.sticker_items ?? (data.stickers ?? []).map(({ id, name, format_type }) => ({
2193
- id,
2194
- name,
2195
- format_type
2196
- }));
2197
- this.poll = data.poll ?? null;
2198
- this.messageSnapshots = data.message_snapshots ?? [];
2199
- this.referencedMessage = data.referenced_message ? new Message(data.referenced_message, context) : data.referenced_message === null ? null : undefined;
2200
- this.#context = context;
2201
- this.member = data.member && data.guild_id ? new GuildMember({
2202
- ...data.member,
2203
- user: data.member.user ?? data.author,
2204
- guild_id: data.guild_id
2205
- }, context) : null;
2206
- this.channel = context?.cachedChannel?.(data.channel_id) ?? new Channel({ id: data.channel_id, type: 0, guild_id: data.guild_id }, context, { partial: true });
2207
- }
2208
- get embedsSuppressed() {
2209
- return (this.flags & 4) !== 0;
2210
- }
2211
- get createdTimestamp() {
2212
- return this.timestamp.getTime();
2213
- }
2214
- get createdAt() {
2215
- return this.timestamp;
2216
- }
2217
- edit(options) {
2218
- if (!this.#context)
2219
- throw new Error("This message is not attached to a client.");
2220
- return this.#context.editMessage(this.channelId, this.id, options);
2221
- }
2222
- update(options) {
2223
- return this.edit(options);
2224
- }
2225
- delete(reason) {
2226
- if (!this.#context)
2227
- throw new Error("This message is not attached to a client.");
2228
- return this.#context.deleteMessage(this.channelId, this.id, reason);
2229
- }
2230
- reply(options) {
2231
- if (!this.#context)
2232
- throw new Error("This message is not attached to a client.");
2233
- const payload = typeof options === "string" ? { content: options } : { ...options };
2234
- payload.message_reference = {
2235
- message_id: this.id,
2236
- channel_id: this.channelId,
2237
- guild_id: this.guildId
2238
- };
2239
- return this.#context.sendMessage(this.channelId, payload);
2240
- }
2241
- crosspost() {
2242
- if (!this.#context)
2243
- throw new Error("This message is not attached to a client.");
2244
- return this.#context.crosspostMessage(this.channelId, this.id);
2245
- }
2246
- createComponentCollector(options = {}) {
2247
- const collect = this.#context?.collectInteractions;
2248
- if (!collect)
2249
- throw new Error("This message is not attached to a client.");
2250
- const { componentType, filter, ...rest } = options;
2251
- return collect({
2252
- ...rest,
2253
- time: rest.time ?? (rest.idle ? undefined : COMPONENT_COLLECTOR_DEFAULT_TIME),
2254
- filter: async (interaction) => interaction.isMessageComponent() && interaction.messageId === this.id && (componentType === undefined || interaction.componentType === componentType) && (filter ? await filter(interaction) : true)
2255
- });
2256
- }
2257
- awaitComponent(options = {}) {
2258
- return this.createComponentCollector({ ...options, max: 1 }).next();
2259
- }
2260
- react(emoji) {
2261
- if (!this.#context?.addReaction)
2262
- throw new Error("This message is not attached to a client.");
2263
- return this.#context.addReaction(this.channelId, this.id, emoji);
2264
- }
2265
- removeReaction(emoji, userId) {
2266
- if (!this.#context)
2267
- throw new Error("This message is not attached to a client.");
2268
- return userId ? this.#context.removeReaction?.(this.channelId, this.id, emoji, userId) ?? Promise.reject(new Error("Reaction operations are unavailable.")) : this.#context.removeOwnReaction?.(this.channelId, this.id, emoji) ?? Promise.reject(new Error("Reaction operations are unavailable."));
2269
- }
2270
- removeAllReactions() {
2271
- if (!this.#context?.removeAllReactions)
2272
- throw new Error("This message is not attached to a client.");
2273
- return this.#context.removeAllReactions(this.channelId, this.id);
2274
- }
2275
- pin(reason) {
2276
- if (!this.#context?.pinMessage)
2277
- throw new Error("This message is not attached to a client.");
2278
- return this.#context.pinMessage(this.channelId, this.id, reason);
2279
- }
2280
- unpin(reason) {
2281
- if (!this.#context?.unpinMessage)
2282
- throw new Error("This message is not attached to a client.");
2283
- return this.#context.unpinMessage(this.channelId, this.id, reason);
2284
- }
2285
- get isEphemeral() {
2286
- return (this.flags & 64) !== 0;
2287
- }
2288
- get isPinned() {
2289
- return this.pinned;
2290
- }
2291
- get isSystemMessage() {
2292
- return !NON_SYSTEM_MESSAGE_TYPES.has(this.type);
2293
- }
2294
- get isCrosspost() {
2295
- return (this.flags & 2) !== 0;
2296
- }
2297
- get hasAttachments() {
2298
- return this.attachments.length > 0;
2299
- }
2300
- get hasEmbeds() {
2301
- return this.embeds.length > 0;
2302
- }
2303
- get hasComponents() {
2304
- return this.components.length > 0;
2305
- }
2306
- suppressEmbeds() {
2307
- return this.edit({ flags: this.flags | 4 });
2308
- }
2309
- toJSON() {
2310
- return {
2311
- id: this.id,
2312
- content: this.content,
2313
- channelId: this.channelId,
2314
- guildId: this.guildId,
2315
- flags: this.flags,
2316
- pinned: this.pinned,
2317
- mentionEveryone: this.mentionEveryone,
2318
- type: this.type,
2319
- timestamp: this.timestamp.toISOString(),
2320
- author: { id: this.author.id, username: this.author.username },
2321
- attachments: [...this.attachments],
2322
- embeds: [...this.embeds],
2323
- components: [...this.components],
2324
- mentions: this.mentions.map((u) => u.id),
2325
- mentionRoles: [...this.mentionRoles],
2326
- reference: this.reference,
2327
- referencedMessage: this.referencedMessage ? this.referencedMessage.id : this.referencedMessage
2328
- };
2329
- }
2330
- }
2
+ import {
3
+ InteractionResponseEnum2
4
+ } from "../chunks/index-gyvps8b9.js";
5
+ import {
6
+ BaseStructure2,
7
+ CDN_BASE2,
8
+ cdnURL2,
9
+ User2,
10
+ Channel2,
11
+ Guild2,
12
+ PermissionOverwriteEnum2,
13
+ Permission2,
14
+ Permissions2,
15
+ PermissionFlagsBits2,
16
+ PermissionSet2,
17
+ PermissionsBitField2,
18
+ computePermissions2,
19
+ GuildMember2,
20
+ Role2,
21
+ TextChannel2,
22
+ Invite2,
23
+ WebhookEnum2,
24
+ Webhook2,
25
+ Emoji2,
26
+ AutoModerationRule2,
27
+ WelcomeScreenChannel2,
28
+ GuildWelcomeScreen2,
29
+ OnboardingPromptOption2,
30
+ OnboardingPrompt2,
31
+ GuildOnboarding2,
32
+ NewsChannel2,
33
+ DMChannel2,
34
+ VoiceChannel2,
35
+ StageChannel2,
36
+ CategoryChannel2,
37
+ ThreadChannel2,
38
+ ForumChannel2,
39
+ MediaChannel2,
40
+ createChannel2,
41
+ CommandOptions2,
42
+ InteractionEnum2,
43
+ InteractionResponse2,
44
+ Interaction2,
45
+ CommandInteraction2,
46
+ ContextMenuCommandInteraction2,
47
+ ComponentInteraction2,
48
+ ModalSubmitInteraction2,
49
+ AutocompleteInteraction2,
50
+ createInteraction2,
51
+ Embed2,
52
+ AuditLogEntry2,
53
+ AuditLog2,
54
+ stickerURL2,
55
+ Sticker2,
56
+ Message2
57
+ } from "../chunks/index-57c5n3ms.js";
2331
58
  export {
2332
- AuditLog,
2333
- AuditLogEntry,
2334
- AutoModerationRule,
2335
- AutocompleteInteraction,
2336
- BaseStructure,
2337
- CDN_BASE,
2338
- CategoryChannel,
2339
- Channel,
2340
- CommandInteraction,
2341
- CommandOptions,
2342
- ComponentInteraction,
2343
- ContextMenuCommandInteraction,
2344
- DMChannel,
2345
- Embed,
2346
- Emoji,
2347
- ForumChannel,
2348
- Guild,
2349
- GuildMember,
2350
- GuildOnboarding,
2351
- GuildWelcomeScreen,
2352
- Interaction,
2353
- InteractionEnum,
2354
- InteractionResponse,
2355
- InteractionResponseEnum,
2356
- Invite,
2357
- MediaChannel,
2358
- Message,
2359
- ModalSubmitInteraction,
2360
- NewsChannel,
2361
- OnboardingPrompt,
2362
- OnboardingPromptOption,
2363
- Permission,
2364
- PermissionFlagsBits,
2365
- PermissionOverwriteEnum,
2366
- PermissionSet,
2367
- Permissions,
2368
- PermissionsBitField,
2369
- Role,
2370
- StageChannel,
2371
- Sticker,
2372
- TextChannel,
2373
- ThreadChannel,
2374
- User,
2375
- VoiceChannel,
2376
- Webhook,
2377
- WebhookEnum,
2378
- WelcomeScreenChannel,
2379
- cdnURL,
2380
- computePermissions,
2381
- createChannel,
2382
- createInteraction,
2383
- stickerURL
59
+ AuditLog2 as AuditLog,
60
+ AuditLogEntry2 as AuditLogEntry,
61
+ AutoModerationRule2 as AutoModerationRule,
62
+ AutocompleteInteraction2 as AutocompleteInteraction,
63
+ BaseStructure2 as BaseStructure,
64
+ CDN_BASE2 as CDN_BASE,
65
+ CategoryChannel2 as CategoryChannel,
66
+ Channel2 as Channel,
67
+ CommandInteraction2 as CommandInteraction,
68
+ CommandOptions2 as CommandOptions,
69
+ ComponentInteraction2 as ComponentInteraction,
70
+ ContextMenuCommandInteraction2 as ContextMenuCommandInteraction,
71
+ DMChannel2 as DMChannel,
72
+ Embed2 as Embed,
73
+ Emoji2 as Emoji,
74
+ ForumChannel2 as ForumChannel,
75
+ Guild2 as Guild,
76
+ GuildMember2 as GuildMember,
77
+ GuildOnboarding2 as GuildOnboarding,
78
+ GuildWelcomeScreen2 as GuildWelcomeScreen,
79
+ Interaction2 as Interaction,
80
+ InteractionEnum2 as InteractionEnum,
81
+ InteractionResponse2 as InteractionResponse,
82
+ InteractionResponseEnum2 as InteractionResponseEnum,
83
+ Invite2 as Invite,
84
+ MediaChannel2 as MediaChannel,
85
+ Message2 as Message,
86
+ ModalSubmitInteraction2 as ModalSubmitInteraction,
87
+ NewsChannel2 as NewsChannel,
88
+ OnboardingPrompt2 as OnboardingPrompt,
89
+ OnboardingPromptOption2 as OnboardingPromptOption,
90
+ Permission2 as Permission,
91
+ PermissionFlagsBits2 as PermissionFlagsBits,
92
+ PermissionOverwriteEnum2 as PermissionOverwriteEnum,
93
+ PermissionSet2 as PermissionSet,
94
+ Permissions2 as Permissions,
95
+ PermissionsBitField2 as PermissionsBitField,
96
+ Role2 as Role,
97
+ StageChannel2 as StageChannel,
98
+ Sticker2 as Sticker,
99
+ TextChannel2 as TextChannel,
100
+ ThreadChannel2 as ThreadChannel,
101
+ User2 as User,
102
+ VoiceChannel2 as VoiceChannel,
103
+ Webhook2 as Webhook,
104
+ WebhookEnum2 as WebhookEnum,
105
+ WelcomeScreenChannel2 as WelcomeScreenChannel,
106
+ cdnURL2 as cdnURL,
107
+ computePermissions2 as computePermissions,
108
+ createChannel2 as createChannel,
109
+ createInteraction2 as createInteraction,
110
+ stickerURL2 as stickerURL
2384
111
  };
2385
112
 
2386
- //# debugId=AAE5FFB306F1F13364756E2164756E21
113
+ //# debugId=946C0C61F3442BB064756E2164756E21