@sillyfrogster/eunia 0.1.0-alpha.1

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.
@@ -0,0 +1,4188 @@
1
+ import { EventEmitter } from "node:events";
2
+ //#region packages/cache/src/adapter.d.ts
3
+ interface CacheAdapter {
4
+ get(namespace: string, key: string): Promise<unknown | undefined>;
5
+ set(namespace: string, key: string, value: unknown, ttl?: number): Promise<void>;
6
+ delete(namespace: string, key: string): Promise<void>;
7
+ clear(namespace: string): Promise<void>;
8
+ close(): Promise<void>;
9
+ }
10
+ type CacheAdapterOperation = "get" | "set" | "delete" | "clear" | "close";
11
+ interface CacheErrorContext {
12
+ operation: CacheAdapterOperation;
13
+ namespace: string;
14
+ key?: string;
15
+ }
16
+ type CacheErrorHandler = (error: unknown, context: CacheErrorContext) => unknown;
17
+ //#endregion
18
+ //#region packages/cache/src/memory.d.ts
19
+ interface MemoryStoreOptions {
20
+ maxSize?: number;
21
+ ttl?: number;
22
+ now?: () => number;
23
+ }
24
+ declare class MemoryStore<T> {
25
+ readonly maxSize: number;
26
+ readonly ttl: number | undefined;
27
+ private readonly items;
28
+ private readonly now;
29
+ constructor(options?: MemoryStoreOptions | number);
30
+ resolve(id: string): T | undefined;
31
+ get(id: string): T | undefined;
32
+ set(id: string, value: T, ttl?: number | undefined): void;
33
+ delete(id: string): boolean;
34
+ has(id: string): boolean;
35
+ clear(): void;
36
+ get size(): number;
37
+ values(): IterableIterator<T>;
38
+ keys(): IterableIterator<string>;
39
+ entries(): IterableIterator<[string, T]>;
40
+ private evictOverflow;
41
+ private isExpired;
42
+ private removeExpired;
43
+ }
44
+ //#endregion
45
+ //#region packages/cache/src/store.d.ts
46
+ interface CachePolicy {
47
+ maxSize?: number;
48
+ ttl?: number;
49
+ readThroughTtl?: number;
50
+ maxPendingOperations?: number;
51
+ }
52
+ interface ResolvedCachePolicy {
53
+ maxSize: number;
54
+ ttl?: number;
55
+ readThroughTtl: number;
56
+ maxPendingOperations: number;
57
+ }
58
+ interface CacheStoreOptions {
59
+ namespace: string;
60
+ policy?: CachePolicy;
61
+ adapter?: CacheAdapter;
62
+ onError?: CacheErrorHandler;
63
+ now?: () => number;
64
+ }
65
+ type CacheBackpressureOperation = Exclude<CacheAdapterOperation, "close">;
66
+ declare class CacheBackpressureError extends Error {
67
+ readonly namespace: string;
68
+ readonly operation: CacheBackpressureOperation;
69
+ readonly limit: number;
70
+ readonly pendingOperations: number;
71
+ readonly code = "CACHE_BACKPRESSURE";
72
+ constructor(namespace: string, operation: CacheBackpressureOperation, limit: number, pendingOperations: number);
73
+ }
74
+ declare const DEFAULT_CACHE_READ_THROUGH_TTL: number;
75
+ declare const DEFAULT_CACHE_MAX_PENDING_OPERATIONS = 1000;
76
+ declare class CacheStore<T> {
77
+ readonly namespace: string;
78
+ readonly policy: Readonly<ResolvedCachePolicy>;
79
+ readonly hot: MemoryStore<T>;
80
+ private readonly adapter;
81
+ private readonly onError;
82
+ private readonly keyWrites;
83
+ private readonly pendingWrites;
84
+ private readonly reads;
85
+ private readonly keyVersions;
86
+ private clearVersion;
87
+ private clearWrite;
88
+ private clearPending;
89
+ constructor(options: CacheStoreOptions);
90
+ resolve(id: string): T | undefined;
91
+ get(id: string): Promise<T | undefined>;
92
+ has(id: string): boolean;
93
+ set(id: string, value: T, ttl?: number | undefined): void;
94
+ delete(id: string): boolean;
95
+ clear(): void;
96
+ get size(): number;
97
+ get pendingOperations(): number;
98
+ values(): IterableIterator<T>;
99
+ keys(): IterableIterator<string>;
100
+ entries(): IterableIterator<[string, T]>;
101
+ flush(): Promise<void>;
102
+ private readThrough;
103
+ private enqueueKeyWrite;
104
+ private executeKeyWrite;
105
+ private settleWrite;
106
+ private trackWrite;
107
+ private waitForWrites;
108
+ private canCoalesceKeyWrite;
109
+ private assertCapacity;
110
+ private bumpVersion;
111
+ private finishRead;
112
+ private removeVersionWhenIdle;
113
+ private report;
114
+ }
115
+ //#endregion
116
+ //#region packages/cache/src/cache.d.ts
117
+ interface CacheShape {
118
+ user: unknown;
119
+ guild: unknown;
120
+ channel: unknown;
121
+ message: unknown;
122
+ member?: unknown;
123
+ role?: unknown;
124
+ }
125
+ type BuiltInCacheDomain = "users" | "guilds" | "channels" | "messages" | "members" | "roles";
126
+ declare const DEFAULT_CACHE_POLICIES: {
127
+ readonly users: {
128
+ readonly maxSize: 10000;
129
+ };
130
+ readonly guilds: {
131
+ readonly maxSize: 1000;
132
+ };
133
+ readonly channels: {
134
+ readonly maxSize: 10000;
135
+ };
136
+ readonly messages: {
137
+ readonly maxSize: 1000;
138
+ readonly ttl: number;
139
+ };
140
+ readonly members: {
141
+ readonly maxSize: 25000;
142
+ };
143
+ readonly roles: {
144
+ readonly maxSize: 5000;
145
+ };
146
+ };
147
+ interface RedisAdapterConfig {
148
+ driver: "redis" | "valkey";
149
+ url?: string;
150
+ prefix?: string;
151
+ }
152
+ interface MemoryAdapterConfig {
153
+ driver: "memory";
154
+ }
155
+ type BuiltInCacheAdapterConfig = MemoryAdapterConfig | RedisAdapterConfig;
156
+ interface CacheOptions {
157
+ adapter?: CacheAdapter | BuiltInCacheAdapterConfig;
158
+ policies?: Partial<Record<BuiltInCacheDomain, CachePolicy>>;
159
+ onError?: CacheErrorHandler;
160
+ }
161
+ type ShapeValue<S, K extends PropertyKey> = K extends keyof S ? S[K] : unknown;
162
+ declare class Cache<S extends CacheShape = CacheShape> {
163
+ readonly users: CacheStore<ShapeValue<S, "user">>;
164
+ readonly guilds: CacheStore<ShapeValue<S, "guild">>;
165
+ readonly channels: CacheStore<ShapeValue<S, "channel">>;
166
+ readonly messages: CacheStore<ShapeValue<S, "message">>;
167
+ readonly members: CacheStore<ShapeValue<S, "member">>;
168
+ readonly roles: CacheStore<ShapeValue<S, "role">>;
169
+ private readonly adapter;
170
+ private readonly onError;
171
+ private readonly domains;
172
+ private closePromise;
173
+ constructor(options?: CacheOptions);
174
+ domain<T>(name: string, policy?: CachePolicy): CacheStore<T>;
175
+ flush(): Promise<void>;
176
+ close(): Promise<void>;
177
+ private createDomain;
178
+ private closeAdapter;
179
+ }
180
+ //#endregion
181
+ //#region packages/cache/src/redis.d.ts
182
+ interface RedisClientLike {
183
+ get(key: string): Promise<string | null>;
184
+ set(key: string, value: string): Promise<unknown>;
185
+ set(key: string, value: string, px: "PX", milliseconds: number): Promise<unknown>;
186
+ del(...keys: string[]): Promise<number>;
187
+ scan(cursor: string | number, match: "MATCH", pattern: string, count: "COUNT", hint: number): Promise<[string, string[]]>;
188
+ close(): void | Promise<void>;
189
+ }
190
+ interface RedisCacheAdapterOptions {
191
+ url?: string;
192
+ prefix?: string;
193
+ client?: RedisClientLike;
194
+ }
195
+ declare class RedisCacheAdapter implements CacheAdapter {
196
+ readonly prefix: string;
197
+ private readonly client;
198
+ constructor(options?: RedisCacheAdapterOptions);
199
+ get(namespace: string, key: string): Promise<unknown | undefined>;
200
+ set(namespace: string, key: string, value: unknown, ttl?: number): Promise<void>;
201
+ delete(namespace: string, key: string): Promise<void>;
202
+ clear(namespace: string): Promise<void>;
203
+ close(): Promise<void>;
204
+ private key;
205
+ private namespacePrefix;
206
+ }
207
+ declare class ValkeyCacheAdapter extends RedisCacheAdapter {}
208
+ //#endregion
209
+ //#region packages/types/src/common.d.ts
210
+ type Snowflake = string;
211
+ type BitfieldString = `${bigint}`;
212
+ type ISO8601Timestamp = string;
213
+ type Awaitable$1<T> = T | PromiseLike<T>;
214
+ type JsonPrimitive = string | number | boolean | null;
215
+ type JsonValue = JsonPrimitive | JsonValue[] | {
216
+ [key: string]: JsonValue;
217
+ };
218
+ type Locale = "id" | "da" | "de" | "en-GB" | "en-US" | "es-ES" | "es-419" | "fr" | "hr" | "it" | "lt" | "hu" | "nl" | "no" | "pl" | "pt-BR" | "ro" | "fi" | "sv-SE" | "vi" | "tr" | "cs" | "el" | "bg" | "ru" | "uk" | "hi" | "th" | "zh-CN" | "ja" | "zh-TW" | "ko";
219
+ type Localizations = Partial<Record<Locale, string | null>>;
220
+ //#endregion
221
+ //#region packages/types/src/user.d.ts
222
+ declare enum PremiumType {
223
+ None = 0,
224
+ NitroClassic = 1,
225
+ Nitro = 2,
226
+ NitroBasic = 3
227
+ }
228
+ declare enum UserFlags {
229
+ Staff = 1,
230
+ Partner = 2,
231
+ HypeSquad = 4,
232
+ BugHunterLevel1 = 8,
233
+ HypeSquadBravery = 64,
234
+ HypeSquadBrilliance = 128,
235
+ HypeSquadBalance = 256,
236
+ PremiumEarlySupporter = 512,
237
+ TeamPseudoUser = 1024,
238
+ BugHunterLevel2 = 16384,
239
+ VerifiedBot = 65536,
240
+ VerifiedDeveloper = 131072,
241
+ CertifiedModerator = 262144,
242
+ BotHTTPInteractions = 524288
243
+ }
244
+ interface AvatarDecorationData {
245
+ asset: string;
246
+ sku_id: Snowflake;
247
+ }
248
+ type NameplatePalette = "crimson" | "berry" | "sky" | "teal" | "forest" | "bubble_gum" | "violet" | "cobalt" | "clover" | "lemon" | "white";
249
+ interface Nameplate {
250
+ sku_id: Snowflake;
251
+ asset: string;
252
+ label: string;
253
+ palette: NameplatePalette;
254
+ }
255
+ interface Collectibles {
256
+ nameplate?: Nameplate;
257
+ }
258
+ interface UserPrimaryGuild {
259
+ identity_guild_id: Snowflake | null;
260
+ identity_enabled: boolean | null;
261
+ tag: string | null;
262
+ badge: string | null;
263
+ }
264
+ /** A user returned by the HTTP API or gateway. */
265
+ interface User$1 {
266
+ id: Snowflake;
267
+ username: string;
268
+ discriminator: string;
269
+ global_name: string | null;
270
+ avatar: string | null;
271
+ bot?: boolean;
272
+ system?: boolean;
273
+ mfa_enabled?: boolean;
274
+ banner?: string | null;
275
+ accent_color?: number | null;
276
+ locale?: Locale;
277
+ verified?: boolean;
278
+ email?: string | null;
279
+ flags?: number;
280
+ premium_type?: PremiumType;
281
+ public_flags?: number;
282
+ avatar_decoration_data?: AvatarDecorationData | null;
283
+ collectibles?: Collectibles | null;
284
+ primary_guild?: UserPrimaryGuild | null;
285
+ }
286
+ type PartialUser = Pick<User$1, "id"> & Partial<Omit<User$1, "id">>;
287
+ //#endregion
288
+ //#region packages/types/src/emoji.d.ts
289
+ interface Emoji {
290
+ id: Snowflake | null;
291
+ name: string | null;
292
+ roles?: Snowflake[];
293
+ user?: User$1;
294
+ require_colons?: boolean;
295
+ managed?: boolean;
296
+ animated?: boolean;
297
+ available?: boolean;
298
+ }
299
+ type PartialEmoji = Pick<Emoji, "id" | "name"> & Partial<Omit<Emoji, "id" | "name">>;
300
+ //#endregion
301
+ //#region packages/types/src/sticker.d.ts
302
+ declare enum StickerType {
303
+ Standard = 1,
304
+ Guild = 2
305
+ }
306
+ declare enum StickerFormatType {
307
+ PNG = 1,
308
+ APNG = 2,
309
+ Lottie = 3,
310
+ GIF = 4
311
+ }
312
+ interface Sticker {
313
+ id: Snowflake;
314
+ pack_id?: Snowflake;
315
+ name: string;
316
+ description: string | null;
317
+ tags: string;
318
+ type: StickerType;
319
+ format_type: StickerFormatType;
320
+ available?: boolean;
321
+ guild_id?: Snowflake;
322
+ user?: User$1;
323
+ sort_value?: number;
324
+ }
325
+ interface StickerItem {
326
+ id: Snowflake;
327
+ name: string;
328
+ format_type: StickerFormatType;
329
+ }
330
+ interface StickerPack {
331
+ id: Snowflake;
332
+ stickers: Sticker[];
333
+ name: string;
334
+ sku_id: Snowflake;
335
+ cover_sticker_id?: Snowflake;
336
+ description: string;
337
+ banner_asset_id?: Snowflake;
338
+ }
339
+ //#endregion
340
+ //#region packages/types/src/guild.d.ts
341
+ declare enum GuildVerificationLevel {
342
+ None = 0,
343
+ Low = 1,
344
+ Medium = 2,
345
+ High = 3,
346
+ VeryHigh = 4
347
+ }
348
+ declare enum GuildDefaultMessageNotificationLevel {
349
+ AllMessages = 0,
350
+ OnlyMentions = 1
351
+ }
352
+ declare enum GuildExplicitContentFilterLevel {
353
+ Disabled = 0,
354
+ MembersWithoutRoles = 1,
355
+ AllMembers = 2
356
+ }
357
+ declare enum GuildMFALevel {
358
+ None = 0,
359
+ Elevated = 1
360
+ }
361
+ declare enum GuildPremiumTier {
362
+ None = 0,
363
+ Tier1 = 1,
364
+ Tier2 = 2,
365
+ Tier3 = 3
366
+ }
367
+ declare enum GuildNSFWLevel {
368
+ Default = 0,
369
+ Explicit = 1,
370
+ Safe = 2,
371
+ AgeRestricted = 3
372
+ }
373
+ declare enum SystemChannelFlags {
374
+ SuppressJoinNotifications = 1,
375
+ SuppressPremiumSubscriptions = 2,
376
+ SuppressGuildReminderNotifications = 4,
377
+ SuppressJoinNotificationReplies = 8,
378
+ SuppressRoleSubscriptionPurchaseNotifications = 16,
379
+ SuppressRoleSubscriptionPurchaseNotificationReplies = 32
380
+ }
381
+ declare const PermissionFlags: {
382
+ readonly CreateInstantInvite: bigint;
383
+ readonly KickMembers: bigint;
384
+ readonly BanMembers: bigint;
385
+ readonly Administrator: bigint;
386
+ readonly ManageChannels: bigint;
387
+ readonly ManageGuild: bigint;
388
+ readonly AddReactions: bigint;
389
+ readonly ViewAuditLog: bigint;
390
+ readonly PrioritySpeaker: bigint;
391
+ readonly Stream: bigint;
392
+ readonly ViewChannel: bigint;
393
+ readonly SendMessages: bigint;
394
+ readonly SendTtsMessages: bigint;
395
+ readonly ManageMessages: bigint;
396
+ readonly EmbedLinks: bigint;
397
+ readonly AttachFiles: bigint;
398
+ readonly ReadMessageHistory: bigint;
399
+ readonly MentionEveryone: bigint;
400
+ readonly UseExternalEmojis: bigint;
401
+ readonly ViewGuildInsights: bigint;
402
+ readonly Connect: bigint;
403
+ readonly Speak: bigint;
404
+ readonly MuteMembers: bigint;
405
+ readonly DeafenMembers: bigint;
406
+ readonly MoveMembers: bigint;
407
+ readonly UseVad: bigint;
408
+ readonly ChangeNickname: bigint;
409
+ readonly ManageNicknames: bigint;
410
+ readonly ManageRoles: bigint;
411
+ readonly ManageWebhooks: bigint;
412
+ readonly ManageGuildExpressions: bigint;
413
+ readonly UseApplicationCommands: bigint;
414
+ readonly RequestToSpeak: bigint;
415
+ readonly ManageEvents: bigint;
416
+ readonly ManageThreads: bigint;
417
+ readonly CreatePublicThreads: bigint;
418
+ readonly CreatePrivateThreads: bigint;
419
+ readonly UseExternalStickers: bigint;
420
+ readonly SendMessagesInThreads: bigint;
421
+ readonly UseEmbeddedActivities: bigint;
422
+ readonly ModerateMembers: bigint;
423
+ readonly ViewCreatorMonetizationAnalytics: bigint;
424
+ readonly UseSoundboard: bigint;
425
+ readonly CreateGuildExpressions: bigint;
426
+ readonly CreateEvents: bigint;
427
+ readonly UseExternalSounds: bigint;
428
+ readonly SendVoiceMessages: bigint;
429
+ readonly SetVoiceChannelStatus: bigint;
430
+ readonly SendPolls: bigint;
431
+ readonly UseExternalApps: bigint;
432
+ readonly PinMessages: bigint;
433
+ readonly BypassSlowmode: bigint;
434
+ };
435
+ type PermissionFlag = (typeof PermissionFlags)[keyof typeof PermissionFlags];
436
+ type PermissionFlagName = keyof typeof PermissionFlags;
437
+ type PermissionInput = bigint | BitfieldString | readonly PermissionFlag[];
438
+ /** Folds a PermissionInput into a single bigint bitfield. */
439
+ declare function toPermissionBits(value: PermissionInput): bigint;
440
+ /** Returns true when the bitfield contains every flag in `required` (Administrator implies all). */
441
+ declare function can(permissions: bigint, required: bigint): boolean;
442
+ /** Returns true when the bitfield contains at least one flag in `anyOf` (Administrator implies all). */
443
+ declare function canAny(permissions: bigint, anyOf: bigint): boolean;
444
+ /** Names the flags in `required` that the bitfield lacks (empty for Administrator). */
445
+ declare function missing(permissions: bigint, required: bigint): PermissionFlagName[];
446
+ /** Names every flag set in the bitfield. */
447
+ declare function toFlagNames(permissions: bigint): PermissionFlagName[];
448
+ declare enum RoleFlags {
449
+ InPrompt = 1
450
+ }
451
+ declare enum GuildMemberFlags {
452
+ DidRejoin = 1,
453
+ CompletedOnboarding = 2,
454
+ BypassesVerification = 4,
455
+ StartedOnboarding = 8,
456
+ IsGuest = 16,
457
+ StartedHomeActions = 32,
458
+ CompletedHomeActions = 64,
459
+ AutoModQuarantinedUsername = 128,
460
+ DMSettingsUpsellAcknowledged = 512,
461
+ AutoModQuarantinedGuildTag = 1024
462
+ }
463
+ interface RoleColors {
464
+ primary_color: number;
465
+ secondary_color: number | null;
466
+ tertiary_color: number | null;
467
+ }
468
+ interface RoleTags {
469
+ bot_id?: Snowflake;
470
+ integration_id?: Snowflake;
471
+ premium_subscriber?: null;
472
+ subscription_listing_id?: Snowflake;
473
+ available_for_purchase?: null;
474
+ guild_connections?: null;
475
+ }
476
+ interface Role$1 {
477
+ id: Snowflake;
478
+ name: string;
479
+ color: number;
480
+ colors: RoleColors;
481
+ hoist: boolean;
482
+ icon: string | null;
483
+ unicode_emoji: string | null;
484
+ position: number;
485
+ permissions: BitfieldString;
486
+ managed: boolean;
487
+ mentionable: boolean;
488
+ tags?: RoleTags;
489
+ flags: number;
490
+ }
491
+ interface GuildMember$1 {
492
+ user?: User$1;
493
+ nick?: string | null;
494
+ avatar?: string | null;
495
+ banner?: string | null;
496
+ roles: Snowflake[];
497
+ joined_at: ISO8601Timestamp | null;
498
+ premium_since?: ISO8601Timestamp | null;
499
+ deaf: boolean;
500
+ mute: boolean;
501
+ flags: number;
502
+ pending?: boolean;
503
+ permissions?: BitfieldString;
504
+ communication_disabled_until?: ISO8601Timestamp | null;
505
+ avatar_decoration_data?: User$1["avatar_decoration_data"];
506
+ collectibles?: Collectibles | null;
507
+ }
508
+ interface GuildBan {
509
+ reason: string | null;
510
+ user: User$1;
511
+ }
512
+ interface WelcomeScreenChannel {
513
+ channel_id: Snowflake;
514
+ description: string;
515
+ emoji_id: Snowflake | null;
516
+ emoji_name: string | null;
517
+ }
518
+ interface WelcomeScreen {
519
+ description: string | null;
520
+ welcome_channels: WelcomeScreenChannel[];
521
+ }
522
+ interface GuildIncidentsData {
523
+ invites_disabled_until?: ISO8601Timestamp | null;
524
+ dms_disabled_until?: ISO8601Timestamp | null;
525
+ dm_spam_detected_at?: ISO8601Timestamp | null;
526
+ raid_detected_at?: ISO8601Timestamp | null;
527
+ }
528
+ interface UnavailableGuild {
529
+ id: Snowflake;
530
+ unavailable: true;
531
+ }
532
+ /** A guild returned by the HTTP API or gateway. */
533
+ interface Guild$1 {
534
+ id: Snowflake;
535
+ name: string;
536
+ icon: string | null;
537
+ splash: string | null;
538
+ discovery_splash: string | null;
539
+ owner?: boolean;
540
+ owner_id: Snowflake;
541
+ permissions?: BitfieldString;
542
+ afk_channel_id: Snowflake | null;
543
+ afk_timeout: number;
544
+ widget_enabled?: boolean;
545
+ widget_channel_id?: Snowflake | null;
546
+ verification_level: GuildVerificationLevel;
547
+ default_message_notifications: GuildDefaultMessageNotificationLevel;
548
+ explicit_content_filter: GuildExplicitContentFilterLevel;
549
+ roles: Role$1[];
550
+ emojis: Emoji[];
551
+ features: string[];
552
+ mfa_level: GuildMFALevel;
553
+ application_id: Snowflake | null;
554
+ system_channel_id: Snowflake | null;
555
+ system_channel_flags: number;
556
+ rules_channel_id: Snowflake | null;
557
+ max_presences?: number | null;
558
+ max_members?: number;
559
+ vanity_url_code: string | null;
560
+ description: string | null;
561
+ banner: string | null;
562
+ premium_tier: GuildPremiumTier;
563
+ premium_subscription_count?: number;
564
+ preferred_locale: Locale;
565
+ public_updates_channel_id: Snowflake | null;
566
+ max_video_channel_users?: number;
567
+ max_stage_video_channel_users?: number;
568
+ approximate_member_count?: number;
569
+ approximate_presence_count?: number;
570
+ nsfw_level: GuildNSFWLevel;
571
+ welcome_screen?: WelcomeScreen;
572
+ stickers?: Sticker[];
573
+ premium_progress_bar_enabled: boolean;
574
+ safety_alerts_channel_id: Snowflake | null;
575
+ incidents_data: GuildIncidentsData | null;
576
+ channels?: Channel$1[];
577
+ threads?: Channel$1[];
578
+ members?: GuildMember$1[];
579
+ unavailable?: boolean;
580
+ member_count?: number;
581
+ joined_at?: ISO8601Timestamp;
582
+ large?: boolean;
583
+ }
584
+ type PartialGuild = Pick<Guild$1, "id" | "name" | "icon" | "banner" | "owner" | "permissions" | "features"> & Pick<Guild$1, "approximate_member_count" | "approximate_presence_count">;
585
+ //#endregion
586
+ //#region packages/types/src/channel.d.ts
587
+ declare enum ChannelType {
588
+ GuildText = 0,
589
+ DM = 1,
590
+ GuildVoice = 2,
591
+ GroupDM = 3,
592
+ GuildCategory = 4,
593
+ GuildAnnouncement = 5,
594
+ AnnouncementThread = 10,
595
+ PublicThread = 11,
596
+ PrivateThread = 12,
597
+ GuildStageVoice = 13,
598
+ GuildDirectory = 14,
599
+ GuildForum = 15,
600
+ GuildMedia = 16
601
+ }
602
+ declare enum OverwriteType {
603
+ Role = 0,
604
+ Member = 1
605
+ }
606
+ declare enum VideoQualityMode {
607
+ Auto = 1,
608
+ Full = 2
609
+ }
610
+ declare enum ChannelFlags {
611
+ Pinned = 2,
612
+ RequireTag = 16,
613
+ HideMediaDownloadOptions = 32768,
614
+ IsSpoilerChannel = 2097152
615
+ }
616
+ declare enum SortOrderType {
617
+ LatestActivity = 0,
618
+ CreationDate = 1
619
+ }
620
+ declare enum ForumLayoutType {
621
+ NotSet = 0,
622
+ ListView = 1,
623
+ GalleryView = 2
624
+ }
625
+ type ThreadAutoArchiveDuration = 60 | 1_440 | 4_320 | 10_080;
626
+ interface PermissionOverwrite {
627
+ id: Snowflake;
628
+ type: OverwriteType;
629
+ allow: BitfieldString;
630
+ deny: BitfieldString;
631
+ }
632
+ interface ThreadMetadata {
633
+ archived: boolean;
634
+ auto_archive_duration: ThreadAutoArchiveDuration;
635
+ archive_timestamp: ISO8601Timestamp;
636
+ locked: boolean;
637
+ invitable?: boolean;
638
+ create_timestamp?: ISO8601Timestamp | null;
639
+ }
640
+ interface ThreadMember {
641
+ id?: Snowflake;
642
+ user_id?: Snowflake;
643
+ join_timestamp: ISO8601Timestamp;
644
+ flags: number;
645
+ member?: GuildMember$1;
646
+ }
647
+ interface ForumTagBase {
648
+ id: Snowflake;
649
+ name: string;
650
+ moderated: boolean;
651
+ }
652
+ type ForumTag = ForumTagBase & ({
653
+ emoji_id: Snowflake;
654
+ emoji_name: null;
655
+ } | {
656
+ emoji_id: null;
657
+ emoji_name: string;
658
+ } | {
659
+ emoji_id: null;
660
+ emoji_name: null;
661
+ });
662
+ type DefaultReaction = {
663
+ emoji_id: Snowflake;
664
+ emoji_name: null;
665
+ } | {
666
+ emoji_id: null;
667
+ emoji_name: string;
668
+ };
669
+ /** A channel returned by the HTTP API or gateway. */
670
+ interface Channel$1 {
671
+ id: Snowflake;
672
+ type: ChannelType;
673
+ guild_id?: Snowflake;
674
+ position?: number;
675
+ permission_overwrites?: PermissionOverwrite[];
676
+ name?: string | null;
677
+ topic?: string | null;
678
+ nsfw?: boolean;
679
+ last_message_id?: Snowflake | null;
680
+ bitrate?: number;
681
+ user_limit?: number;
682
+ rate_limit_per_user?: number;
683
+ recipients?: User$1[];
684
+ icon?: string | null;
685
+ owner_id?: Snowflake;
686
+ application_id?: Snowflake;
687
+ managed?: boolean;
688
+ parent_id?: Snowflake | null;
689
+ last_pin_timestamp?: ISO8601Timestamp | null;
690
+ rtc_region?: string | null;
691
+ video_quality_mode?: VideoQualityMode;
692
+ message_count?: number;
693
+ member_count?: number;
694
+ thread_metadata?: ThreadMetadata;
695
+ member?: ThreadMember;
696
+ default_auto_archive_duration?: ThreadAutoArchiveDuration;
697
+ permissions?: BitfieldString;
698
+ app_permissions?: BitfieldString;
699
+ flags?: number;
700
+ total_message_sent?: number;
701
+ available_tags?: ForumTag[];
702
+ applied_tags?: Snowflake[];
703
+ default_reaction_emoji?: DefaultReaction | null;
704
+ default_thread_rate_limit_per_user?: number;
705
+ default_sort_order?: SortOrderType | null;
706
+ default_forum_layout?: ForumLayoutType;
707
+ }
708
+ //#endregion
709
+ //#region packages/types/src/application.d.ts
710
+ declare enum ApplicationCommandType {
711
+ ChatInput = 1,
712
+ User = 2,
713
+ Message = 3,
714
+ PrimaryEntryPoint = 4
715
+ }
716
+ declare enum ApplicationCommandOptionType {
717
+ Subcommand = 1,
718
+ SubcommandGroup = 2,
719
+ String = 3,
720
+ Integer = 4,
721
+ Boolean = 5,
722
+ User = 6,
723
+ Channel = 7,
724
+ Role = 8,
725
+ Mentionable = 9,
726
+ Number = 10,
727
+ Attachment = 11
728
+ }
729
+ declare enum ApplicationIntegrationType {
730
+ GuildInstall = 0,
731
+ UserInstall = 1
732
+ }
733
+ declare enum InteractionContextType {
734
+ Guild = 0,
735
+ BotDM = 1,
736
+ PrivateChannel = 2
737
+ }
738
+ declare enum EntryPointCommandHandlerType {
739
+ AppHandler = 1,
740
+ DiscordLaunchActivity = 2
741
+ }
742
+ declare enum ApplicationCommandPermissionType {
743
+ Role = 1,
744
+ User = 2,
745
+ Channel = 3
746
+ }
747
+ interface InstallParams {
748
+ scopes: string[];
749
+ permissions: BitfieldString;
750
+ }
751
+ interface ApplicationIntegrationTypeConfiguration {
752
+ oauth2_install_params?: InstallParams;
753
+ }
754
+ interface TeamMember {
755
+ membership_state: 1 | 2;
756
+ team_id: Snowflake;
757
+ user: PartialUser;
758
+ role?: string;
759
+ permissions?: string[];
760
+ }
761
+ interface Team {
762
+ icon: string | null;
763
+ id: Snowflake;
764
+ members: TeamMember[];
765
+ name: string;
766
+ owner_user_id: Snowflake;
767
+ }
768
+ interface Application {
769
+ id: Snowflake;
770
+ name: string;
771
+ icon: string | null;
772
+ description: string;
773
+ rpc_origins?: string[];
774
+ bot_public: boolean;
775
+ bot_require_code_grant: boolean;
776
+ bot?: PartialUser;
777
+ terms_of_service_url?: string;
778
+ privacy_policy_url?: string;
779
+ owner?: PartialUser;
780
+ verify_key: string;
781
+ team: Team | null;
782
+ guild_id?: Snowflake;
783
+ guild?: PartialGuild;
784
+ primary_sku_id?: Snowflake;
785
+ slug?: string;
786
+ cover_image?: string;
787
+ flags?: number;
788
+ flags_new?: BitfieldString;
789
+ approximate_guild_count?: number;
790
+ approximate_user_install_count?: number;
791
+ approximate_user_authorization_count?: number;
792
+ redirect_uris?: string[];
793
+ interactions_endpoint_url?: string | null;
794
+ role_connections_verification_url?: string | null;
795
+ event_webhooks_url?: string | null;
796
+ event_webhooks_status?: 1 | 2 | 3;
797
+ event_webhooks_types?: string[];
798
+ tags?: string[];
799
+ install_params?: InstallParams;
800
+ integration_types_config?: Partial<Record<ApplicationIntegrationType, ApplicationIntegrationTypeConfiguration>>;
801
+ custom_install_url?: string;
802
+ }
803
+ interface ApplicationCommandChoice<T extends string | number = string | number> {
804
+ name: string;
805
+ name_localizations?: Localizations | null;
806
+ value: T;
807
+ }
808
+ interface ApplicationCommandOptionBase<T extends ApplicationCommandOptionType> {
809
+ type: T;
810
+ name: string;
811
+ name_localizations?: Localizations | null;
812
+ description: string;
813
+ description_localizations?: Localizations | null;
814
+ }
815
+ type CommandOptionChoices<T extends string | number> = {
816
+ choices?: ApplicationCommandChoice<T>[];
817
+ autocomplete?: false;
818
+ } | {
819
+ choices?: never;
820
+ autocomplete: true;
821
+ };
822
+ type ApplicationCommandSubcommandOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> & {
823
+ options?: ApplicationCommandBasicOption[];
824
+ };
825
+ type ApplicationCommandSubcommandGroupOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> & {
826
+ options: ApplicationCommandSubcommandOption[];
827
+ };
828
+ type ApplicationCommandStringOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.String> & CommandOptionChoices<string> & {
829
+ required?: boolean;
830
+ min_length?: number;
831
+ max_length?: number;
832
+ };
833
+ type ApplicationCommandNumericOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number> & CommandOptionChoices<number> & {
834
+ required?: boolean;
835
+ min_value?: number;
836
+ max_value?: number;
837
+ };
838
+ type ApplicationCommandChannelOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> & {
839
+ required?: boolean;
840
+ channel_types?: ChannelType[];
841
+ };
842
+ type ApplicationCommandSimpleOption = ApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable | ApplicationCommandOptionType.Attachment> & {
843
+ required?: boolean;
844
+ };
845
+ type ApplicationCommandBasicOption = ApplicationCommandStringOption | ApplicationCommandNumericOption | ApplicationCommandChannelOption | ApplicationCommandSimpleOption;
846
+ type ApplicationCommandOption = ApplicationCommandSubcommandOption | ApplicationCommandSubcommandGroupOption | ApplicationCommandBasicOption;
847
+ interface ApplicationCommandCreateBase {
848
+ name: string;
849
+ name_localizations?: Localizations | null;
850
+ default_member_permissions?: BitfieldString | null;
851
+ dm_permission?: boolean;
852
+ default_permission?: boolean | null;
853
+ contexts?: InteractionContextType[] | null;
854
+ integration_types?: ApplicationIntegrationType[];
855
+ nsfw?: boolean;
856
+ }
857
+ type ChatInputApplicationCommandCreate = ApplicationCommandCreateBase & {
858
+ type?: ApplicationCommandType.ChatInput;
859
+ description: string;
860
+ description_localizations?: Localizations | null;
861
+ options?: ApplicationCommandOption[];
862
+ handler?: never;
863
+ };
864
+ type ContextMenuApplicationCommandCreate = ApplicationCommandCreateBase & {
865
+ type: ApplicationCommandType.User | ApplicationCommandType.Message;
866
+ description?: never;
867
+ description_localizations?: never;
868
+ options?: never;
869
+ handler?: never;
870
+ };
871
+ type PrimaryEntryPointApplicationCommandCreate = ApplicationCommandCreateBase & {
872
+ type: ApplicationCommandType.PrimaryEntryPoint;
873
+ description: string;
874
+ description_localizations?: Localizations | null;
875
+ options?: never;
876
+ handler?: EntryPointCommandHandlerType;
877
+ };
878
+ type ApplicationCommandCreate = ChatInputApplicationCommandCreate | ContextMenuApplicationCommandCreate | PrimaryEntryPointApplicationCommandCreate;
879
+ interface ApplicationCommandBase extends ApplicationCommandCreateBase {
880
+ id: Snowflake;
881
+ application_id: Snowflake;
882
+ guild_id?: Snowflake;
883
+ description: string;
884
+ description_localizations?: Localizations | null;
885
+ version: Snowflake;
886
+ name_localized?: string;
887
+ description_localized?: string;
888
+ }
889
+ type ApplicationCommand = (ApplicationCommandBase & {
890
+ type: ApplicationCommandType.ChatInput;
891
+ options?: ApplicationCommandOption[];
892
+ handler?: never;
893
+ }) | (ApplicationCommandBase & {
894
+ type: ApplicationCommandType.User | ApplicationCommandType.Message;
895
+ description: "";
896
+ options?: never;
897
+ handler?: never;
898
+ }) | (ApplicationCommandBase & {
899
+ type: ApplicationCommandType.PrimaryEntryPoint;
900
+ options?: never;
901
+ handler?: EntryPointCommandHandlerType;
902
+ });
903
+ type WithPermissionInput<T> = T extends ApplicationCommandCreate ? Omit<T, "default_member_permissions"> & {
904
+ default_member_permissions?: PermissionInput | null;
905
+ } : never;
906
+ type ApplicationCommandDefinition = WithPermissionInput<ApplicationCommandCreate>;
907
+ interface ApplicationCommandPermission {
908
+ id: Snowflake;
909
+ type: ApplicationCommandPermissionType;
910
+ permission: boolean;
911
+ }
912
+ interface ApplicationCommandPermissions {
913
+ id: Snowflake;
914
+ application_id: Snowflake;
915
+ guild_id: Snowflake;
916
+ permissions: ApplicationCommandPermission[];
917
+ }
918
+ type ApplicationCommandLocalization = Partial<Record<Locale, string>>;
919
+ //#endregion
920
+ //#region packages/types/src/auto-moderation.d.ts
921
+ declare enum AutoModerationRuleEventType {
922
+ MessageSend = 1,
923
+ MemberUpdate = 2
924
+ }
925
+ declare enum AutoModerationRuleTriggerType {
926
+ Keyword = 1,
927
+ Spam = 3,
928
+ KeywordPreset = 4,
929
+ MentionSpam = 5,
930
+ MemberProfile = 6
931
+ }
932
+ declare enum AutoModerationKeywordPresetType {
933
+ Profanity = 1,
934
+ SexualContent = 2,
935
+ Slurs = 3
936
+ }
937
+ declare enum AutoModerationActionType {
938
+ BlockMessage = 1,
939
+ SendAlertMessage = 2,
940
+ Timeout = 3,
941
+ BlockMemberInteraction = 4
942
+ }
943
+ interface AutoModerationRuleTriggerMetadata {
944
+ keyword_filter?: string[];
945
+ regex_patterns?: string[];
946
+ presets?: AutoModerationKeywordPresetType[];
947
+ allow_list?: string[];
948
+ mention_total_limit?: number;
949
+ mention_raid_protection_enabled?: boolean;
950
+ }
951
+ type AutoModerationAction = {
952
+ type: AutoModerationActionType.BlockMessage;
953
+ metadata?: {
954
+ custom_message?: string;
955
+ };
956
+ } | {
957
+ type: AutoModerationActionType.SendAlertMessage;
958
+ metadata: {
959
+ channel_id: Snowflake;
960
+ };
961
+ } | {
962
+ type: AutoModerationActionType.Timeout;
963
+ metadata: {
964
+ duration_seconds: number;
965
+ };
966
+ } | {
967
+ type: AutoModerationActionType.BlockMemberInteraction;
968
+ metadata?: never;
969
+ };
970
+ interface AutoModerationRule {
971
+ id: Snowflake;
972
+ guild_id: Snowflake;
973
+ name: string;
974
+ creator_id: Snowflake;
975
+ event_type: AutoModerationRuleEventType;
976
+ trigger_type: AutoModerationRuleTriggerType;
977
+ trigger_metadata: AutoModerationRuleTriggerMetadata;
978
+ actions: AutoModerationAction[];
979
+ enabled: boolean;
980
+ exempt_roles: Snowflake[];
981
+ exempt_channels: Snowflake[];
982
+ }
983
+ interface AutoModerationRuleCreate {
984
+ name: string;
985
+ event_type: AutoModerationRuleEventType;
986
+ trigger_type: AutoModerationRuleTriggerType;
987
+ trigger_metadata?: AutoModerationRuleTriggerMetadata;
988
+ actions: AutoModerationAction[];
989
+ enabled?: boolean;
990
+ exempt_roles?: Snowflake[];
991
+ exempt_channels?: Snowflake[];
992
+ }
993
+ type AutoModerationRuleModify = Partial<Pick<AutoModerationRule, "name" | "event_type" | "trigger_metadata" | "actions" | "enabled" | "exempt_roles" | "exempt_channels">>;
994
+ //#endregion
995
+ //#region packages/types/src/entitlement.d.ts
996
+ declare enum EntitlementType {
997
+ Purchase = 1,
998
+ PremiumSubscription = 2,
999
+ DeveloperGift = 3,
1000
+ TestModePurchase = 4,
1001
+ FreePurchase = 5,
1002
+ UserGift = 6,
1003
+ PremiumPurchase = 7,
1004
+ ApplicationSubscription = 8
1005
+ }
1006
+ interface Entitlement {
1007
+ id: Snowflake;
1008
+ sku_id: Snowflake;
1009
+ application_id: Snowflake;
1010
+ user_id?: Snowflake;
1011
+ type: EntitlementType;
1012
+ deleted: boolean;
1013
+ starts_at?: ISO8601Timestamp;
1014
+ ends_at?: ISO8601Timestamp;
1015
+ guild_id?: Snowflake;
1016
+ consumed?: boolean;
1017
+ subscription_id?: Snowflake;
1018
+ }
1019
+ //#endregion
1020
+ //#region packages/types/src/message.d.ts
1021
+ declare enum MessageType {
1022
+ Default = 0,
1023
+ RecipientAdd = 1,
1024
+ RecipientRemove = 2,
1025
+ Call = 3,
1026
+ ChannelNameChange = 4,
1027
+ ChannelIconChange = 5,
1028
+ ChannelPinnedMessage = 6,
1029
+ UserJoin = 7,
1030
+ GuildBoost = 8,
1031
+ GuildBoostTier1 = 9,
1032
+ GuildBoostTier2 = 10,
1033
+ GuildBoostTier3 = 11,
1034
+ ChannelFollowAdd = 12,
1035
+ GuildDiscoveryDisqualified = 14,
1036
+ GuildDiscoveryRequalified = 15,
1037
+ GuildDiscoveryGracePeriodInitialWarning = 16,
1038
+ GuildDiscoveryGracePeriodFinalWarning = 17,
1039
+ ThreadCreated = 18,
1040
+ Reply = 19,
1041
+ ChatInputCommand = 20,
1042
+ ThreadStarterMessage = 21,
1043
+ GuildInviteReminder = 22,
1044
+ ContextMenuCommand = 23,
1045
+ AutoModerationAction = 24,
1046
+ RoleSubscriptionPurchase = 25,
1047
+ InteractionPremiumUpsell = 26,
1048
+ StageStart = 27,
1049
+ StageEnd = 28,
1050
+ StageSpeaker = 29,
1051
+ StageTopic = 31,
1052
+ GuildApplicationPremiumSubscription = 32,
1053
+ GuildIncidentAlertModeEnabled = 36,
1054
+ GuildIncidentAlertModeDisabled = 37,
1055
+ GuildIncidentReportRaid = 38,
1056
+ GuildIncidentReportFalseAlarm = 39,
1057
+ PurchaseNotification = 44,
1058
+ PollResult = 46
1059
+ }
1060
+ declare enum MessageReferenceType {
1061
+ Default = 0,
1062
+ Forward = 1
1063
+ }
1064
+ declare enum MessageActivityType {
1065
+ Join = 1,
1066
+ Spectate = 2,
1067
+ Listen = 3,
1068
+ JoinRequest = 5
1069
+ }
1070
+ declare enum ReactionType {
1071
+ Normal = 0,
1072
+ Burst = 1
1073
+ }
1074
+ declare enum AttachmentFlags {
1075
+ IsClip = 1,
1076
+ IsThumbnail = 2,
1077
+ IsRemix = 4,
1078
+ IsSpoiler = 8,
1079
+ IsAnimated = 32
1080
+ }
1081
+ declare enum EmbedFlags {
1082
+ IsContentInventoryEntry = 32
1083
+ }
1084
+ declare enum BaseThemeType {
1085
+ Unset = 0,
1086
+ Dark = 1,
1087
+ Light = 2,
1088
+ Darker = 3,
1089
+ Midnight = 4
1090
+ }
1091
+ declare enum PollLayoutType {
1092
+ Default = 1
1093
+ }
1094
+ declare enum MessageFlags {
1095
+ Crossposted = 1,
1096
+ IsCrosspost = 2,
1097
+ SuppressEmbeds = 4,
1098
+ SourceMessageDeleted = 8,
1099
+ Urgent = 16,
1100
+ HasThread = 32,
1101
+ Ephemeral = 64,
1102
+ Loading = 128,
1103
+ FailedToMentionSomeRolesInThread = 256,
1104
+ SuppressNotifications = 4096,
1105
+ IsVoiceMessage = 8192,
1106
+ HasSnapshot = 16384,
1107
+ IsComponentsV2 = 32768
1108
+ }
1109
+ declare enum ComponentType {
1110
+ ActionRow = 1,
1111
+ Button = 2,
1112
+ StringSelect = 3,
1113
+ TextInput = 4,
1114
+ UserSelect = 5,
1115
+ RoleSelect = 6,
1116
+ MentionableSelect = 7,
1117
+ ChannelSelect = 8,
1118
+ Section = 9,
1119
+ TextDisplay = 10,
1120
+ Thumbnail = 11,
1121
+ MediaGallery = 12,
1122
+ File = 13,
1123
+ Separator = 14,
1124
+ Container = 17,
1125
+ Label = 18,
1126
+ FileUpload = 19,
1127
+ RadioGroup = 21,
1128
+ CheckboxGroup = 22,
1129
+ Checkbox = 23
1130
+ }
1131
+ declare enum ButtonStyle {
1132
+ Primary = 1,
1133
+ Secondary = 2,
1134
+ Success = 3,
1135
+ Danger = 4,
1136
+ Link = 5,
1137
+ Premium = 6
1138
+ }
1139
+ declare enum TextInputStyle {
1140
+ Short = 1,
1141
+ Paragraph = 2
1142
+ }
1143
+ interface EmbedMedia {
1144
+ url: string;
1145
+ proxy_url?: string;
1146
+ height?: number;
1147
+ width?: number;
1148
+ content_type?: string;
1149
+ placeholder?: string;
1150
+ placeholder_version?: number;
1151
+ description?: string;
1152
+ flags?: number;
1153
+ }
1154
+ interface EmbedVideo extends Omit<EmbedMedia, "url"> {
1155
+ url?: string;
1156
+ }
1157
+ interface Embed {
1158
+ title?: string;
1159
+ type?: string;
1160
+ description?: string;
1161
+ url?: string;
1162
+ timestamp?: string;
1163
+ color?: number;
1164
+ footer?: {
1165
+ text: string;
1166
+ icon_url?: string;
1167
+ proxy_icon_url?: string;
1168
+ };
1169
+ image?: EmbedMedia;
1170
+ thumbnail?: EmbedMedia;
1171
+ video?: EmbedVideo;
1172
+ provider?: {
1173
+ name?: string;
1174
+ url?: string;
1175
+ };
1176
+ author?: {
1177
+ name: string;
1178
+ url?: string;
1179
+ icon_url?: string;
1180
+ proxy_icon_url?: string;
1181
+ };
1182
+ fields?: Array<{
1183
+ name: string;
1184
+ value: string;
1185
+ inline?: boolean;
1186
+ }>;
1187
+ flags?: number;
1188
+ }
1189
+ interface Attachment {
1190
+ id: Snowflake;
1191
+ filename: string;
1192
+ title?: string;
1193
+ description?: string;
1194
+ content_type?: string;
1195
+ size: number;
1196
+ url: string;
1197
+ proxy_url: string;
1198
+ height?: number | null;
1199
+ width?: number | null;
1200
+ ephemeral?: boolean;
1201
+ duration_secs?: number;
1202
+ waveform?: string;
1203
+ flags?: number;
1204
+ placeholder?: string;
1205
+ placeholder_version?: number;
1206
+ clip_participants?: User$1[];
1207
+ clip_created_at?: ISO8601Timestamp;
1208
+ application?: Partial<Application> | null;
1209
+ }
1210
+ interface AttachmentRequest {
1211
+ id: Snowflake | number;
1212
+ filename?: string;
1213
+ title?: string;
1214
+ description?: string;
1215
+ duration_secs?: number;
1216
+ waveform?: string;
1217
+ is_spoiler?: boolean;
1218
+ }
1219
+ interface ChannelMention {
1220
+ id: Snowflake;
1221
+ guild_id: Snowflake;
1222
+ type: ChannelType;
1223
+ name: string;
1224
+ }
1225
+ interface Reaction {
1226
+ count: number;
1227
+ count_details: {
1228
+ burst: number;
1229
+ normal: number;
1230
+ };
1231
+ me: boolean;
1232
+ me_burst: boolean;
1233
+ emoji: Pick<Emoji, "id" | "name" | "animated">;
1234
+ burst_colors: string[];
1235
+ }
1236
+ type AllowedMentionType = "roles" | "users" | "everyone";
1237
+ interface AllowedMentions {
1238
+ parse?: readonly AllowedMentionType[];
1239
+ roles?: readonly Snowflake[];
1240
+ users?: readonly Snowflake[];
1241
+ replied_user?: boolean;
1242
+ }
1243
+ interface MessageReference {
1244
+ type?: MessageReferenceType;
1245
+ message_id?: Snowflake;
1246
+ channel_id?: Snowflake;
1247
+ guild_id?: Snowflake;
1248
+ fail_if_not_exists?: boolean;
1249
+ }
1250
+ interface MessageActivity {
1251
+ type: MessageActivityType;
1252
+ party_id?: string;
1253
+ }
1254
+ interface RoleSubscriptionData {
1255
+ role_subscription_listing_id: Snowflake;
1256
+ tier_name: string;
1257
+ total_months_subscribed: number;
1258
+ is_renewal: boolean;
1259
+ }
1260
+ interface SharedClientTheme {
1261
+ colors: string[];
1262
+ gradient_angle: number;
1263
+ base_mix: number;
1264
+ base_theme?: BaseThemeType | null;
1265
+ }
1266
+ interface SelectOption {
1267
+ label: string;
1268
+ value: string;
1269
+ description?: string;
1270
+ emoji?: ComponentEmoji;
1271
+ default?: boolean;
1272
+ }
1273
+ type ComponentEmoji = {
1274
+ id: Snowflake;
1275
+ name?: string;
1276
+ animated?: boolean;
1277
+ } | {
1278
+ id?: null;
1279
+ name: string;
1280
+ animated?: boolean;
1281
+ };
1282
+ interface ComponentBase<T extends ComponentType> {
1283
+ type: T;
1284
+ id?: number;
1285
+ }
1286
+ interface ButtonComponentBase extends ComponentBase<ComponentType.Button> {
1287
+ label?: string;
1288
+ emoji?: ComponentEmoji;
1289
+ disabled?: boolean;
1290
+ }
1291
+ type ButtonComponent = (ButtonComponentBase & {
1292
+ style: ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger;
1293
+ custom_id: string;
1294
+ sku_id?: never;
1295
+ url?: never;
1296
+ }) | (ButtonComponentBase & {
1297
+ style: ButtonStyle.Link;
1298
+ url: string;
1299
+ custom_id?: never;
1300
+ sku_id?: never;
1301
+ }) | (Omit<ButtonComponentBase, "emoji" | "label"> & {
1302
+ style: ButtonStyle.Premium;
1303
+ sku_id: Snowflake;
1304
+ custom_id?: never;
1305
+ emoji?: never;
1306
+ label?: never;
1307
+ url?: never;
1308
+ });
1309
+ interface StringSelectComponent extends ComponentBase<ComponentType.StringSelect> {
1310
+ custom_id: string;
1311
+ options: SelectOption[];
1312
+ placeholder?: string;
1313
+ min_values?: number;
1314
+ max_values?: number;
1315
+ disabled?: boolean;
1316
+ required?: boolean;
1317
+ }
1318
+ interface AutoSelectComponentBase<T extends ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect> extends ComponentBase<T> {
1319
+ custom_id: string;
1320
+ placeholder?: string;
1321
+ min_values?: number;
1322
+ max_values?: number;
1323
+ disabled?: boolean;
1324
+ required?: boolean;
1325
+ }
1326
+ type UserSelectComponent = AutoSelectComponentBase<ComponentType.UserSelect> & {
1327
+ default_values?: Array<{
1328
+ id: Snowflake;
1329
+ type: "user";
1330
+ }>;
1331
+ channel_types?: never;
1332
+ };
1333
+ type RoleSelectComponent = AutoSelectComponentBase<ComponentType.RoleSelect> & {
1334
+ default_values?: Array<{
1335
+ id: Snowflake;
1336
+ type: "role";
1337
+ }>;
1338
+ channel_types?: never;
1339
+ };
1340
+ type MentionableSelectComponent = AutoSelectComponentBase<ComponentType.MentionableSelect> & {
1341
+ default_values?: Array<{
1342
+ id: Snowflake;
1343
+ type: "user" | "role";
1344
+ }>;
1345
+ channel_types?: never;
1346
+ };
1347
+ type ChannelSelectComponent = AutoSelectComponentBase<ComponentType.ChannelSelect> & {
1348
+ default_values?: Array<{
1349
+ id: Snowflake;
1350
+ type: "channel";
1351
+ }>;
1352
+ channel_types?: ChannelType[];
1353
+ };
1354
+ type AutoSelectComponent = UserSelectComponent | RoleSelectComponent | MentionableSelectComponent | ChannelSelectComponent;
1355
+ type MessageStringSelectComponent = Omit<StringSelectComponent, "required"> & {
1356
+ required?: never;
1357
+ };
1358
+ type ModalStringSelectComponent = Omit<StringSelectComponent, "disabled"> & {
1359
+ disabled?: never;
1360
+ };
1361
+ type MessageAutoSelectOf<T> = T extends AutoSelectComponent ? Omit<T, "required"> & {
1362
+ required?: never;
1363
+ } : never;
1364
+ type ModalAutoSelectOf<T> = T extends AutoSelectComponent ? Omit<T, "disabled"> & {
1365
+ disabled?: never;
1366
+ } : never;
1367
+ type MessageAutoSelectComponent = MessageAutoSelectOf<AutoSelectComponent>;
1368
+ type ModalAutoSelectComponent = ModalAutoSelectOf<AutoSelectComponent>;
1369
+ interface TextInputComponent extends ComponentBase<ComponentType.TextInput> {
1370
+ custom_id: string;
1371
+ style: TextInputStyle;
1372
+ label?: string;
1373
+ min_length?: number;
1374
+ max_length?: number;
1375
+ required?: boolean;
1376
+ value?: string;
1377
+ placeholder?: string;
1378
+ }
1379
+ type MessageActionRowComponent = ComponentBase<ComponentType.ActionRow> & ({
1380
+ components: ButtonComponent[];
1381
+ } | {
1382
+ components: [MessageStringSelectComponent | MessageAutoSelectComponent];
1383
+ });
1384
+ type ModalActionRowComponent = ComponentBase<ComponentType.ActionRow> & {
1385
+ components: [TextInputComponent];
1386
+ };
1387
+ type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
1388
+ interface TextDisplayComponent extends ComponentBase<ComponentType.TextDisplay> {
1389
+ content: string;
1390
+ }
1391
+ interface UnfurledMediaItem {
1392
+ url: string;
1393
+ proxy_url?: string;
1394
+ height?: number | null;
1395
+ width?: number | null;
1396
+ content_type?: string;
1397
+ attachment_id?: Snowflake;
1398
+ }
1399
+ interface ThumbnailComponent extends ComponentBase<ComponentType.Thumbnail> {
1400
+ media: UnfurledMediaItem;
1401
+ description?: string | null;
1402
+ spoiler?: boolean;
1403
+ }
1404
+ interface SectionComponent extends ComponentBase<ComponentType.Section> {
1405
+ components: TextDisplayComponent[];
1406
+ accessory: ThumbnailComponent | ButtonComponent;
1407
+ }
1408
+ interface MediaGalleryComponent extends ComponentBase<ComponentType.MediaGallery> {
1409
+ items: Array<{
1410
+ media: UnfurledMediaItem;
1411
+ description?: string | null;
1412
+ spoiler?: boolean;
1413
+ }>;
1414
+ }
1415
+ interface FileComponent extends ComponentBase<ComponentType.File> {
1416
+ file: UnfurledMediaItem;
1417
+ spoiler?: boolean;
1418
+ name?: string;
1419
+ size?: number;
1420
+ }
1421
+ interface SeparatorComponent extends ComponentBase<ComponentType.Separator> {
1422
+ divider?: boolean;
1423
+ spacing?: 1 | 2;
1424
+ }
1425
+ interface ContainerComponent extends ComponentBase<ComponentType.Container> {
1426
+ components: Array<MessageActionRowComponent | TextDisplayComponent | SectionComponent | MediaGalleryComponent | FileComponent | SeparatorComponent>;
1427
+ accent_color?: number | null;
1428
+ spoiler?: boolean;
1429
+ }
1430
+ interface LabelComponent extends ComponentBase<ComponentType.Label> {
1431
+ label: string;
1432
+ description?: string;
1433
+ component: ModalStringSelectComponent | ModalAutoSelectComponent | TextInputComponent | FileUploadComponent | RadioGroupComponent | CheckboxGroupComponent | CheckboxComponent;
1434
+ }
1435
+ interface FileUploadComponent extends ComponentBase<ComponentType.FileUpload> {
1436
+ custom_id: string;
1437
+ min_values?: number;
1438
+ max_values?: number;
1439
+ required?: boolean;
1440
+ }
1441
+ interface RadioGroupComponent extends ComponentBase<ComponentType.RadioGroup> {
1442
+ custom_id: string;
1443
+ options: RadioGroupOption[];
1444
+ required?: boolean;
1445
+ }
1446
+ interface RadioGroupOption {
1447
+ value: string;
1448
+ label: string;
1449
+ description?: string;
1450
+ default?: boolean;
1451
+ }
1452
+ interface CheckboxGroupComponent extends ComponentBase<ComponentType.CheckboxGroup> {
1453
+ custom_id: string;
1454
+ options: CheckboxGroupOption[];
1455
+ min_values?: number;
1456
+ max_values?: number;
1457
+ required?: boolean;
1458
+ }
1459
+ interface CheckboxGroupOption {
1460
+ value: string;
1461
+ label: string;
1462
+ description?: string;
1463
+ default?: boolean;
1464
+ }
1465
+ interface CheckboxComponent extends ComponentBase<ComponentType.Checkbox> {
1466
+ custom_id: string;
1467
+ default?: boolean;
1468
+ }
1469
+ type MessageComponent = MessageActionRowComponent | SectionComponent | TextDisplayComponent | MediaGalleryComponent | FileComponent | SeparatorComponent | ContainerComponent;
1470
+ type ModalComponent = ModalActionRowComponent | LabelComponent | TextDisplayComponent;
1471
+ interface TextInputInteractionResponse {
1472
+ type: ComponentType.TextInput;
1473
+ id: number;
1474
+ custom_id: string;
1475
+ value: string;
1476
+ }
1477
+ interface StringSelectInteractionResponse {
1478
+ type: ComponentType.StringSelect;
1479
+ id: number;
1480
+ custom_id: string;
1481
+ values: string[];
1482
+ }
1483
+ interface AutoSelectInteractionResponse {
1484
+ type: ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect;
1485
+ id: number;
1486
+ custom_id: string;
1487
+ values: Snowflake[];
1488
+ resolved: ResolvedData;
1489
+ }
1490
+ interface FileUploadInteractionResponse {
1491
+ type: ComponentType.FileUpload;
1492
+ id: number;
1493
+ custom_id: string;
1494
+ values: Snowflake[];
1495
+ }
1496
+ interface RadioGroupInteractionResponse {
1497
+ type: ComponentType.RadioGroup;
1498
+ id: number;
1499
+ custom_id: string;
1500
+ value: string | null;
1501
+ }
1502
+ interface CheckboxGroupInteractionResponse {
1503
+ type: ComponentType.CheckboxGroup;
1504
+ id: number;
1505
+ custom_id: string;
1506
+ values: string[];
1507
+ }
1508
+ interface CheckboxInteractionResponse {
1509
+ type: ComponentType.Checkbox;
1510
+ id: number;
1511
+ custom_id: string;
1512
+ value: boolean;
1513
+ }
1514
+ type LabelInteractionResponseChild = TextInputInteractionResponse | StringSelectInteractionResponse | AutoSelectInteractionResponse | FileUploadInteractionResponse | RadioGroupInteractionResponse | CheckboxGroupInteractionResponse | CheckboxInteractionResponse;
1515
+ interface LabelInteractionResponse {
1516
+ type: ComponentType.Label;
1517
+ id: number;
1518
+ component: LabelInteractionResponseChild;
1519
+ }
1520
+ interface TextDisplayInteractionResponse {
1521
+ type: ComponentType.TextDisplay;
1522
+ id: number;
1523
+ }
1524
+ interface ActionRowInteractionResponse {
1525
+ type: ComponentType.ActionRow;
1526
+ id: number;
1527
+ components: [TextInputInteractionResponse];
1528
+ }
1529
+ type ModalSubmitComponent = ActionRowInteractionResponse | LabelInteractionResponse | TextDisplayInteractionResponse;
1530
+ interface Poll {
1531
+ question: {
1532
+ text: string;
1533
+ };
1534
+ answers: Array<{
1535
+ answer_id: number;
1536
+ poll_media: {
1537
+ text?: string;
1538
+ emoji?: ComponentEmoji;
1539
+ };
1540
+ }>;
1541
+ expiry: ISO8601Timestamp | null;
1542
+ allow_multiselect: boolean;
1543
+ layout_type: PollLayoutType;
1544
+ results?: {
1545
+ is_finalized: boolean;
1546
+ answer_counts: Array<{
1547
+ id: number;
1548
+ count: number;
1549
+ me_voted: boolean;
1550
+ }>;
1551
+ };
1552
+ }
1553
+ interface PollCreate {
1554
+ question: {
1555
+ text: string;
1556
+ };
1557
+ answers: Array<{
1558
+ poll_media: {
1559
+ text?: string;
1560
+ emoji?: ComponentEmoji;
1561
+ };
1562
+ }>;
1563
+ duration?: number;
1564
+ allow_multiselect?: boolean;
1565
+ layout_type?: PollLayoutType.Default;
1566
+ }
1567
+ interface MessageInteractionMetadataBase {
1568
+ id: Snowflake;
1569
+ type: InteractionType;
1570
+ user: User$1;
1571
+ authorizing_integration_owners: Record<string, Snowflake>;
1572
+ original_response_message_id?: Snowflake;
1573
+ }
1574
+ interface ApplicationCommandMessageInteractionMetadata extends MessageInteractionMetadataBase {
1575
+ type: InteractionType.ApplicationCommand;
1576
+ target_user?: User$1;
1577
+ target_message_id?: Snowflake;
1578
+ }
1579
+ interface MessageComponentMessageInteractionMetadata extends MessageInteractionMetadataBase {
1580
+ type: InteractionType.MessageComponent;
1581
+ interacted_message_id: Snowflake;
1582
+ }
1583
+ interface ModalSubmitMessageInteractionMetadata extends MessageInteractionMetadataBase {
1584
+ type: InteractionType.ModalSubmit;
1585
+ triggering_interaction_metadata: ApplicationCommandMessageInteractionMetadata | MessageComponentMessageInteractionMetadata;
1586
+ }
1587
+ type MessageInteractionMetadata = ApplicationCommandMessageInteractionMetadata | MessageComponentMessageInteractionMetadata | ModalSubmitMessageInteractionMetadata;
1588
+ interface MessageInteraction {
1589
+ id: Snowflake;
1590
+ type: InteractionType;
1591
+ name: string;
1592
+ user: User$1;
1593
+ member?: Partial<Omit<GuildMember$1, "user">>;
1594
+ }
1595
+ interface MessageCall {
1596
+ participants: Snowflake[];
1597
+ ended_timestamp?: ISO8601Timestamp | null;
1598
+ }
1599
+ interface MessageSnapshot {
1600
+ message: Partial<Pick<Message$1, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles" | "stickers" | "sticker_items" | "components">>;
1601
+ }
1602
+ interface Message$1 {
1603
+ id: Snowflake;
1604
+ channel_id: Snowflake;
1605
+ guild_id?: Snowflake;
1606
+ author: User$1;
1607
+ member?: GuildMember$1;
1608
+ content: string;
1609
+ timestamp: ISO8601Timestamp;
1610
+ edited_timestamp: ISO8601Timestamp | null;
1611
+ tts: boolean;
1612
+ mention_everyone: boolean;
1613
+ mentions: Array<User$1 & {
1614
+ member?: Omit<GuildMember$1, "user">;
1615
+ }>;
1616
+ mention_roles: Snowflake[];
1617
+ mention_channels?: ChannelMention[];
1618
+ attachments: Attachment[];
1619
+ embeds: Embed[];
1620
+ reactions?: Reaction[];
1621
+ nonce?: string | number;
1622
+ pinned: boolean;
1623
+ webhook_id?: Snowflake;
1624
+ type: MessageType;
1625
+ activity?: MessageActivity;
1626
+ application?: Partial<Application>;
1627
+ application_id?: Snowflake;
1628
+ message_reference?: MessageReference;
1629
+ flags?: number;
1630
+ message_snapshots?: MessageSnapshot[];
1631
+ referenced_message?: Message$1 | null;
1632
+ interaction_metadata?: MessageInteractionMetadata;
1633
+ interaction?: MessageInteraction;
1634
+ thread?: Channel$1;
1635
+ components?: MessageComponent[];
1636
+ sticker_items?: StickerItem[];
1637
+ stickers?: Sticker[];
1638
+ position?: number;
1639
+ role_subscription_data?: RoleSubscriptionData;
1640
+ resolved?: ResolvedData;
1641
+ poll?: Poll;
1642
+ call?: MessageCall;
1643
+ shared_client_theme?: SharedClientTheme;
1644
+ channel_type?: ChannelType;
1645
+ }
1646
+ interface ResolvedData {
1647
+ users?: Record<Snowflake, User$1>;
1648
+ members?: Record<Snowflake, Omit<GuildMember$1, "user" | "deaf" | "mute">>;
1649
+ roles?: Record<Snowflake, Role$1>;
1650
+ channels?: Record<Snowflake, ResolvedChannel$1>;
1651
+ messages?: Record<Snowflake, Partial<Message$1>>;
1652
+ attachments?: Record<Snowflake, Attachment>;
1653
+ }
1654
+ type ResolvedChannel$1 = Pick<Channel$1, "id" | "type"> & Partial<Pick<Channel$1, "name" | "permissions" | "app_permissions" | "last_message_id" | "last_pin_timestamp" | "nsfw" | "parent_id" | "guild_id" | "flags" | "rate_limit_per_user" | "topic" | "position" | "thread_metadata">>;
1655
+ interface FileUpload {
1656
+ data: Blob | ArrayBuffer | ArrayBufferView;
1657
+ name: string;
1658
+ description?: string;
1659
+ }
1660
+ interface MessageCreate {
1661
+ content?: string;
1662
+ nonce?: string | number;
1663
+ tts?: boolean;
1664
+ embeds?: Embed[];
1665
+ allowed_mentions?: AllowedMentions;
1666
+ message_reference?: MessageReference;
1667
+ components?: MessageComponent[];
1668
+ sticker_ids?: Snowflake[];
1669
+ files?: FileUpload[];
1670
+ attachments?: AttachmentRequest[];
1671
+ flags?: number;
1672
+ enforce_nonce?: boolean;
1673
+ poll?: PollCreate;
1674
+ shared_client_theme?: SharedClientTheme;
1675
+ }
1676
+ interface MessageEdit {
1677
+ content?: string | null;
1678
+ embeds?: Embed[] | null;
1679
+ flags?: number;
1680
+ allowed_mentions?: AllowedMentions | null;
1681
+ components?: MessageComponent[] | null;
1682
+ files?: FileUpload[];
1683
+ attachments?: AttachmentRequest[];
1684
+ }
1685
+ //#endregion
1686
+ //#region packages/types/src/interaction.d.ts
1687
+ declare enum InteractionType {
1688
+ Ping = 1,
1689
+ ApplicationCommand = 2,
1690
+ MessageComponent = 3,
1691
+ ApplicationCommandAutocomplete = 4,
1692
+ ModalSubmit = 5
1693
+ }
1694
+ declare enum InteractionCallbackType {
1695
+ Pong = 1,
1696
+ ChannelMessageWithSource = 4,
1697
+ DeferredChannelMessageWithSource = 5,
1698
+ DeferredUpdateMessage = 6,
1699
+ UpdateMessage = 7,
1700
+ ApplicationCommandAutocompleteResult = 8,
1701
+ Modal = 9,
1702
+ PremiumRequired = 10,
1703
+ LaunchActivity = 12
1704
+ }
1705
+ interface ApplicationCommandInteractionOption {
1706
+ name: string;
1707
+ type: ApplicationCommandOptionType;
1708
+ value?: string | number | boolean;
1709
+ options?: ApplicationCommandInteractionOption[];
1710
+ focused?: boolean;
1711
+ }
1712
+ interface ApplicationCommandInteractionData {
1713
+ id: Snowflake;
1714
+ name: string;
1715
+ type: ApplicationCommandType;
1716
+ resolved?: ResolvedData;
1717
+ options?: ApplicationCommandInteractionOption[];
1718
+ guild_id?: Snowflake;
1719
+ target_id?: Snowflake;
1720
+ }
1721
+ type MessageComponentType = ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect;
1722
+ interface MessageComponentInteractionData {
1723
+ custom_id: string;
1724
+ component_type: MessageComponentType;
1725
+ id?: number;
1726
+ values?: string[];
1727
+ resolved?: ResolvedData;
1728
+ }
1729
+ interface ModalSubmitInteractionData {
1730
+ custom_id: string;
1731
+ components: ModalSubmitComponent[];
1732
+ resolved?: ResolvedData;
1733
+ }
1734
+ type InteractionData = ApplicationCommandInteractionData | MessageComponentInteractionData | ModalSubmitInteractionData;
1735
+ /** An interaction received from the gateway or an HTTP endpoint. */
1736
+ interface InteractionBase {
1737
+ id: Snowflake;
1738
+ application_id: Snowflake;
1739
+ guild?: {
1740
+ id: Snowflake;
1741
+ locale?: Locale;
1742
+ features?: string[];
1743
+ };
1744
+ guild_id?: Snowflake;
1745
+ channel?: ResolvedChannel$1;
1746
+ channel_id?: Snowflake;
1747
+ member?: GuildMember$1;
1748
+ user?: User$1;
1749
+ token: string;
1750
+ version: 1;
1751
+ message?: Message$1;
1752
+ app_permissions?: BitfieldString;
1753
+ locale?: Locale;
1754
+ guild_locale?: Locale;
1755
+ entitlements: Entitlement[];
1756
+ authorizing_integration_owners: Partial<Record<`${ApplicationIntegrationType}`, Snowflake>>;
1757
+ context?: InteractionContextType;
1758
+ attachment_size_limit: number;
1759
+ }
1760
+ interface InteractionResponseData extends Pick<MessageCreate, "tts" | "content" | "embeds" | "allowed_mentions" | "flags" | "attachments" | "poll"> {
1761
+ components?: MessageCreate["components"];
1762
+ files?: MessageCreate["files"];
1763
+ }
1764
+ interface AutocompleteInteractionResponseData {
1765
+ choices: ApplicationCommandChoice[];
1766
+ }
1767
+ interface ModalInteractionResponseData {
1768
+ custom_id: string;
1769
+ title: string;
1770
+ components: ModalComponent[];
1771
+ }
1772
+ type InteractionResponse = {
1773
+ type: InteractionCallbackType.Pong | InteractionCallbackType.DeferredUpdateMessage | InteractionCallbackType.PremiumRequired | InteractionCallbackType.LaunchActivity;
1774
+ data?: never;
1775
+ } | {
1776
+ type: InteractionCallbackType.ChannelMessageWithSource | InteractionCallbackType.UpdateMessage;
1777
+ data?: InteractionResponseData;
1778
+ } | {
1779
+ type: InteractionCallbackType.DeferredChannelMessageWithSource;
1780
+ data?: Pick<InteractionResponseData, "flags">;
1781
+ } | {
1782
+ type: InteractionCallbackType.ApplicationCommandAutocompleteResult;
1783
+ data: AutocompleteInteractionResponseData;
1784
+ } | {
1785
+ type: InteractionCallbackType.Modal;
1786
+ data: ModalInteractionResponseData;
1787
+ };
1788
+ interface InteractionCallback {
1789
+ id: Snowflake;
1790
+ type: InteractionType;
1791
+ activity_instance_id?: string;
1792
+ response_message_id?: Snowflake;
1793
+ response_message_loading?: boolean;
1794
+ response_message_ephemeral?: boolean;
1795
+ }
1796
+ interface InteractionCallbackResource {
1797
+ type: InteractionCallbackType;
1798
+ activity_instance?: {
1799
+ id: string;
1800
+ };
1801
+ message?: Message$1;
1802
+ }
1803
+ interface InteractionCallbackResponse {
1804
+ interaction: InteractionCallback;
1805
+ resource?: InteractionCallbackResource;
1806
+ }
1807
+ type PingInteraction = InteractionBase & {
1808
+ type: InteractionType.Ping;
1809
+ data?: never;
1810
+ };
1811
+ type ApplicationCommandInteraction = InteractionBase & {
1812
+ type: InteractionType.ApplicationCommand;
1813
+ data: ApplicationCommandInteractionData;
1814
+ };
1815
+ type AutocompleteInteraction = InteractionBase & {
1816
+ type: InteractionType.ApplicationCommandAutocomplete;
1817
+ data: ApplicationCommandInteractionData;
1818
+ };
1819
+ type MessageComponentInteraction = InteractionBase & {
1820
+ type: InteractionType.MessageComponent;
1821
+ data: MessageComponentInteractionData;
1822
+ };
1823
+ type ModalSubmitInteraction = InteractionBase & {
1824
+ type: InteractionType.ModalSubmit;
1825
+ data: ModalSubmitInteractionData;
1826
+ };
1827
+ type Interaction$1 = PingInteraction | ApplicationCommandInteraction | AutocompleteInteraction | MessageComponentInteraction | ModalSubmitInteraction;
1828
+ //#endregion
1829
+ //#region packages/types/src/scheduled-event.d.ts
1830
+ declare enum GuildScheduledEventPrivacyLevel {
1831
+ GuildOnly = 2
1832
+ }
1833
+ declare enum GuildScheduledEventEntityType {
1834
+ StageInstance = 1,
1835
+ Voice = 2,
1836
+ External = 3
1837
+ }
1838
+ declare enum GuildScheduledEventStatus {
1839
+ Scheduled = 1,
1840
+ Active = 2,
1841
+ Completed = 3,
1842
+ Canceled = 4
1843
+ }
1844
+ declare enum GuildScheduledEventRecurrenceFrequency {
1845
+ Yearly = 0,
1846
+ Monthly = 1,
1847
+ Weekly = 2,
1848
+ Daily = 3
1849
+ }
1850
+ declare enum GuildScheduledEventRecurrenceWeekday {
1851
+ Monday = 0,
1852
+ Tuesday = 1,
1853
+ Wednesday = 2,
1854
+ Thursday = 3,
1855
+ Friday = 4,
1856
+ Saturday = 5,
1857
+ Sunday = 6
1858
+ }
1859
+ declare enum GuildScheduledEventRecurrenceMonth {
1860
+ January = 1,
1861
+ February = 2,
1862
+ March = 3,
1863
+ April = 4,
1864
+ May = 5,
1865
+ June = 6,
1866
+ July = 7,
1867
+ August = 8,
1868
+ September = 9,
1869
+ October = 10,
1870
+ November = 11,
1871
+ December = 12
1872
+ }
1873
+ interface GuildScheduledEventRecurrenceNWeekday {
1874
+ n: number;
1875
+ day: GuildScheduledEventRecurrenceWeekday;
1876
+ }
1877
+ interface GuildScheduledEventRecurrenceRule {
1878
+ start: ISO8601Timestamp;
1879
+ end: ISO8601Timestamp | null;
1880
+ frequency: GuildScheduledEventRecurrenceFrequency;
1881
+ interval: number;
1882
+ by_weekday: GuildScheduledEventRecurrenceWeekday[] | null;
1883
+ by_n_weekday: GuildScheduledEventRecurrenceNWeekday[] | null;
1884
+ by_month: GuildScheduledEventRecurrenceMonth[] | null;
1885
+ by_month_day: number[] | null;
1886
+ by_year_day: number[] | null;
1887
+ count: number | null;
1888
+ }
1889
+ interface GuildScheduledEventRecurrenceRuleCreate {
1890
+ start: ISO8601Timestamp;
1891
+ frequency: GuildScheduledEventRecurrenceFrequency;
1892
+ interval: number;
1893
+ by_weekday?: GuildScheduledEventRecurrenceWeekday[];
1894
+ by_n_weekday?: GuildScheduledEventRecurrenceNWeekday[];
1895
+ by_month?: GuildScheduledEventRecurrenceMonth[];
1896
+ by_month_day?: number[];
1897
+ }
1898
+ interface GuildScheduledEventBase {
1899
+ id: Snowflake;
1900
+ guild_id: Snowflake;
1901
+ creator_id?: Snowflake | null;
1902
+ name: string;
1903
+ description?: string | null;
1904
+ scheduled_start_time: ISO8601Timestamp;
1905
+ privacy_level: GuildScheduledEventPrivacyLevel;
1906
+ status: GuildScheduledEventStatus;
1907
+ entity_id: Snowflake | null;
1908
+ creator?: User$1;
1909
+ user_count?: number;
1910
+ image?: string | null;
1911
+ recurrence_rule: GuildScheduledEventRecurrenceRule | null;
1912
+ }
1913
+ type GuildScheduledEvent = (GuildScheduledEventBase & {
1914
+ entity_type: GuildScheduledEventEntityType.StageInstance | GuildScheduledEventEntityType.Voice;
1915
+ channel_id: Snowflake;
1916
+ entity_metadata: null;
1917
+ scheduled_end_time: ISO8601Timestamp | null;
1918
+ }) | (GuildScheduledEventBase & {
1919
+ entity_type: GuildScheduledEventEntityType.External;
1920
+ channel_id: null;
1921
+ entity_metadata: {
1922
+ location: string;
1923
+ };
1924
+ scheduled_end_time: ISO8601Timestamp;
1925
+ });
1926
+ interface GuildScheduledEventCreateBase {
1927
+ name: string;
1928
+ privacy_level: GuildScheduledEventPrivacyLevel;
1929
+ scheduled_start_time: ISO8601Timestamp;
1930
+ description?: string;
1931
+ image?: string;
1932
+ recurrence_rule?: GuildScheduledEventRecurrenceRuleCreate;
1933
+ }
1934
+ type GuildScheduledEventCreate = (GuildScheduledEventCreateBase & {
1935
+ entity_type: GuildScheduledEventEntityType.StageInstance | GuildScheduledEventEntityType.Voice;
1936
+ channel_id: Snowflake;
1937
+ entity_metadata?: never;
1938
+ scheduled_end_time?: ISO8601Timestamp;
1939
+ }) | (GuildScheduledEventCreateBase & {
1940
+ entity_type: GuildScheduledEventEntityType.External;
1941
+ channel_id?: null;
1942
+ entity_metadata: {
1943
+ location: string;
1944
+ };
1945
+ scheduled_end_time: ISO8601Timestamp;
1946
+ });
1947
+ interface GuildScheduledEventModify {
1948
+ channel_id?: Snowflake | null;
1949
+ entity_metadata?: {
1950
+ location?: string;
1951
+ } | null;
1952
+ name?: string;
1953
+ privacy_level?: GuildScheduledEventPrivacyLevel;
1954
+ scheduled_start_time?: ISO8601Timestamp;
1955
+ scheduled_end_time?: ISO8601Timestamp;
1956
+ description?: string | null;
1957
+ entity_type?: GuildScheduledEventEntityType;
1958
+ status?: GuildScheduledEventStatus;
1959
+ image?: string | null;
1960
+ recurrence_rule?: GuildScheduledEventRecurrenceRuleCreate | null;
1961
+ }
1962
+ interface GuildScheduledEventUser {
1963
+ guild_scheduled_event_id: Snowflake;
1964
+ user: User$1;
1965
+ member?: GuildMember$1;
1966
+ }
1967
+ interface GuildScheduledEventUserEvent {
1968
+ guild_scheduled_event_id: Snowflake;
1969
+ user_id: Snowflake;
1970
+ guild_id: Snowflake;
1971
+ }
1972
+ //#endregion
1973
+ //#region packages/types/src/invite.d.ts
1974
+ declare enum InviteType {
1975
+ Guild = 0,
1976
+ GroupDM = 1,
1977
+ Friend = 2
1978
+ }
1979
+ declare enum InviteTargetType {
1980
+ Stream = 1,
1981
+ EmbeddedApplication = 2
1982
+ }
1983
+ declare enum InviteFlags {
1984
+ IsGuestInvite = 1
1985
+ }
1986
+ type InviteGuild = Pick<Guild$1, "id" | "name" | "icon" | "splash" | "banner" | "description" | "features" | "verification_level" | "vanity_url_code" | "nsfw_level" | "premium_subscription_count">;
1987
+ interface InviteChannel {
1988
+ id: Snowflake;
1989
+ name: string | null;
1990
+ type: ChannelType;
1991
+ }
1992
+ type InviteTargetApplication = Pick<Application, "id" | "name" | "icon" | "description">;
1993
+ type InviteRole = Pick<Role$1, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">;
1994
+ interface Invite {
1995
+ type: InviteType;
1996
+ code: string;
1997
+ guild?: InviteGuild;
1998
+ channel?: InviteChannel | null;
1999
+ inviter?: User$1;
2000
+ target_type?: InviteTargetType;
2001
+ target_user?: User$1;
2002
+ target_application?: InviteTargetApplication;
2003
+ approximate_presence_count?: number;
2004
+ approximate_member_count?: number;
2005
+ expires_at?: ISO8601Timestamp | null;
2006
+ guild_scheduled_event?: GuildScheduledEvent;
2007
+ flags?: number;
2008
+ roles?: InviteRole[];
2009
+ }
2010
+ interface InviteMetadata {
2011
+ uses: number;
2012
+ max_uses: number;
2013
+ max_age: number;
2014
+ temporary: boolean;
2015
+ created_at: ISO8601Timestamp;
2016
+ }
2017
+ type InviteWithMetadata = Invite & InviteMetadata;
2018
+ interface InviteCreateEvent extends InviteMetadata {
2019
+ channel_id: Snowflake;
2020
+ code: string;
2021
+ guild_id?: Snowflake;
2022
+ inviter?: User$1;
2023
+ target_type?: InviteTargetType;
2024
+ target_user?: User$1;
2025
+ target_application?: InviteTargetApplication;
2026
+ expires_at?: ISO8601Timestamp | null;
2027
+ role_ids?: Snowflake[];
2028
+ }
2029
+ interface InviteDeleteEvent {
2030
+ channel_id: Snowflake;
2031
+ guild_id?: Snowflake;
2032
+ code: string;
2033
+ }
2034
+ //#endregion
2035
+ //#region packages/types/src/subscription.d.ts
2036
+ declare enum SubscriptionStatus {
2037
+ Active = 0,
2038
+ Inactive = 1,
2039
+ Ending = 2
2040
+ }
2041
+ interface Subscription {
2042
+ id: Snowflake;
2043
+ user_id: Snowflake;
2044
+ sku_ids: Snowflake[];
2045
+ entitlement_ids: Snowflake[];
2046
+ renewal_sku_ids: Snowflake[] | null;
2047
+ current_period_start: ISO8601Timestamp;
2048
+ current_period_end: ISO8601Timestamp;
2049
+ status: SubscriptionStatus;
2050
+ canceled_at: ISO8601Timestamp | null;
2051
+ country?: string;
2052
+ }
2053
+ //#endregion
2054
+ //#region packages/types/src/gateway.d.ts
2055
+ declare enum ActivityType$1 {
2056
+ Playing = 0,
2057
+ Streaming = 1,
2058
+ Listening = 2,
2059
+ Watching = 3,
2060
+ Custom = 4,
2061
+ Competing = 5
2062
+ }
2063
+ declare enum ActivityStatusDisplayType {
2064
+ Name = 0,
2065
+ State = 1,
2066
+ Details = 2
2067
+ }
2068
+ type PresenceStatus = "idle" | "dnd" | "online" | "offline";
2069
+ interface ActivityEmoji {
2070
+ name: string;
2071
+ id?: Snowflake;
2072
+ animated?: boolean;
2073
+ }
2074
+ interface Activity {
2075
+ name: string;
2076
+ type: ActivityType$1;
2077
+ url?: string | null;
2078
+ created_at: number;
2079
+ timestamps?: {
2080
+ start?: number;
2081
+ end?: number;
2082
+ };
2083
+ application_id?: Snowflake;
2084
+ status_display_type?: ActivityStatusDisplayType | null;
2085
+ details?: string | null;
2086
+ details_url?: string | null;
2087
+ state?: string | null;
2088
+ state_url?: string | null;
2089
+ emoji?: ActivityEmoji | null;
2090
+ party?: {
2091
+ id?: string;
2092
+ size?: [currentSize: number, maxSize: number];
2093
+ };
2094
+ assets?: {
2095
+ large_image?: string;
2096
+ large_text?: string;
2097
+ large_url?: string;
2098
+ small_image?: string;
2099
+ small_text?: string;
2100
+ small_url?: string;
2101
+ invite_cover_image?: string;
2102
+ };
2103
+ secrets?: {
2104
+ join?: string;
2105
+ spectate?: string;
2106
+ match?: string;
2107
+ };
2108
+ instance?: boolean;
2109
+ flags?: number;
2110
+ buttons?: string[];
2111
+ }
2112
+ interface ReadyEvent {
2113
+ v: number;
2114
+ user: User$1;
2115
+ guilds: UnavailableGuild[];
2116
+ session_id: string;
2117
+ resume_gateway_url: string;
2118
+ shard?: [shardId: number, shardCount: number];
2119
+ application: {
2120
+ id: Snowflake;
2121
+ flags: number;
2122
+ };
2123
+ }
2124
+ interface ResumedEvent {
2125
+ _trace?: string[];
2126
+ }
2127
+ type GuildCreateEvent = (Guild$1 & {
2128
+ joined_at: ISO8601Timestamp;
2129
+ large: boolean;
2130
+ unavailable?: false;
2131
+ member_count: number;
2132
+ members: GuildMember$1[];
2133
+ channels: Channel$1[];
2134
+ threads: Channel$1[];
2135
+ guild_scheduled_events: GuildScheduledEvent[];
2136
+ presences: Array<Omit<PresenceUpdateEvent, "guild_id">>;
2137
+ }) | UnavailableGuild;
2138
+ interface GuildUpdateEvent extends Guild$1 {}
2139
+ interface GuildDeleteEvent {
2140
+ id: Snowflake;
2141
+ unavailable?: boolean;
2142
+ }
2143
+ interface ChannelCreateEvent extends Channel$1 {}
2144
+ interface ChannelUpdateEvent extends Channel$1 {}
2145
+ interface ChannelDeleteEvent extends Channel$1 {}
2146
+ interface ThreadCreateEvent extends Channel$1 {
2147
+ newly_created?: boolean;
2148
+ }
2149
+ interface ThreadDeleteEvent {
2150
+ id: Snowflake;
2151
+ guild_id: Snowflake;
2152
+ parent_id: Snowflake;
2153
+ type: ChannelType;
2154
+ }
2155
+ interface ThreadListSyncEvent {
2156
+ guild_id: Snowflake;
2157
+ channel_ids?: Snowflake[];
2158
+ threads: Channel$1[];
2159
+ members: ThreadMember[];
2160
+ }
2161
+ interface ThreadMemberUpdateEvent extends ThreadMember {
2162
+ guild_id: Snowflake;
2163
+ }
2164
+ interface ThreadMembersUpdateEvent {
2165
+ id: Snowflake;
2166
+ guild_id: Snowflake;
2167
+ member_count: number;
2168
+ added_members?: Array<ThreadMember & {
2169
+ member: GuildMember$1;
2170
+ presence: PresenceUpdateEvent | null;
2171
+ }>;
2172
+ removed_member_ids?: Snowflake[];
2173
+ }
2174
+ interface ChannelPinsUpdateEvent {
2175
+ guild_id?: Snowflake;
2176
+ channel_id: Snowflake;
2177
+ last_pin_timestamp?: ISO8601Timestamp | null;
2178
+ }
2179
+ interface MessageCreateEvent extends Message$1 {}
2180
+ type MessageUpdateEvent = Partial<Message$1> & Pick<Message$1, "id" | "channel_id">;
2181
+ interface MessageDeleteEvent {
2182
+ id: Snowflake;
2183
+ channel_id: Snowflake;
2184
+ guild_id?: Snowflake;
2185
+ }
2186
+ interface MessageDeleteBulkEvent {
2187
+ ids: Snowflake[];
2188
+ channel_id: Snowflake;
2189
+ guild_id?: Snowflake;
2190
+ }
2191
+ interface MessageReactionAddEvent {
2192
+ user_id: Snowflake;
2193
+ channel_id: Snowflake;
2194
+ message_id: Snowflake;
2195
+ guild_id?: Snowflake;
2196
+ member?: GuildMember$1;
2197
+ emoji: PartialEmoji;
2198
+ message_author_id?: Snowflake;
2199
+ burst: boolean;
2200
+ burst_colors?: string[];
2201
+ type: ReactionType;
2202
+ }
2203
+ interface MessageReactionRemoveEvent {
2204
+ user_id: Snowflake;
2205
+ channel_id: Snowflake;
2206
+ message_id: Snowflake;
2207
+ guild_id?: Snowflake;
2208
+ emoji: PartialEmoji;
2209
+ burst: boolean;
2210
+ type: ReactionType;
2211
+ }
2212
+ interface MessageReactionRemoveAllEvent {
2213
+ channel_id: Snowflake;
2214
+ message_id: Snowflake;
2215
+ guild_id?: Snowflake;
2216
+ }
2217
+ interface MessageReactionRemoveEmojiEvent extends MessageReactionRemoveAllEvent {
2218
+ emoji: PartialEmoji;
2219
+ }
2220
+ interface MessagePollVoteEvent {
2221
+ user_id: Snowflake;
2222
+ channel_id: Snowflake;
2223
+ message_id: Snowflake;
2224
+ guild_id?: Snowflake;
2225
+ answer_id: number;
2226
+ }
2227
+ interface GuildMemberAddEvent extends GuildMember$1 {
2228
+ guild_id: Snowflake;
2229
+ user: User$1;
2230
+ }
2231
+ interface GuildMemberUpdateEvent {
2232
+ guild_id: Snowflake;
2233
+ roles: Snowflake[];
2234
+ user: User$1;
2235
+ nick?: string | null;
2236
+ avatar: string | null;
2237
+ banner: string | null;
2238
+ joined_at: ISO8601Timestamp | null;
2239
+ premium_since?: ISO8601Timestamp | null;
2240
+ deaf?: boolean;
2241
+ mute?: boolean;
2242
+ pending?: boolean;
2243
+ communication_disabled_until?: ISO8601Timestamp | null;
2244
+ avatar_decoration_data?: AvatarDecorationData | null;
2245
+ collectibles?: Collectibles | null;
2246
+ }
2247
+ interface GuildMemberRemoveEvent {
2248
+ guild_id: Snowflake;
2249
+ user: User$1;
2250
+ }
2251
+ interface GuildMembersChunkEvent {
2252
+ guild_id: Snowflake;
2253
+ members: GuildMember$1[];
2254
+ chunk_index: number;
2255
+ chunk_count: number;
2256
+ not_found?: Snowflake[];
2257
+ presences?: PresenceUpdateEvent[];
2258
+ nonce?: string;
2259
+ }
2260
+ interface GuildRoleEvent {
2261
+ guild_id: Snowflake;
2262
+ role: Role$1;
2263
+ }
2264
+ interface GuildRoleDeleteEvent {
2265
+ guild_id: Snowflake;
2266
+ role_id: Snowflake;
2267
+ }
2268
+ interface GuildBanEvent {
2269
+ guild_id: Snowflake;
2270
+ user: User$1;
2271
+ }
2272
+ interface GuildEmojisUpdateEvent {
2273
+ guild_id: Snowflake;
2274
+ emojis: Emoji[];
2275
+ }
2276
+ interface GuildStickersUpdateEvent {
2277
+ guild_id: Snowflake;
2278
+ stickers: Sticker[];
2279
+ }
2280
+ interface GuildIntegrationsUpdateEvent {
2281
+ guild_id: Snowflake;
2282
+ }
2283
+ interface PresenceUpdateEvent {
2284
+ user: PartialUser;
2285
+ guild_id: Snowflake;
2286
+ status: PresenceStatus;
2287
+ activities: Activity[];
2288
+ client_status: {
2289
+ desktop?: Exclude<PresenceStatus, "offline">;
2290
+ mobile?: Exclude<PresenceStatus, "offline">;
2291
+ web?: Exclude<PresenceStatus, "offline">;
2292
+ };
2293
+ }
2294
+ interface TypingStartEvent {
2295
+ channel_id: Snowflake;
2296
+ guild_id?: Snowflake;
2297
+ user_id: Snowflake;
2298
+ timestamp: number;
2299
+ member?: GuildMember$1;
2300
+ }
2301
+ interface WebhooksUpdateEvent {
2302
+ guild_id: Snowflake;
2303
+ channel_id: Snowflake;
2304
+ }
2305
+ interface AutoModerationActionExecutionEvent {
2306
+ guild_id: Snowflake;
2307
+ action: AutoModerationAction;
2308
+ rule_id: Snowflake;
2309
+ rule_trigger_type: AutoModerationRuleTriggerType;
2310
+ user_id: Snowflake;
2311
+ channel_id?: Snowflake;
2312
+ message_id?: Snowflake;
2313
+ alert_system_message_id?: Snowflake;
2314
+ content: string;
2315
+ matched_keyword?: string;
2316
+ matched_content: string | null;
2317
+ }
2318
+ interface GatewayRequestGuildMembersRateLimitMetadata {
2319
+ guild_id: Snowflake;
2320
+ nonce?: string;
2321
+ }
2322
+ interface GatewayRateLimitedEvent {
2323
+ opcode: number;
2324
+ retry_after: number;
2325
+ meta: GatewayRequestGuildMembersRateLimitMetadata;
2326
+ }
2327
+ type InteractionCreateEvent = Interaction$1;
2328
+ interface GatewayDispatchMap {
2329
+ READY: ReadyEvent;
2330
+ RESUMED: ResumedEvent;
2331
+ APPLICATION_COMMAND_PERMISSIONS_UPDATE: ApplicationCommandPermissions;
2332
+ AUTO_MODERATION_RULE_CREATE: AutoModerationRule;
2333
+ AUTO_MODERATION_RULE_UPDATE: AutoModerationRule;
2334
+ AUTO_MODERATION_RULE_DELETE: AutoModerationRule;
2335
+ AUTO_MODERATION_ACTION_EXECUTION: AutoModerationActionExecutionEvent;
2336
+ CHANNEL_CREATE: ChannelCreateEvent;
2337
+ CHANNEL_UPDATE: ChannelUpdateEvent;
2338
+ CHANNEL_DELETE: ChannelDeleteEvent;
2339
+ CHANNEL_PINS_UPDATE: ChannelPinsUpdateEvent;
2340
+ ENTITLEMENT_CREATE: Entitlement;
2341
+ ENTITLEMENT_UPDATE: Entitlement;
2342
+ ENTITLEMENT_DELETE: Entitlement;
2343
+ GUILD_CREATE: GuildCreateEvent;
2344
+ GUILD_UPDATE: GuildUpdateEvent;
2345
+ GUILD_DELETE: GuildDeleteEvent;
2346
+ GUILD_BAN_ADD: GuildBanEvent;
2347
+ GUILD_BAN_REMOVE: GuildBanEvent;
2348
+ GUILD_EMOJIS_UPDATE: GuildEmojisUpdateEvent;
2349
+ GUILD_STICKERS_UPDATE: GuildStickersUpdateEvent;
2350
+ GUILD_INTEGRATIONS_UPDATE: GuildIntegrationsUpdateEvent;
2351
+ GUILD_MEMBER_ADD: GuildMemberAddEvent;
2352
+ GUILD_MEMBER_UPDATE: GuildMemberUpdateEvent;
2353
+ GUILD_MEMBER_REMOVE: GuildMemberRemoveEvent;
2354
+ GUILD_MEMBERS_CHUNK: GuildMembersChunkEvent;
2355
+ GUILD_ROLE_CREATE: GuildRoleEvent;
2356
+ GUILD_ROLE_UPDATE: GuildRoleEvent;
2357
+ GUILD_ROLE_DELETE: GuildRoleDeleteEvent;
2358
+ GUILD_SCHEDULED_EVENT_CREATE: GuildScheduledEvent;
2359
+ GUILD_SCHEDULED_EVENT_UPDATE: GuildScheduledEvent;
2360
+ GUILD_SCHEDULED_EVENT_DELETE: GuildScheduledEvent;
2361
+ GUILD_SCHEDULED_EVENT_USER_ADD: GuildScheduledEventUserEvent;
2362
+ GUILD_SCHEDULED_EVENT_USER_REMOVE: GuildScheduledEventUserEvent;
2363
+ INVITE_CREATE: InviteCreateEvent;
2364
+ INVITE_DELETE: InviteDeleteEvent;
2365
+ THREAD_CREATE: ThreadCreateEvent;
2366
+ THREAD_UPDATE: ChannelUpdateEvent;
2367
+ THREAD_DELETE: ThreadDeleteEvent;
2368
+ THREAD_LIST_SYNC: ThreadListSyncEvent;
2369
+ THREAD_MEMBER_UPDATE: ThreadMemberUpdateEvent;
2370
+ THREAD_MEMBERS_UPDATE: ThreadMembersUpdateEvent;
2371
+ MESSAGE_CREATE: MessageCreateEvent;
2372
+ MESSAGE_UPDATE: MessageUpdateEvent;
2373
+ MESSAGE_DELETE: MessageDeleteEvent;
2374
+ MESSAGE_DELETE_BULK: MessageDeleteBulkEvent;
2375
+ MESSAGE_REACTION_ADD: MessageReactionAddEvent;
2376
+ MESSAGE_REACTION_REMOVE: MessageReactionRemoveEvent;
2377
+ MESSAGE_REACTION_REMOVE_ALL: MessageReactionRemoveAllEvent;
2378
+ MESSAGE_REACTION_REMOVE_EMOJI: MessageReactionRemoveEmojiEvent;
2379
+ MESSAGE_POLL_VOTE_ADD: MessagePollVoteEvent;
2380
+ MESSAGE_POLL_VOTE_REMOVE: MessagePollVoteEvent;
2381
+ PRESENCE_UPDATE: PresenceUpdateEvent;
2382
+ TYPING_START: TypingStartEvent;
2383
+ USER_UPDATE: User$1;
2384
+ WEBHOOKS_UPDATE: WebhooksUpdateEvent;
2385
+ INTERACTION_CREATE: InteractionCreateEvent;
2386
+ SUBSCRIPTION_CREATE: Subscription;
2387
+ SUBSCRIPTION_UPDATE: Subscription;
2388
+ SUBSCRIPTION_DELETE: Subscription;
2389
+ }
2390
+ type GatewayDispatchName = keyof GatewayDispatchMap;
2391
+ declare namespace index_d_exports {
2392
+ export { ActionRowComponent, ActionRowInteractionResponse, Activity, ActivityEmoji, ActivityStatusDisplayType, ActivityType$1 as ActivityType, AllowedMentionType, AllowedMentions, Application, ApplicationCommand, ApplicationCommandBase, ApplicationCommandBasicOption, ApplicationCommandChannelOption, ApplicationCommandChoice, ApplicationCommandCreate, ApplicationCommandCreateBase, ApplicationCommandDefinition, ApplicationCommandInteraction, ApplicationCommandInteractionData, ApplicationCommandInteractionOption, ApplicationCommandLocalization, ApplicationCommandMessageInteractionMetadata, ApplicationCommandNumericOption, ApplicationCommandOption, ApplicationCommandOptionBase, ApplicationCommandOptionType, ApplicationCommandPermission, ApplicationCommandPermissionType, ApplicationCommandPermissions, ApplicationCommandSimpleOption, ApplicationCommandStringOption, ApplicationCommandSubcommandGroupOption, ApplicationCommandSubcommandOption, ApplicationCommandType, ApplicationIntegrationType, ApplicationIntegrationTypeConfiguration, Attachment, AttachmentFlags, AttachmentRequest, AutoModerationAction, AutoModerationActionExecutionEvent, AutoModerationActionType, AutoModerationKeywordPresetType, AutoModerationRule, AutoModerationRuleCreate, AutoModerationRuleEventType, AutoModerationRuleModify, AutoModerationRuleTriggerMetadata, AutoModerationRuleTriggerType, AutoSelectComponent, AutoSelectComponentBase, AutoSelectInteractionResponse, AutocompleteInteraction, AutocompleteInteractionResponseData, AvatarDecorationData, Awaitable$1 as Awaitable, BaseThemeType, BitfieldString, ButtonComponent, ButtonComponentBase, ButtonStyle, Channel$1 as Channel, ChannelCreateEvent, ChannelDeleteEvent, ChannelFlags, ChannelMention, ChannelPinsUpdateEvent, ChannelSelectComponent, ChannelType, ChannelUpdateEvent, ChatInputApplicationCommandCreate, CheckboxComponent, CheckboxGroupComponent, CheckboxGroupInteractionResponse, CheckboxGroupOption, CheckboxInteractionResponse, Collectibles, ComponentBase, ComponentEmoji, ComponentType, ContainerComponent, ContextMenuApplicationCommandCreate, DefaultReaction, Embed, EmbedFlags, EmbedMedia, EmbedVideo, Emoji, Entitlement, EntitlementType, EntryPointCommandHandlerType, FileComponent, FileUpload, FileUploadComponent, FileUploadInteractionResponse, ForumLayoutType, ForumTag, GatewayDispatchMap, GatewayDispatchName, GatewayRateLimitedEvent, GatewayRequestGuildMembersRateLimitMetadata, Guild$1 as Guild, GuildBan, GuildBanEvent, GuildCreateEvent, GuildDefaultMessageNotificationLevel, GuildDeleteEvent, GuildEmojisUpdateEvent, GuildExplicitContentFilterLevel, GuildIncidentsData, GuildIntegrationsUpdateEvent, GuildMFALevel, GuildMember$1 as GuildMember, GuildMemberAddEvent, GuildMemberFlags, GuildMemberRemoveEvent, GuildMemberUpdateEvent, GuildMembersChunkEvent, GuildNSFWLevel, GuildPremiumTier, GuildRoleDeleteEvent, GuildRoleEvent, GuildScheduledEvent, GuildScheduledEventCreate, GuildScheduledEventEntityType, GuildScheduledEventModify, GuildScheduledEventPrivacyLevel, GuildScheduledEventRecurrenceFrequency, GuildScheduledEventRecurrenceMonth, GuildScheduledEventRecurrenceNWeekday, GuildScheduledEventRecurrenceRule, GuildScheduledEventRecurrenceRuleCreate, GuildScheduledEventRecurrenceWeekday, GuildScheduledEventStatus, GuildScheduledEventUser, GuildScheduledEventUserEvent, GuildStickersUpdateEvent, GuildUpdateEvent, GuildVerificationLevel, ISO8601Timestamp, InstallParams, Interaction$1 as Interaction, InteractionBase, InteractionCallback, InteractionCallbackResource, InteractionCallbackResponse, InteractionCallbackType, InteractionContextType, InteractionCreateEvent, InteractionData, InteractionResponse, InteractionResponseData, InteractionType, Invite, InviteChannel, InviteCreateEvent, InviteDeleteEvent, InviteFlags, InviteGuild, InviteMetadata, InviteRole, InviteTargetApplication, InviteTargetType, InviteType, InviteWithMetadata, JsonPrimitive, JsonValue, LabelComponent, LabelInteractionResponse, LabelInteractionResponseChild, Locale, Localizations, MediaGalleryComponent, MentionableSelectComponent, Message$1 as Message, MessageActionRowComponent, MessageActivity, MessageActivityType, MessageAutoSelectComponent, MessageCall, MessageComponent, MessageComponentInteraction, MessageComponentInteractionData, MessageComponentMessageInteractionMetadata, MessageComponentType, MessageCreate, MessageCreateEvent, MessageDeleteBulkEvent, MessageDeleteEvent, MessageEdit, MessageFlags, MessageInteraction, MessageInteractionMetadata, MessageInteractionMetadataBase, MessagePollVoteEvent, MessageReactionAddEvent, MessageReactionRemoveAllEvent, MessageReactionRemoveEmojiEvent, MessageReactionRemoveEvent, MessageReference, MessageReferenceType, MessageSnapshot, MessageStringSelectComponent, MessageType, MessageUpdateEvent, ModalActionRowComponent, ModalAutoSelectComponent, ModalComponent, ModalInteractionResponseData, ModalStringSelectComponent, ModalSubmitComponent, ModalSubmitInteraction, ModalSubmitInteractionData, ModalSubmitMessageInteractionMetadata, Nameplate, NameplatePalette, OverwriteType, PartialEmoji, PartialGuild, PartialUser, PermissionFlag, PermissionFlagName, PermissionFlags, PermissionInput, PermissionOverwrite, PingInteraction, Poll, PollCreate, PollLayoutType, PremiumType, PresenceStatus, PresenceUpdateEvent, PrimaryEntryPointApplicationCommandCreate, RadioGroupComponent, RadioGroupInteractionResponse, RadioGroupOption, Reaction, ReactionType, ReadyEvent, ResolvedChannel$1 as ResolvedChannel, ResolvedData, ResumedEvent, Role$1 as Role, RoleColors, RoleFlags, RoleSelectComponent, RoleSubscriptionData, RoleTags, SectionComponent, SelectOption, SeparatorComponent, SharedClientTheme, Snowflake, SortOrderType, Sticker, StickerFormatType, StickerItem, StickerPack, StickerType, StringSelectComponent, StringSelectInteractionResponse, Subscription, SubscriptionStatus, SystemChannelFlags, Team, TeamMember, TextDisplayComponent, TextDisplayInteractionResponse, TextInputComponent, TextInputInteractionResponse, TextInputStyle, ThreadAutoArchiveDuration, ThreadCreateEvent, ThreadDeleteEvent, ThreadListSyncEvent, ThreadMember, ThreadMemberUpdateEvent, ThreadMembersUpdateEvent, ThreadMetadata, ThumbnailComponent, TypingStartEvent, UnavailableGuild, UnfurledMediaItem, User$1 as User, UserFlags, UserPrimaryGuild, UserSelectComponent, VideoQualityMode, WebhooksUpdateEvent, WelcomeScreen, WelcomeScreenChannel, can, canAny, missing, toFlagNames, toPermissionBits };
2393
+ }
2394
+ //#endregion
2395
+ //#region packages/helpers/src/templates.d.ts
2396
+ /**
2397
+ * Content templates. Three verbs: define (code only, one object of plain
2398
+ * fill-to-payload functions), invoke with fills, override (third argument;
2399
+ * an override key replaces that key entirely, with no deep merge).
2400
+ */
2401
+ type TemplateMap<P> = Record<string, (fills: any) => P>;
2402
+ type FillsOf<F> = F extends ((fills: infer P) => unknown) ? P : never;
2403
+ /** A callable template registry for one content domain. */
2404
+ interface TemplateRegistry<P, T extends TemplateMap<P> = TemplateMap<P>> {
2405
+ <K extends keyof T & string>(name: K, fills: FillsOf<T[K]>, override?: Partial<P>): P;
2406
+ /** The template names this registry defines. */
2407
+ readonly names: readonly (keyof T & string)[];
2408
+ }
2409
+ //#endregion
2410
+ //#region packages/helpers/src/index.d.ts
2411
+ type EmbedTemplates = TemplateMap<Embed>;
2412
+ type ComponentTemplates = TemplateMap<MessageComponent>;
2413
+ /** Modal templates omit custom_id; listener fields derive the wire id. */
2414
+ type ModalTemplatePayload = Omit<ModalInteractionResponseData, "custom_id"> & {
2415
+ custom_id?: string;
2416
+ };
2417
+ type ModalTemplates = TemplateMap<ModalTemplatePayload>;
2418
+ type EmbedRegistry<T extends EmbedTemplates = EmbedTemplates> = TemplateRegistry<Embed, T>;
2419
+ type ComponentRegistry<T extends ComponentTemplates = ComponentTemplates> = TemplateRegistry<MessageComponent, T>;
2420
+ type ModalRegistry<T extends ModalTemplates = ModalTemplates> = TemplateRegistry<ModalTemplatePayload, T>;
2421
+ /** Defines embed templates; keys are the template names. */
2422
+ declare function defineEmbeds<T extends EmbedTemplates>(templates: T): EmbedRegistry<T>;
2423
+ /** Defines component templates; keys are the template names. */
2424
+ declare function defineComponents<T extends ComponentTemplates>(templates: T): ComponentRegistry<T>;
2425
+ /** Defines modal templates; keys are the template names. */
2426
+ declare function defineModals<T extends ModalTemplates>(templates: T): ModalRegistry<T>;
2427
+ /** Wires an embed registry onto the client as `client.embeds(...)`. */
2428
+ declare function embedTemplates<T extends EmbedTemplates>(templates: T | EmbedRegistry<T>): EuniaModule;
2429
+ /** Wires a component registry onto the client as `client.components(...)`. */
2430
+ declare function componentTemplates<T extends ComponentTemplates>(templates: T | ComponentRegistry<T>): EuniaModule;
2431
+ /** Wires a modal registry onto the client as `client.modals(...)`. */
2432
+ declare function modalTemplates<T extends ModalTemplates>(templates: T | ModalRegistry<T>): EuniaModule;
2433
+ //#endregion
2434
+ //#region packages/commands/src/cooldown.d.ts
2435
+ interface CooldownRequest {
2436
+ readonly key: string;
2437
+ readonly limit: number;
2438
+ readonly windowMs: number;
2439
+ readonly now: number;
2440
+ }
2441
+ interface CooldownResult {
2442
+ readonly allowed: boolean;
2443
+ readonly remaining: number;
2444
+ readonly resetAt: number;
2445
+ readonly saturated?: boolean;
2446
+ }
2447
+ interface CooldownStore {
2448
+ /** Count and test one command use as one atomic operation. */
2449
+ consume(request: CooldownRequest): Awaitable<CooldownResult>;
2450
+ }
2451
+ interface MemoryCooldownStoreOptions {
2452
+ readonly maxEntries?: number;
2453
+ readonly sweepIntervalMs?: number;
2454
+ }
2455
+ declare class MemoryCooldownStore implements CooldownStore {
2456
+ private readonly entries;
2457
+ private readonly maxEntries;
2458
+ private readonly sweepIntervalMs;
2459
+ private nextSweepAt;
2460
+ constructor(options?: MemoryCooldownStoreOptions);
2461
+ get size(): number;
2462
+ consume(request: CooldownRequest): CooldownResult;
2463
+ clear(): void;
2464
+ private sweepIfDue;
2465
+ private sweep;
2466
+ private earliestResetAt;
2467
+ }
2468
+ //#endregion
2469
+ //#region packages/shared/src/logger.d.ts
2470
+ type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
2471
+ interface Logger {
2472
+ debug(...values: unknown[]): void;
2473
+ info(...values: unknown[]): void;
2474
+ warn(...values: unknown[]): void;
2475
+ error(...values: unknown[]): void;
2476
+ child(scope: string): Logger;
2477
+ }
2478
+ interface LoggerOptions {
2479
+ level?: LogLevel;
2480
+ scope?: string;
2481
+ write?: (level: Exclude<LogLevel, "silent">, scope: string, values: unknown[]) => void;
2482
+ }
2483
+ /** Writes timestamped diagnostics to stderr. */
2484
+ declare class ConsoleLogger implements Logger {
2485
+ private readonly level;
2486
+ private readonly scope;
2487
+ private readonly write;
2488
+ constructor(options?: LoggerOptions);
2489
+ debug(...values: unknown[]): void;
2490
+ info(...values: unknown[]): void;
2491
+ warn(...values: unknown[]): void;
2492
+ error(...values: unknown[]): void;
2493
+ child(scope: string): Logger;
2494
+ private log;
2495
+ }
2496
+ /** Drops every diagnostic message. */
2497
+ declare class SilentLogger implements Logger {
2498
+ debug(): void;
2499
+ info(): void;
2500
+ warn(): void;
2501
+ error(): void;
2502
+ child(_scope: string): Logger;
2503
+ }
2504
+ /** Reads EUNIA_LOG for the level; unset or invalid means silent. */
2505
+ declare function createLogger(scope: string): Logger;
2506
+ /** Renders the "time LEVEL scope" prefix for one log line. */
2507
+ declare function formatLogPrefix(level: Exclude<LogLevel, "silent">, scope: string, options: {
2508
+ colors: boolean;
2509
+ at?: Date;
2510
+ }): string;
2511
+ //#endregion
2512
+ //#region packages/rest/src/routes.d.ts
2513
+ /**
2514
+ * Route binding. A caller binds a path template ("/channels/{channelId}/messages")
2515
+ * to parameter values once; the uninterpolated template doubles as the
2516
+ * rate-limit route key, so no per-request pattern matching is needed.
2517
+ */
2518
+ type QueryValue = string | number | boolean | null | undefined;
2519
+ /** A bound route: interpolated request path plus its rate-limit identity. */
2520
+ interface RoutePath {
2521
+ /** Interpolated path sent on the wire, e.g. "/channels/123/messages". */
2522
+ path: string;
2523
+ /** Uninterpolated template; used directly as the rate-limit route key. */
2524
+ template: string;
2525
+ /** Major rate-limit parameter (channel/guild/webhook scope), "global" when none. */
2526
+ majorParam: string;
2527
+ }
2528
+ /** Binds a path template to parameter values. */
2529
+ declare function routePath(template: string, params?: Readonly<Record<string, string>>): RoutePath;
2530
+ /** Adds defined query parameters to a route or raw path. */
2531
+ declare function withQuery(route: string, query: Readonly<Record<string, QueryValue | readonly QueryValue[]>>): string;
2532
+ declare function withQuery(route: RoutePath, query: Readonly<Record<string, QueryValue | readonly QueryValue[]>>): RoutePath;
2533
+ //#endregion
2534
+ //#region packages/rest/src/rest.d.ts
2535
+ type HttpMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
2536
+ /** A bound route, or a raw path string as the last-resort trapdoor. */
2537
+ type RequestPath = string | RoutePath;
2538
+ interface RestFile {
2539
+ data: Blob | ArrayBuffer | ArrayBufferView;
2540
+ name: string;
2541
+ description?: string;
2542
+ }
2543
+ interface RestRequestOptions {
2544
+ body?: unknown;
2545
+ files?: readonly RestFile[];
2546
+ auth?: boolean;
2547
+ global?: boolean;
2548
+ reason?: string;
2549
+ headers?: HeadersInit;
2550
+ signal?: AbortSignal;
2551
+ idempotent?: boolean;
2552
+ }
2553
+ /** Configures the HTTP client. */
2554
+ interface RestOptions {
2555
+ token: string;
2556
+ version?: number;
2557
+ baseUrl?: string;
2558
+ userAgent?: string;
2559
+ timeoutMs?: number;
2560
+ retries?: number;
2561
+ globalRequestsPerSecond?: number;
2562
+ maxBuckets?: number;
2563
+ bucketTtlMs?: number;
2564
+ invalidRequestWarning?: number;
2565
+ onInvalidRequestWarning?: (count: number) => void;
2566
+ logger?: Logger;
2567
+ fetch?: typeof fetch;
2568
+ }
2569
+ interface RestDiagnostics {
2570
+ readonly buckets: number;
2571
+ readonly learnedRoutes: number;
2572
+ readonly invalidRequests: number;
2573
+ }
2574
+ /** Sends authenticated, rate-limited requests to Discord. */
2575
+ declare class EuniaRest {
2576
+ private readonly log;
2577
+ private readonly buckets;
2578
+ private readonly hashes;
2579
+ private readonly botGlobal;
2580
+ private readonly ipGlobal;
2581
+ private readonly unrestricted;
2582
+ private readonly token;
2583
+ private readonly opts;
2584
+ private readonly invalidRequests;
2585
+ private requestCount;
2586
+ private warnedInvalidCount;
2587
+ constructor(options: RestOptions);
2588
+ get diagnostics(): RestDiagnostics;
2589
+ get<T = unknown>(path: RequestPath, options?: Omit<RestRequestOptions, "body" | "files">): Promise<T>;
2590
+ post<T = unknown>(path: RequestPath, body?: unknown, options?: Omit<RestRequestOptions, "body">): Promise<T>;
2591
+ patch<T = unknown>(path: RequestPath, body?: unknown, options?: Omit<RestRequestOptions, "body">): Promise<T>;
2592
+ put<T = unknown>(path: RequestPath, body?: unknown, options?: Omit<RestRequestOptions, "body">): Promise<T>;
2593
+ delete<T = unknown>(path: RequestPath, options?: RestRequestOptions): Promise<T>;
2594
+ request<T = unknown>(method: HttpMethod, path: RequestPath, options?: RestRequestOptions): Promise<T>;
2595
+ private validateOptions;
2596
+ private bucketFor;
2597
+ private execute;
2598
+ private prepareBody;
2599
+ private observe;
2600
+ private reconcileBucket;
2601
+ private read429;
2602
+ private parseBody;
2603
+ private intoApiError;
2604
+ private recordInvalidRequest;
2605
+ private sweepBucketsIfNeeded;
2606
+ private sweepAfterRequest;
2607
+ private sweepBuckets;
2608
+ private pruneInvalidRequests;
2609
+ }
2610
+ //#endregion
2611
+ //#region packages/rest/src/errors.d.ts
2612
+ /**
2613
+ * An error response from Discord: a 4xx, or a 5xx after retries ran out.
2614
+ * `status` is the HTTP status, `code` is Discord's own error code from the
2615
+ * body (0 when absent), and `raw` is the parsed body including any
2616
+ * field-level detail. Messages never include the token or request body.
2617
+ */
2618
+ declare class DiscordError extends Error {
2619
+ readonly status: number;
2620
+ readonly code: number;
2621
+ readonly method: string;
2622
+ readonly routeKey: string;
2623
+ readonly raw: unknown;
2624
+ readonly name = "DiscordError";
2625
+ constructor(status: number, code: number, message: string, method: string, routeKey: string, raw: unknown);
2626
+ }
2627
+ /**
2628
+ * Thrown when a request kept hitting 429s past the retry budget. Ordinarily
2629
+ * 429s are absorbed by waiting and retrying; this surfaces only when that
2630
+ * budget runs out. `scope` is "user", "global", or "shared"; `global` means
2631
+ * the 429 counted against the whole bot rather than one bucket.
2632
+ */
2633
+ declare class RateLimitExhaustedError extends Error {
2634
+ readonly method: string;
2635
+ readonly routeKey: string;
2636
+ readonly retryAfterMs: number;
2637
+ readonly scope: string;
2638
+ readonly global: boolean;
2639
+ readonly name = "RateLimitExhaustedError";
2640
+ constructor(method: string, routeKey: string, retryAfterMs: number, scope: string, global: boolean);
2641
+ }
2642
+ //#endregion
2643
+ //#region packages/rest/src/constants.d.ts
2644
+ /**
2645
+ * Constants for Discord's REST API (v10). Protocol values are defined by
2646
+ * Discord; library defaults are Eunia's and can all be overridden
2647
+ * through `RestOptions`.
2648
+ */
2649
+ /** REST API version, the `/v10` in every request URL. */
2650
+ declare const API_VERSION = 10;
2651
+ //#endregion
2652
+ //#region packages/structures/src/context.d.ts
2653
+ interface StructureCacheShape {
2654
+ user: User$1;
2655
+ guild: Guild$1;
2656
+ channel: Channel$1;
2657
+ message: Message$1;
2658
+ member: GuildMember$1;
2659
+ role: Role$1;
2660
+ }
2661
+ type StructureCache = Cache<StructureCacheShape>;
2662
+ interface StructureContext {
2663
+ rest: EuniaRest;
2664
+ cache: StructureCache;
2665
+ }
2666
+ declare function memberCacheKey(guildId: string, userId: string): string;
2667
+ declare function upsertCachedGuildChannel(ctx: StructureContext, raw: Channel$1): void;
2668
+ declare function removeCachedGuildChannel(ctx: StructureContext, guildId: string | undefined, channelId: string): void;
2669
+ declare function upsertCachedGuildMembers(ctx: StructureContext, guildId: string, entries: readonly {
2670
+ userId: string;
2671
+ raw: GuildMember$1;
2672
+ }[]): void;
2673
+ declare function upsertCachedGuildMember(ctx: StructureContext, guildId: string, userId: string, raw: GuildMember$1): void;
2674
+ declare function removeCachedGuildMember(ctx: StructureContext, guildId: string, userId: string): void;
2675
+ //#endregion
2676
+ //#region packages/structures/src/utils/messages.d.ts
2677
+ /**
2678
+ * The universal content input accepted by every content-bearing verb:
2679
+ * a plain string, one embed, an embed list, or the full payload object.
2680
+ */
2681
+ type Sendable = string | Embed | readonly Embed[] | MessageCreate | MessageEdit;
2682
+ interface MessageRequestParts<T> {
2683
+ body: Omit<T, "files">;
2684
+ files: MessageCreate["files"] | undefined;
2685
+ }
2686
+ /** Normalizes a Sendable into a wire payload; "edit" permits null resets. */
2687
+ declare function normalizeSendable(input: Sendable, mode?: "create"): MessageCreate;
2688
+ declare function normalizeSendable(input: Sendable, mode: "edit"): MessageEdit;
2689
+ declare function splitMessageFiles<T extends {
2690
+ files?: MessageCreate["files"];
2691
+ }>(data: T): MessageRequestParts<T>;
2692
+ //#endregion
2693
+ //#region packages/structures/src/utils/rest.d.ts
2694
+ interface AuditLogOptions {
2695
+ reason?: string;
2696
+ }
2697
+ //#endregion
2698
+ //#region packages/structures/src/structures/BaseStructure.d.ts
2699
+ declare abstract class BaseStructure<Raw extends {
2700
+ id: Snowflake;
2701
+ }> {
2702
+ protected readonly ctx: StructureContext;
2703
+ readonly raw: Readonly<Raw>;
2704
+ protected constructor(raw: Raw, ctx: StructureContext);
2705
+ get id(): Snowflake;
2706
+ get createdTimestamp(): number;
2707
+ get createdAt(): Date;
2708
+ toJSON(): Raw;
2709
+ }
2710
+ //#endregion
2711
+ //#region packages/structures/src/utils/discord.d.ts
2712
+ declare const DISCORD_EPOCH = 1420070400000;
2713
+ declare const CDN_BASE_URL = "https://cdn.discordapp.com";
2714
+ type ImageExtension = "png" | "jpeg" | "webp" | "gif";
2715
+ interface CDNImageOptions {
2716
+ extension?: ImageExtension;
2717
+ size?: 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
2718
+ }
2719
+ declare function snowflakeTimestamp(snowflake: string): number;
2720
+ declare function cdnAssetUrl(path: readonly string[], hash: string, options?: CDNImageOptions): string;
2721
+ //#endregion
2722
+ //#region packages/structures/src/structures/Role.d.ts
2723
+ interface RoleEditInput {
2724
+ name?: string;
2725
+ permissions?: PermissionInput;
2726
+ color?: number;
2727
+ hoist?: boolean;
2728
+ icon?: string | null;
2729
+ unicodeEmoji?: string | null;
2730
+ mentionable?: boolean;
2731
+ }
2732
+ declare class Role extends BaseStructure<Role$1> {
2733
+ readonly guildId: string;
2734
+ constructor(raw: Role$1, ctx: StructureContext, guildId: string);
2735
+ get name(): string;
2736
+ get mention(): string;
2737
+ get permissions(): bigint;
2738
+ get guild(): Guild | undefined;
2739
+ iconURL(options?: CDNImageOptions): string | undefined;
2740
+ fetchGuild(): Promise<Guild>;
2741
+ edit(options: RoleEditInput, audit?: AuditLogOptions): Promise<Role>;
2742
+ delete(audit?: AuditLogOptions): Promise<void>;
2743
+ private updateCachedGuildRoles;
2744
+ }
2745
+ //#endregion
2746
+ //#region packages/structures/src/structures/Message.d.ts
2747
+ declare class Message extends BaseStructure<Message$1> {
2748
+ readonly author: User;
2749
+ constructor(raw: Message$1, ctx: StructureContext);
2750
+ get content(): string;
2751
+ get channelId(): string;
2752
+ get guildId(): string | undefined;
2753
+ get editedAt(): Date | undefined;
2754
+ get channel(): Channel | undefined;
2755
+ get guild(): Guild | undefined;
2756
+ get url(): string;
2757
+ fetchChannel(): Promise<Channel>;
2758
+ fetchGuild(): Promise<Guild | undefined>;
2759
+ reply(input: Sendable): Promise<Message>;
2760
+ edit(input: Sendable): Promise<Message>;
2761
+ delete(): Promise<void>;
2762
+ react(emoji: string): Promise<void>;
2763
+ removeOwnReaction(emoji: string): Promise<void>;
2764
+ pin(): Promise<void>;
2765
+ unpin(): Promise<void>;
2766
+ private cacheMessage;
2767
+ private cachePinnedState;
2768
+ }
2769
+ //#endregion
2770
+ //#region packages/structures/src/structures/User.d.ts
2771
+ declare class User extends BaseStructure<User$1> {
2772
+ constructor(raw: User$1, ctx: StructureContext);
2773
+ get username(): string;
2774
+ get displayName(): string;
2775
+ get isBot(): boolean;
2776
+ get mention(): string;
2777
+ get tag(): string;
2778
+ avatarURL(options?: CDNImageOptions): string | undefined;
2779
+ displayAvatarURL(options?: CDNImageOptions): string;
2780
+ get defaultAvatarURL(): string;
2781
+ bannerURL(options?: CDNImageOptions): string | undefined;
2782
+ createDM(): Promise<Channel>;
2783
+ send(input: Sendable): Promise<Message>;
2784
+ }
2785
+ //#endregion
2786
+ //#region packages/structures/src/structures/GuildMember.d.ts
2787
+ interface MemberEditInput extends AuditLogOptions {
2788
+ nickname?: string | null;
2789
+ roles?: readonly Snowflake[];
2790
+ mute?: boolean;
2791
+ deaf?: boolean;
2792
+ channelId?: Snowflake | null;
2793
+ communicationDisabledUntil?: Date | number | string | null;
2794
+ }
2795
+ interface BanInput extends AuditLogOptions {
2796
+ deleteMessageSeconds?: number;
2797
+ }
2798
+ declare class GuildMember {
2799
+ private readonly ctx;
2800
+ readonly guildId: string;
2801
+ readonly id: string;
2802
+ readonly raw: Readonly<GuildMember$1>;
2803
+ constructor(raw: GuildMember$1, ctx: StructureContext, guildId: string, id?: string);
2804
+ get createdTimestamp(): number;
2805
+ get createdAt(): Date;
2806
+ get joinedAt(): Date | undefined;
2807
+ get mention(): string;
2808
+ get user(): User | undefined;
2809
+ get guild(): Guild | undefined;
2810
+ get displayName(): string;
2811
+ /** The interaction-provided channel permissions when present, guild-wide otherwise. */
2812
+ get permissions(): bigint;
2813
+ /** Guild-wide permissions from cached roles; the owner holds every flag. */
2814
+ get guildPermissions(): bigint;
2815
+ /** Returns true when the member holds every flag in `required`. */
2816
+ can(required: bigint): boolean;
2817
+ /** Returns true when the member holds at least one flag in `anyOf`. */
2818
+ canAny(anyOf: bigint): boolean;
2819
+ /** Names the flags in `required` that the member lacks. */
2820
+ missing(required: bigint): PermissionFlagName[];
2821
+ get roles(): ReadonlyMap<string, Role>;
2822
+ get highestRole(): Role | undefined;
2823
+ displayAvatarURL(options?: CDNImageOptions): string | undefined;
2824
+ fetchUser(): Promise<User>;
2825
+ fetchGuild(): Promise<Guild>;
2826
+ edit(options: MemberEditInput): Promise<GuildMember>;
2827
+ setNickname(nickname: string | null, audit?: AuditLogOptions): Promise<GuildMember>;
2828
+ timeout(until: Date | number | string | null, audit?: AuditLogOptions): Promise<GuildMember>;
2829
+ kick(audit?: AuditLogOptions): Promise<void>;
2830
+ ban(options?: BanInput): Promise<void>;
2831
+ addRole(role: string | Role, audit?: AuditLogOptions): Promise<void>;
2832
+ removeRole(role: string | Role, audit?: AuditLogOptions): Promise<void>;
2833
+ toJSON(): GuildMember$1;
2834
+ private cacheMember;
2835
+ private cachedPayload;
2836
+ }
2837
+ //#endregion
2838
+ //#region packages/structures/src/structures/Guild.d.ts
2839
+ interface GuildBanInput extends AuditLogOptions {
2840
+ deleteMessageSeconds?: number;
2841
+ }
2842
+ type RoleCreateInput = RoleEditInput;
2843
+ declare class Guild extends BaseStructure<Guild$1> {
2844
+ constructor(raw: Guild$1, ctx: StructureContext);
2845
+ get name(): string;
2846
+ get ownerId(): string;
2847
+ get owner(): User | undefined;
2848
+ get channels(): ReadonlyMap<string, Channel>;
2849
+ get roles(): ReadonlyMap<string, Role>;
2850
+ get members(): ReadonlyMap<string, GuildMember>;
2851
+ iconURL(options?: CDNImageOptions): string | undefined;
2852
+ bannerURL(options?: CDNImageOptions): string | undefined;
2853
+ splashURL(options?: CDNImageOptions): string | undefined;
2854
+ channel(channelId: string): Channel | undefined;
2855
+ member(userId: string): GuildMember | undefined;
2856
+ role(roleId: string): Role | undefined;
2857
+ fetchOwner(): Promise<User>;
2858
+ fetchChannel(channelId: string): Promise<Channel>;
2859
+ fetchMember(userId: string): Promise<GuildMember>;
2860
+ fetchRoles(): Promise<ReadonlyMap<string, Role>>;
2861
+ fetchRole(roleId: string): Promise<Role>;
2862
+ ban(userId: string, options?: GuildBanInput): Promise<void>;
2863
+ unban(userId: string, audit?: AuditLogOptions): Promise<void>;
2864
+ createRole(options?: RoleCreateInput, audit?: AuditLogOptions): Promise<Role>;
2865
+ applicationCommands(applicationId: string): Promise<ApplicationCommand[]>;
2866
+ createApplicationCommand(applicationId: string, definition: ApplicationCommandDefinition): Promise<ApplicationCommand>;
2867
+ private updateCachedRoles;
2868
+ private cachedPayload;
2869
+ }
2870
+ //#endregion
2871
+ //#region packages/structures/src/structures/Channel.d.ts
2872
+ type ChannelEditInput = Partial<Pick<Channel$1, "name" | "position" | "topic" | "nsfw" | "rate_limit_per_user" | "bitrate" | "user_limit" | "permission_overwrites" | "parent_id" | "rtc_region" | "video_quality_mode" | "default_auto_archive_duration" | "flags" | "available_tags" | "default_reaction_emoji" | "default_thread_rate_limit_per_user" | "default_sort_order" | "default_forum_layout" | "applied_tags">>;
2873
+ declare class Channel extends BaseStructure<Channel$1> {
2874
+ constructor(raw: Channel$1, ctx: StructureContext);
2875
+ get name(): string | null | undefined;
2876
+ get topic(): string | null | undefined;
2877
+ get guildId(): string | undefined;
2878
+ get mention(): string;
2879
+ get isDM(): boolean;
2880
+ get isThread(): boolean;
2881
+ get isTextBased(): boolean;
2882
+ /** Computes the member's effective permission bitfield in this channel. */
2883
+ permissionsFor(member: GuildMember): bigint;
2884
+ get guild(): Guild | undefined;
2885
+ fetchGuild(): Promise<Guild | undefined>;
2886
+ send(input: Sendable): Promise<Message>;
2887
+ fetchMessage(messageId: string): Promise<Message>;
2888
+ edit(options: ChannelEditInput, audit?: AuditLogOptions): Promise<Channel>;
2889
+ updateTopic(topic: string | null): Promise<Channel>;
2890
+ delete(audit?: AuditLogOptions): Promise<Channel>;
2891
+ triggerTyping(): Promise<void>;
2892
+ private cacheMessage;
2893
+ }
2894
+ //#endregion
2895
+ //#region packages/structures/src/structures/Interaction.d.ts
2896
+ type InteractionKind = "command" | "autocomplete" | "button" | "select" | "modal";
2897
+ type InteractionState = "pending" | "replying" | "deferring" | "autocompleting" | "replied" | "deferred" | "autocomplete" | "uncertain";
2898
+ interface DeferOptions {
2899
+ ephemeral?: boolean;
2900
+ }
2901
+ type ModalFieldValue = string | readonly string[] | boolean | null;
2902
+ declare class InteractionAlreadyAcknowledgedError extends Error {
2903
+ readonly state: InteractionState;
2904
+ constructor(state: InteractionState);
2905
+ }
2906
+ declare class InteractionNotAcknowledgedError extends Error {
2907
+ readonly state: InteractionState;
2908
+ constructor(state: InteractionState);
2909
+ }
2910
+ /** Handle on the @original response message. */
2911
+ interface OriginalMessage {
2912
+ get(): Promise<Message>;
2913
+ edit(input: Sendable): Promise<Message>;
2914
+ delete(): Promise<void>;
2915
+ }
2916
+ interface InteractionCommon {
2917
+ readonly raw: Readonly<Interaction$1>;
2918
+ readonly id: string;
2919
+ readonly kind: InteractionKind;
2920
+ readonly applicationId: string;
2921
+ readonly token: string;
2922
+ readonly guildId: string | undefined;
2923
+ readonly channelId: string | undefined;
2924
+ readonly state: InteractionState;
2925
+ readonly acknowledged: boolean;
2926
+ readonly user: User | undefined;
2927
+ readonly member: GuildMember | undefined;
2928
+ readonly channel: Channel | undefined;
2929
+ readonly guild: Guild | undefined;
2930
+ fetchChannel(): Promise<Channel | undefined>;
2931
+ fetchGuild(): Promise<Guild | undefined>;
2932
+ resolvedUser(id: string): User | undefined;
2933
+ resolvedChannel(id: string): Channel | undefined;
2934
+ resolvedRole(id: string): Role | undefined;
2935
+ toJSON(): Interaction$1;
2936
+ }
2937
+ interface RespondingInteraction extends InteractionCommon {
2938
+ /** Sends the initial message response. */
2939
+ respond(input: Sendable): Promise<void>;
2940
+ /** Acknowledges now, answers later; picks the deferred mode from the kind. */
2941
+ defer(options?: DeferOptions): Promise<void>;
2942
+ /** The @original response message handle. */
2943
+ readonly original: OriginalMessage;
2944
+ /** Sends an additional message after acknowledgement. */
2945
+ followup(input: Sendable): Promise<Message>;
2946
+ }
2947
+ interface CommandInteractionShape extends RespondingInteraction {
2948
+ readonly kind: "command";
2949
+ readonly commandName: string;
2950
+ /** Opens a modal as the initial response. */
2951
+ modal(input: ModalInteractionResponseData): Promise<void>;
2952
+ }
2953
+ interface AutocompleteInteractionShape extends InteractionCommon {
2954
+ readonly kind: "autocomplete";
2955
+ readonly commandName: string;
2956
+ /** Sends the suggestion list; the only valid response for this kind. */
2957
+ autocomplete(choices: readonly ApplicationCommandChoice[]): Promise<void>;
2958
+ }
2959
+ interface ButtonInteractionShape extends RespondingInteraction {
2960
+ readonly kind: "button";
2961
+ readonly customId: string;
2962
+ readonly message: Message | undefined;
2963
+ /** Edits the message the component sits on, as the initial response. */
2964
+ update(input: Sendable): Promise<void>;
2965
+ modal(input: ModalInteractionResponseData): Promise<void>;
2966
+ }
2967
+ interface SelectInteractionShape extends RespondingInteraction {
2968
+ readonly kind: "select";
2969
+ readonly customId: string;
2970
+ readonly message: Message | undefined;
2971
+ readonly values: readonly string[];
2972
+ update(input: Sendable): Promise<void>;
2973
+ modal(input: ModalInteractionResponseData): Promise<void>;
2974
+ }
2975
+ interface ModalInteractionShape extends RespondingInteraction {
2976
+ readonly kind: "modal";
2977
+ readonly customId: string;
2978
+ readonly message: Message | undefined;
2979
+ update(input: Sendable): Promise<void>;
2980
+ /** Reads one submitted field by custom id. */
2981
+ field(customId: string): ModalFieldValue | undefined;
2982
+ /** Reads one submitted text input by custom id. */
2983
+ textField(customId: string): string | undefined;
2984
+ }
2985
+ type InteractionShapes = CommandInteractionShape | AutocompleteInteractionShape | ButtonInteractionShape | SelectInteractionShape | ModalInteractionShape;
2986
+ /**
2987
+ * A received interaction, narrowed through the `kind` discriminant:
2988
+ * `if (interaction.kind === "button")` exposes button-only members.
2989
+ */
2990
+ type Interaction<K extends InteractionKind = InteractionKind> = Extract<InteractionShapes, {
2991
+ kind: K;
2992
+ }>;
2993
+ /** Hydrates a raw interaction payload into its kind-narrowed form. */
2994
+ declare function createInteraction(raw: ApplicationCommandInteraction, ctx: StructureContext): Interaction<"command">;
2995
+ declare function createInteraction(raw: AutocompleteInteraction, ctx: StructureContext): Interaction<"autocomplete">;
2996
+ declare function createInteraction(raw: MessageComponentInteraction, ctx: StructureContext): Interaction<"button" | "select">;
2997
+ declare function createInteraction(raw: ModalSubmitInteraction, ctx: StructureContext): Interaction<"modal">;
2998
+ declare function createInteraction(raw: Interaction$1, ctx: StructureContext): Interaction;
2999
+ /** Returns true when the value is an interaction produced by createInteraction. */
3000
+ declare function isInteraction(value: unknown): value is Interaction;
3001
+ //#endregion
3002
+ //#region packages/commands/src/errors.d.ts
3003
+ type CommandErrorCode = "invalid_definition" | "duplicate_command" | "registration_frozen" | "invalid_option" | "middleware_next_called_twice" | "execution_failed" | "autocomplete_failed" | "cooldown_store_failed";
3004
+ type CommandRejectionCode = "guild_only" | "owner_only" | "missing_user_permissions" | "missing_bot_permissions" | "permission_data_unavailable" | "cooldown" | "guard" | "invalid_input" | "command_unavailable";
3005
+ declare class CommandError extends Error {
3006
+ readonly code: CommandErrorCode;
3007
+ constructor(message: string, code: CommandErrorCode, options?: ErrorOptions);
3008
+ }
3009
+ declare class CommandValidationError extends CommandError {
3010
+ constructor(message: string);
3011
+ }
3012
+ declare class DuplicateCommandError extends CommandError {
3013
+ constructor(name: string);
3014
+ }
3015
+ declare class RegistrationFrozenError extends CommandError {
3016
+ constructor();
3017
+ }
3018
+ declare class CommandOptionError extends CommandError {
3019
+ constructor(message: string);
3020
+ }
3021
+ declare class MiddlewareError extends CommandError {
3022
+ constructor(message?: string);
3023
+ }
3024
+ declare class CommandExecutionError extends CommandError {
3025
+ constructor(path: readonly string[], cause: unknown);
3026
+ }
3027
+ declare class AutocompleteError extends CommandError {
3028
+ constructor(path: readonly string[], cause: unknown);
3029
+ }
3030
+ declare class CooldownStoreError extends CommandError {
3031
+ constructor(cause: unknown);
3032
+ }
3033
+ declare class CommandRejection extends Error {
3034
+ readonly code: CommandRejectionCode;
3035
+ readonly details: Readonly<Record<string, unknown>>;
3036
+ constructor(code: CommandRejectionCode, message: string, details?: Readonly<Record<string, unknown>>);
3037
+ }
3038
+ //#endregion
3039
+ //#region packages/commands/src/fields.d.ts
3040
+ interface OptionConfigBase {
3041
+ readonly description?: string;
3042
+ readonly nameLocalizations?: Localizations;
3043
+ readonly descriptionLocalizations?: Localizations;
3044
+ readonly required?: boolean;
3045
+ }
3046
+ interface StringOptionConfig extends OptionConfigBase {
3047
+ readonly choices?: readonly CommandChoice<string>[];
3048
+ readonly autocomplete?: boolean;
3049
+ readonly minLength?: number;
3050
+ readonly maxLength?: number;
3051
+ /** Prefix parsing: `rest: true` consumes the remaining input as one value. */
3052
+ readonly prefix?: {
3053
+ readonly rest?: boolean;
3054
+ };
3055
+ }
3056
+ interface NumericOptionConfig extends OptionConfigBase {
3057
+ readonly choices?: readonly CommandChoice<number>[];
3058
+ readonly autocomplete?: boolean;
3059
+ readonly minValue?: number;
3060
+ readonly maxValue?: number;
3061
+ }
3062
+ interface BooleanOptionConfig extends OptionConfigBase {}
3063
+ interface UserOptionConfig extends OptionConfigBase {}
3064
+ interface RoleOptionConfig extends OptionConfigBase {}
3065
+ interface MentionableOptionConfig extends OptionConfigBase {}
3066
+ interface AttachmentOptionConfig extends OptionConfigBase {}
3067
+ interface ChannelOptionConfig extends OptionConfigBase {
3068
+ readonly channelTypes?: readonly ChannelType[];
3069
+ }
3070
+ type OptionConfig = StringOptionConfig | NumericOptionConfig | BooleanOptionConfig | ChannelOptionConfig;
3071
+ declare class OptionField<Value, Required extends boolean = boolean> {
3072
+ readonly type: ApplicationCommandOptionType;
3073
+ readonly config: OptionConfig;
3074
+ /** Wire name; assigned from the class field key at registration. */
3075
+ name: string;
3076
+ readonly valueType: Value;
3077
+ readonly requiredType: Required;
3078
+ constructor(type: ApplicationCommandOptionType, config: OptionConfig);
3079
+ get required(): boolean;
3080
+ }
3081
+ type RequiredOf<C extends OptionConfigBase | undefined> = C extends {
3082
+ required: true;
3083
+ } ? true : false;
3084
+ declare const option: {
3085
+ string<const C extends StringOptionConfig | undefined = undefined>(config?: C): OptionField<string, RequiredOf<C>>;
3086
+ integer<const C extends NumericOptionConfig | undefined = undefined>(config?: C): OptionField<number, RequiredOf<C>>;
3087
+ number<const C extends NumericOptionConfig | undefined = undefined>(config?: C): OptionField<number, RequiredOf<C>>;
3088
+ boolean<const C extends BooleanOptionConfig | undefined = undefined>(config?: C): OptionField<boolean, RequiredOf<C>>;
3089
+ user<const C extends UserOptionConfig | undefined = undefined>(config?: C): OptionField<ResolvedUser, RequiredOf<C>>;
3090
+ channel<const C extends ChannelOptionConfig | undefined = undefined>(config?: C): OptionField<ResolvedChannel, RequiredOf<C>>;
3091
+ role<const C extends RoleOptionConfig | undefined = undefined>(config?: C): OptionField<ResolvedRole, RequiredOf<C>>;
3092
+ mentionable<const C extends MentionableOptionConfig | undefined = undefined>(config?: C): OptionField<ResolvedMentionable, RequiredOf<C>>;
3093
+ attachment<const C extends AttachmentOptionConfig | undefined = undefined>(config?: C): OptionField<ResolvedAttachment, RequiredOf<C>>;
3094
+ };
3095
+ //#endregion
3096
+ //#region packages/commands/src/types.d.ts
3097
+ type Awaitable<T> = T | Promise<T>;
3098
+ interface CommandChoice<T extends string | number = string | number> {
3099
+ readonly name: string;
3100
+ readonly nameLocalizations?: Localizations;
3101
+ readonly value: T;
3102
+ }
3103
+ type CooldownScope = "user" | "channel" | "guild" | "global";
3104
+ interface CommandRateLimit {
3105
+ readonly limit: number;
3106
+ readonly windowMs: number;
3107
+ readonly scope?: CooldownScope;
3108
+ }
3109
+ interface AutoDeferOptions {
3110
+ readonly afterMs?: number;
3111
+ readonly ephemeral?: boolean;
3112
+ }
3113
+ interface CommandGuardFailure {
3114
+ readonly allowed: false;
3115
+ readonly reason?: string;
3116
+ readonly details?: Readonly<Record<string, unknown>>;
3117
+ }
3118
+ type CommandGuard = (context: CommandContext | AutocompleteContext) => Awaitable<boolean | void | CommandGuardFailure>;
3119
+ type CommandMiddleware = (context: CommandContext, next: () => Promise<void>) => Awaitable<void>;
3120
+ /** Hydrates resolved option payloads into structures; an interaction satisfies it. */
3121
+ interface ResolvedStructureSource {
3122
+ resolvedUser(id: string): User | undefined;
3123
+ resolvedChannel(id: string): Channel | undefined;
3124
+ resolvedRole(id: string): Role | undefined;
3125
+ }
3126
+ /** Structure fields are present only when the invocation carried resolved payloads. */
3127
+ interface ResolvedUser {
3128
+ readonly id: string;
3129
+ readonly raw?: User$1;
3130
+ readonly user?: User;
3131
+ }
3132
+ interface ResolvedChannel {
3133
+ readonly id: string;
3134
+ readonly raw?: Pick<Channel$1, "id" | "type" | "name" | "permissions">;
3135
+ readonly channel?: Channel;
3136
+ }
3137
+ interface ResolvedRole {
3138
+ readonly id: string;
3139
+ readonly raw?: Role$1;
3140
+ readonly role?: Role;
3141
+ }
3142
+ type ResolvedMentionable = {
3143
+ readonly kind: "user";
3144
+ readonly id: string;
3145
+ readonly raw?: User$1;
3146
+ readonly user?: User;
3147
+ } | {
3148
+ readonly kind: "role";
3149
+ readonly id: string;
3150
+ readonly raw?: Role$1;
3151
+ readonly role?: Role;
3152
+ };
3153
+ interface ResolvedAttachment {
3154
+ readonly id: string;
3155
+ readonly raw?: Attachment;
3156
+ }
3157
+ interface CommandRest {
3158
+ put<T = unknown>(path: string, body?: unknown): Promise<T>;
3159
+ }
3160
+ interface CommandHost {
3161
+ readonly applicationId: string;
3162
+ readonly botId: string;
3163
+ readonly ownerIds: readonly string[] | ReadonlySet<string>;
3164
+ readonly rest: CommandRest;
3165
+ reportCommandError(error: CommandError, context?: CommandContext | AutocompleteContext): Awaitable<void>;
3166
+ }
3167
+ interface FocusedOption {
3168
+ readonly name: string;
3169
+ readonly type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
3170
+ readonly value: string | number;
3171
+ }
3172
+ /** Typed access to declared option fields: `ctx.get(this.sides)`. */
3173
+ interface OptionAccess {
3174
+ get<V, R extends boolean>(field: OptionField<V, R>): R extends true ? V : V | undefined;
3175
+ has(field: OptionField<unknown, boolean>): boolean;
3176
+ }
3177
+ interface CommandContextBase extends OptionAccess {
3178
+ readonly command: Command;
3179
+ readonly groups: readonly CommandGroup[];
3180
+ readonly path: readonly string[];
3181
+ readonly host: CommandHost;
3182
+ readonly userId: string;
3183
+ readonly channelId?: string;
3184
+ readonly guildId?: string;
3185
+ readonly userPermissions?: bigint;
3186
+ readonly botPermissions?: bigint;
3187
+ reply(input: Sendable): Promise<unknown>;
3188
+ }
3189
+ interface SlashCommandContext extends CommandContextBase {
3190
+ readonly kind: "slash";
3191
+ readonly interaction: Interaction<"command">;
3192
+ defer(options?: {
3193
+ readonly ephemeral?: boolean;
3194
+ }): Promise<boolean>;
3195
+ }
3196
+ interface PrefixCommandContext extends CommandContextBase {
3197
+ readonly kind: "prefix";
3198
+ readonly message: Message;
3199
+ readonly prefix: string;
3200
+ }
3201
+ type CommandContext = SlashCommandContext | PrefixCommandContext;
3202
+ interface AutocompleteContext extends OptionAccess {
3203
+ readonly kind: "autocomplete";
3204
+ readonly command: Command;
3205
+ readonly groups: readonly CommandGroup[];
3206
+ readonly path: readonly string[];
3207
+ readonly host: CommandHost;
3208
+ readonly interaction: Interaction<"autocomplete">;
3209
+ readonly focused: FocusedOption;
3210
+ readonly userId: string;
3211
+ readonly channelId?: string;
3212
+ readonly guildId?: string;
3213
+ readonly userPermissions?: bigint;
3214
+ readonly botPermissions?: bigint;
3215
+ }
3216
+ /** Context handed to command-scoped component and modal listeners. */
3217
+ interface ListenerContext<K extends "button" | "select" | "modal" = "button" | "select" | "modal"> {
3218
+ readonly kind: K;
3219
+ readonly command: Command;
3220
+ readonly host: CommandHost;
3221
+ readonly interaction: Interaction<K>;
3222
+ readonly args: readonly string[];
3223
+ readonly userId: string;
3224
+ readonly channelId?: string;
3225
+ readonly guildId?: string;
3226
+ reply(input: Sendable): Promise<unknown>;
3227
+ update(input: Sendable): Promise<void>;
3228
+ defer(): Promise<boolean>;
3229
+ }
3230
+ type PrefixValue = string | readonly string[] | null | undefined;
3231
+ type PrefixResolver = string | readonly string[] | ((message: Message) => Awaitable<PrefixValue>);
3232
+ interface PrefixOptions {
3233
+ readonly prefixes: PrefixResolver;
3234
+ readonly allowMention?: boolean;
3235
+ readonly caseSensitive?: boolean;
3236
+ readonly ignoreBots?: boolean;
3237
+ }
3238
+ type CommandMessageFactory = string | ((rejection: CommandRejection) => string);
3239
+ interface CommandMessages {
3240
+ readonly guildOnly?: CommandMessageFactory;
3241
+ readonly ownerOnly?: CommandMessageFactory;
3242
+ readonly userPermissions?: CommandMessageFactory;
3243
+ readonly botPermissions?: CommandMessageFactory;
3244
+ readonly permissionDataUnavailable?: CommandMessageFactory;
3245
+ readonly cooldown?: CommandMessageFactory;
3246
+ readonly guard?: CommandMessageFactory;
3247
+ readonly invalidInput?: CommandMessageFactory;
3248
+ readonly unavailable?: CommandMessageFactory;
3249
+ readonly error?: string;
3250
+ }
3251
+ interface CommandManagerOptions {
3252
+ readonly prefix?: PrefixResolver | PrefixOptions;
3253
+ readonly middleware?: readonly CommandMiddleware[];
3254
+ readonly guards?: readonly CommandGuard[];
3255
+ readonly cooldownStore?: CooldownStore;
3256
+ readonly autocompleteTimeoutMs?: number;
3257
+ readonly messages?: CommandMessages;
3258
+ }
3259
+ interface CommandPermissionData {
3260
+ readonly userPermissions?: PermissionInput;
3261
+ readonly botPermissions?: PermissionInput;
3262
+ }
3263
+ interface CommandHandleOptions extends CommandPermissionData {
3264
+ readonly resolvePermissions?: () => Awaitable<CommandPermissionData>;
3265
+ }
3266
+ type CommandHandleResult = {
3267
+ readonly status: "ignored";
3268
+ } | {
3269
+ readonly status: "completed";
3270
+ readonly path: readonly string[];
3271
+ } | {
3272
+ readonly status: "autocomplete";
3273
+ readonly path: readonly string[];
3274
+ } | {
3275
+ readonly status: "rejected";
3276
+ readonly rejection: CommandRejection;
3277
+ } | {
3278
+ readonly status: "failed";
3279
+ readonly error: CommandError;
3280
+ };
3281
+ type CommandPublishTarget = {
3282
+ readonly scope?: "global";
3283
+ } | {
3284
+ readonly scope: "guild";
3285
+ readonly guildId: string;
3286
+ };
3287
+ interface CommandPublishResult<T = unknown> {
3288
+ readonly target: "global" | "guild";
3289
+ readonly guildId?: string;
3290
+ readonly commands: T;
3291
+ }
3292
+ //#endregion
3293
+ //#region packages/commands/src/command.d.ts
3294
+ type CommandKind = "slash" | "prefix" | "hybrid";
3295
+ declare abstract class Command {
3296
+ abstract readonly name: string;
3297
+ abstract readonly description: string;
3298
+ abstract readonly kind: CommandKind;
3299
+ readonly aliases: readonly string[];
3300
+ readonly middleware: readonly CommandMiddleware[];
3301
+ readonly guards: readonly CommandGuard[];
3302
+ readonly guildOnly: boolean;
3303
+ readonly ownerOnly: boolean;
3304
+ readonly userPermissions?: PermissionInput;
3305
+ readonly botPermissions?: PermissionInput;
3306
+ readonly rateLimit?: CommandRateLimit;
3307
+ readonly autoDefer?: boolean | AutoDeferOptions;
3308
+ /** Free-form user space; the library never interprets it. */
3309
+ readonly meta: Readonly<Record<string, unknown>>;
3310
+ readonly nameLocalizations?: Localizations;
3311
+ readonly descriptionLocalizations?: Localizations;
3312
+ readonly defaultMemberPermissions?: PermissionInput | null;
3313
+ readonly contexts?: readonly InteractionContextType[] | null;
3314
+ readonly integrationTypes?: readonly ApplicationIntegrationType[];
3315
+ readonly nsfw?: boolean;
3316
+ abstract run(context: CommandContext): Awaitable<void>;
3317
+ autocomplete(_context: AutocompleteContext): Awaitable<readonly CommandChoice[]>;
3318
+ }
3319
+ /**
3320
+ * A group shares the field anatomy and lists child classes; shared policy
3321
+ * (permissions, guildOnly, meta) applies to every child.
3322
+ */
3323
+ declare abstract class CommandGroup {
3324
+ abstract readonly name: string;
3325
+ abstract readonly description: string;
3326
+ abstract readonly children: readonly CommandNodeClass[];
3327
+ readonly aliases: readonly string[];
3328
+ readonly middleware: readonly CommandMiddleware[];
3329
+ readonly guards: readonly CommandGuard[];
3330
+ readonly guildOnly: boolean;
3331
+ readonly ownerOnly: boolean;
3332
+ readonly userPermissions?: PermissionInput;
3333
+ readonly botPermissions?: PermissionInput;
3334
+ readonly meta: Readonly<Record<string, unknown>>;
3335
+ readonly nameLocalizations?: Localizations;
3336
+ readonly descriptionLocalizations?: Localizations;
3337
+ readonly defaultMemberPermissions?: PermissionInput | null;
3338
+ readonly contexts?: readonly InteractionContextType[] | null;
3339
+ readonly integrationTypes?: readonly ApplicationIntegrationType[];
3340
+ readonly nsfw?: boolean;
3341
+ }
3342
+ type CommandNode = Command | CommandGroup;
3343
+ type CommandNodeClass = new () => CommandNode;
3344
+ //#endregion
3345
+ //#region packages/commands/src/listeners.d.ts
3346
+ type ListenerKind = "button" | "select" | "modal";
3347
+ interface ListenerButtonInput {
3348
+ readonly style?: ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger;
3349
+ readonly label?: string;
3350
+ readonly emoji?: ComponentEmoji;
3351
+ readonly disabled?: boolean;
3352
+ }
3353
+ type ListenerSelectInput = (Omit<StringSelectComponent, "type" | "custom_id"> & {
3354
+ readonly type?: ComponentType.StringSelect;
3355
+ }) | Omit<AutoSelectComponent, "custom_id">;
3356
+ type ListenerModalInput = Omit<ModalInteractionResponseData, "custom_id">;
3357
+ type ListenerHandler<K extends ListenerKind> = (context: ListenerContext<K>, args: readonly string[]) => Awaitable<void>;
3358
+ declare abstract class ListenerFieldBase<K extends ListenerKind> {
3359
+ readonly kind: K;
3360
+ readonly handler: ListenerHandler<K>;
3361
+ /** Route prefix (`<command>.<field>`); assigned at registration. */
3362
+ route: string;
3363
+ constructor(kind: K, handler: ListenerHandler<K>);
3364
+ protected customId(args: readonly string[]): string;
3365
+ }
3366
+ declare class ButtonListenerField extends ListenerFieldBase<"button"> {
3367
+ constructor(handler: ListenerHandler<"button">);
3368
+ /** Produces plain button component data carrying the derived custom_id. */
3369
+ button(input?: ListenerButtonInput, ...args: readonly string[]): ButtonComponent;
3370
+ }
3371
+ declare class SelectListenerField extends ListenerFieldBase<"select"> {
3372
+ constructor(handler: ListenerHandler<"select">);
3373
+ /** Produces plain select component data carrying the derived custom_id. */
3374
+ select(input: ListenerSelectInput, ...args: readonly string[]): StringSelectComponent | AutoSelectComponent;
3375
+ }
3376
+ declare class ModalListenerField extends ListenerFieldBase<"modal"> {
3377
+ constructor(handler: ListenerHandler<"modal">);
3378
+ /** Produces modal callback data carrying the derived custom_id. */
3379
+ modal(input: ListenerModalInput, ...args: readonly string[]): ModalInteractionResponseData;
3380
+ }
3381
+ type ListenerField = ButtonListenerField | SelectListenerField | ModalListenerField;
3382
+ declare function onButton(handler: ListenerHandler<"button">): ButtonListenerField;
3383
+ declare function onSelect(handler: ListenerHandler<"select">): SelectListenerField;
3384
+ declare function onModal(handler: ListenerHandler<"modal">): ModalListenerField;
3385
+ //#endregion
3386
+ //#region packages/commands/src/manager.d.ts
3387
+ declare class CommandManager {
3388
+ private readonly roots;
3389
+ private readonly slashRoots;
3390
+ private readonly prefixRoots;
3391
+ private readonly listenerRoutes;
3392
+ private readonly host;
3393
+ private readonly middleware;
3394
+ private readonly guards;
3395
+ private readonly cooldowns;
3396
+ private readonly autocompleteTimeoutMs;
3397
+ private readonly messages;
3398
+ private readonly prefix?;
3399
+ private frozen;
3400
+ constructor(host: CommandHost, options?: CommandManagerOptions);
3401
+ get isFrozen(): boolean;
3402
+ get commands(): readonly CommandNode[];
3403
+ register(...commands: readonly CommandNode[]): this;
3404
+ handle(source: Interaction | Message, options?: CommandHandleOptions): Promise<CommandHandleResult>;
3405
+ publish<T = unknown>(target?: CommandPublishTarget): Promise<CommandPublishResult<T>>;
3406
+ private freeze;
3407
+ private handleInteraction;
3408
+ private handleListener;
3409
+ private executeSlash;
3410
+ private handleAutocomplete;
3411
+ private handleMessage;
3412
+ private executeContext;
3413
+ private startAutoDefer;
3414
+ private runChecks;
3415
+ private consumeCooldown;
3416
+ private respondWithResponder;
3417
+ private respondWithoutContext;
3418
+ private rejectionMessage;
3419
+ private emptyAutocomplete;
3420
+ private report;
3421
+ private fail;
3422
+ }
3423
+ //#endregion
3424
+ //#region packages/commands/src/prefix.d.ts
3425
+ interface PrefixMatch {
3426
+ readonly prefix: string;
3427
+ readonly content: string;
3428
+ readonly caseSensitive: boolean;
3429
+ }
3430
+ declare function tokenizePrefix(content: string): readonly string[];
3431
+ //#endregion
3432
+ //#region packages/gateway/src/identify-gate.d.ts
3433
+ /** Coordinates identify calls across concurrency buckets. */
3434
+ declare class IdentifyGate {
3435
+ readonly maxConcurrency: number;
3436
+ private readonly chains;
3437
+ private readonly lastIdentifiedAt;
3438
+ constructor(maxConcurrency: number);
3439
+ acquire(shardId: number): Promise<void>;
3440
+ }
3441
+ //#endregion
3442
+ //#region packages/gateway/src/constants.d.ts
3443
+ /**
3444
+ * Protocol constants for Discord's gateway (API v10). Every value here is
3445
+ * defined by Discord, not by Eunia.
3446
+ */
3447
+ /** The gateway version to speak. Sent as `?v=10` in the connection URL. */
3448
+ declare const GATEWAY_VERSION = 10;
3449
+ /**
3450
+ * Opcodes. The `op` field of every gateway frame.
3451
+ * "receive" = Discord to client, "send" = client to Discord.
3452
+ */
3453
+ declare enum GatewayOpcode {
3454
+ /** receive · An event (READY, MESSAGE_CREATE, …). */
3455
+ Dispatch = 0,
3456
+ /** send + receive · Keep-alive ping. */
3457
+ Heartbeat = 1,
3458
+ /** send · Log in and start a new session. */
3459
+ Identify = 2,
3460
+ /** send · Update the bot's status/activity. */
3461
+ PresenceUpdate = 3,
3462
+ /** send · Join, leave, or move voice channels. */
3463
+ VoiceStateUpdate = 4,
3464
+ /** send · Reattach to an existing session. */
3465
+ Resume = 6,
3466
+ /** receive · Discord asking the client to disconnect and resume. Routine. */
3467
+ Reconnect = 7,
3468
+ /** send · Request a guild's member list in chunks. */
3469
+ RequestGuildMembers = 8,
3470
+ /** receive · The session died. `d: true` = may resume, `d: false` = must re-identify. */
3471
+ InvalidSession = 9,
3472
+ /** receive · First frame after connecting; provides the heartbeat interval. */
3473
+ Hello = 10,
3474
+ /** receive · Acknowledges a heartbeat. */
3475
+ HeartbeatAck = 11
3476
+ }
3477
+ /**
3478
+ * Intents. Which event groups the bot receives, combined into a bitfield
3479
+ * in IDENTIFY.
3480
+ *
3481
+ * Privileged intents (marked ⚠) must also be enabled in the developer
3482
+ * portal, or the gateway closes the connection with code 4014 on identify.
3483
+ * Note that message *events* and message *content* are separate intents.
3484
+ */
3485
+ declare const Intents: {
3486
+ readonly Guilds: number;
3487
+ /** ⚠ privileged */
3488
+ readonly GuildMembers: number;
3489
+ readonly GuildModeration: number;
3490
+ readonly GuildExpressions: number;
3491
+ readonly GuildIntegrations: number;
3492
+ readonly GuildWebhooks: number;
3493
+ readonly GuildInvites: number;
3494
+ readonly GuildVoiceStates: number;
3495
+ /** ⚠ privileged */
3496
+ readonly GuildPresences: number;
3497
+ readonly GuildMessages: number;
3498
+ readonly GuildMessageReactions: number;
3499
+ readonly GuildMessageTyping: number;
3500
+ readonly DirectMessages: number;
3501
+ readonly DirectMessageReactions: number;
3502
+ readonly DirectMessageTyping: number;
3503
+ /** ⚠ privileged */
3504
+ readonly MessageContent: number;
3505
+ readonly GuildScheduledEvents: number;
3506
+ readonly AutoModerationConfiguration: number;
3507
+ readonly AutoModerationExecution: number;
3508
+ readonly GuildMessagePolls: number;
3509
+ readonly DirectMessagePolls: number;
3510
+ };
3511
+ /**
3512
+ * Close codes Discord uses when it closes the WebSocket. Standard codes
3513
+ * (1000 normal, 1006 abnormal) also appear.
3514
+ */
3515
+ declare enum GatewayCloseCode {
3516
+ UnknownError = 4000,
3517
+ UnknownOpcode = 4001,
3518
+ DecodeError = 4002,
3519
+ NotAuthenticated = 4003,
3520
+ AuthenticationFailed = 4004,
3521
+ AlreadyAuthenticated = 4005,
3522
+ InvalidSequence = 4007,
3523
+ RateLimited = 4008,
3524
+ SessionTimedOut = 4009,
3525
+ InvalidShard = 4010,
3526
+ ShardingRequired = 4011,
3527
+ InvalidApiVersion = 4012,
3528
+ InvalidIntents = 4013,
3529
+ DisallowedIntents = 4014
3530
+ }
3531
+ /**
3532
+ * Close codes where reconnecting can never help. The problem is the bot's
3533
+ * configuration (bad token, disallowed intents, wrong shard setup). The
3534
+ * shard refuses to retry these so a config mistake can't burn through the
3535
+ * daily identify budget.
3536
+ */
3537
+ declare const FATAL_CLOSE_CODES: ReadonlySet<number>;
3538
+ //#endregion
3539
+ //#region packages/gateway/src/types.d.ts
3540
+ declare enum ActivityType {
3541
+ Playing = 0,
3542
+ Streaming = 1,
3543
+ Listening = 2,
3544
+ Watching = 3,
3545
+ Custom = 4,
3546
+ Competing = 5
3547
+ }
3548
+ interface GatewayActivity {
3549
+ name: string;
3550
+ type: ActivityType;
3551
+ url?: string | null;
3552
+ state?: string | null;
3553
+ }
3554
+ interface GatewayPresence {
3555
+ since: number | null;
3556
+ activities: GatewayActivity[];
3557
+ status: "online" | "dnd" | "idle" | "invisible" | "offline";
3558
+ afk: boolean;
3559
+ }
3560
+ /**
3561
+ * The envelope for every gateway frame, in both directions.
3562
+ *
3563
+ * `op` is the opcode, `d` the data (its shape depends on the opcode),
3564
+ * `s` the sequence number, and `t` the event name. `s` and `t` are only
3565
+ * non-null on Dispatch (op 0) frames.
3566
+ */
3567
+ interface GatewayPayload<D = unknown> {
3568
+ op: GatewayOpcode;
3569
+ d: D;
3570
+ s: number | null;
3571
+ t: string | null;
3572
+ }
3573
+ /**
3574
+ * Data of the HELLO frame, the first thing Discord sends after connecting.
3575
+ * `heartbeat_interval` is in milliseconds.
3576
+ */
3577
+ interface HelloData {
3578
+ heartbeat_interval: number;
3579
+ }
3580
+ /**
3581
+ * Data of the IDENTIFY frame, the login payload that starts a new session.
3582
+ * The token is sent bare here; only REST prefixes it with "Bot ".
3583
+ * `shard` is [shardId, shardCount] and may be omitted for a single connection.
3584
+ */
3585
+ interface IdentifyData {
3586
+ token: string;
3587
+ intents: number;
3588
+ properties: {
3589
+ os: string;
3590
+ browser: string;
3591
+ device: string;
3592
+ };
3593
+ shard?: [shardId: number, shardCount: number];
3594
+ presence?: GatewayPresence;
3595
+ large_threshold?: number;
3596
+ }
3597
+ interface RequestGuildMembersData {
3598
+ guild_id: string;
3599
+ query?: string;
3600
+ limit?: number;
3601
+ presences?: boolean;
3602
+ user_ids?: string | string[];
3603
+ nonce?: string;
3604
+ }
3605
+ /**
3606
+ * Data of the RESUME frame. Reattaches to an existing session after a
3607
+ * disconnect. `seq` is the last sequence number that was processed.
3608
+ */
3609
+ interface ResumeData {
3610
+ token: string;
3611
+ session_id: string;
3612
+ seq: number;
3613
+ }
3614
+ /**
3615
+ * Data of the READY event, the first dispatch of a new session.
3616
+ *
3617
+ * `session_id` and `resume_gateway_url` are what make resuming possible and
3618
+ * must be kept: resumes go to that url specifically, not the general
3619
+ * gateway url. Guilds arrive as stubs and fill in through GUILD_CREATE.
3620
+ */
3621
+ interface ReadyData {
3622
+ v: number;
3623
+ user: {
3624
+ id: string;
3625
+ username: string;
3626
+ discriminator: string;
3627
+ };
3628
+ session_id: string;
3629
+ resume_gateway_url: string;
3630
+ guilds: {
3631
+ id: string;
3632
+ unavailable?: boolean;
3633
+ }[];
3634
+ shard?: [number, number];
3635
+ application?: {
3636
+ id: string;
3637
+ flags: number;
3638
+ };
3639
+ }
3640
+ /**
3641
+ * Response of GET /gateway/bot, fetched before connecting.
3642
+ *
3643
+ * `session_start_limit` is the identify budget: how many new sessions the
3644
+ * bot may start before the window resets (`reset_after` is in ms).
3645
+ */
3646
+ interface GatewayBotInfo {
3647
+ url: string;
3648
+ shards: number;
3649
+ session_start_limit: {
3650
+ total: number;
3651
+ remaining: number;
3652
+ reset_after: number;
3653
+ max_concurrency: number;
3654
+ };
3655
+ }
3656
+ //#endregion
3657
+ //#region packages/gateway/src/shard.d.ts
3658
+ /** The connection states a Shard moves through. See the diagram in this file's header. */
3659
+ declare enum ShardState {
3660
+ Idle = "idle",
3661
+ Connecting = "connecting",
3662
+ WaitingForHello = "waiting-for-hello",
3663
+ Identifying = "identifying",
3664
+ Resuming = "resuming",
3665
+ Ready = "ready",
3666
+ Reconnecting = "reconnecting",
3667
+ Disconnected = "disconnected"
3668
+ }
3669
+ /**
3670
+ * Options for a Shard. `url` comes from GET /gateway/bot; `intents` is the
3671
+ * combined bitfield; `shard` is [shardId, shardCount] and defaults to a
3672
+ * single connection.
3673
+ */
3674
+ interface ShardOptions {
3675
+ url: string;
3676
+ token: string;
3677
+ intents: number;
3678
+ shard?: [number, number];
3679
+ presence?: GatewayPresence;
3680
+ largeThreshold?: number;
3681
+ identifyGate?: IdentifyGate;
3682
+ logger?: Logger;
3683
+ }
3684
+ /** Details of a scheduled reconnect. `resume` tells whether the session will be resumed or re-identified. */
3685
+ interface ReconnectInfo {
3686
+ attempt: number;
3687
+ delayMs: number;
3688
+ resume: boolean;
3689
+ reason: string;
3690
+ }
3691
+ /** Why a shard (or client) ended for good. `fatal` means a close code retrying can't fix. */
3692
+ interface CloseInfo {
3693
+ code: number;
3694
+ reason: string;
3695
+ fatal: boolean;
3696
+ }
3697
+ /**
3698
+ * Events a Shard emits. "closed" fires only when the shard is done for
3699
+ * good; ordinary drops surface as "reconnecting" followed by "resumed" or
3700
+ * "ready". Every dispatch, including READY and RESUMED, also flows through
3701
+ * the generic "dispatch" event.
3702
+ */
3703
+ interface Shard {
3704
+ on(event: "ready", listener: (data: ReadyData) => void): this;
3705
+ on(event: "resumed", listener: () => void): this;
3706
+ on(event: "dispatch", listener: (eventName: string, data: unknown) => void): this;
3707
+ on(event: "reconnecting", listener: (info: ReconnectInfo) => void): this;
3708
+ on(event: "closed", listener: (info: CloseInfo) => void): this;
3709
+ emit(event: "ready", data: ReadyData): boolean;
3710
+ emit(event: "resumed"): boolean;
3711
+ emit(event: "dispatch", eventName: string, data: unknown): boolean;
3712
+ emit(event: "reconnecting", info: ReconnectInfo): boolean;
3713
+ emit(event: "closed", info: CloseInfo): boolean;
3714
+ }
3715
+ /**
3716
+ * One gateway connection. Connects, identifies, heartbeats, and keeps
3717
+ * itself alive: ordinary drops are recovered internally with a session
3718
+ * resume (or a fresh identify when the session is gone), with exponential
3719
+ * backoff. Only a fatal close code or `disconnect()` ends it permanently.
3720
+ */
3721
+ declare class Shard extends EventEmitter {
3722
+ private readonly options;
3723
+ private readonly log;
3724
+ private readonly token;
3725
+ /**
3726
+ * The live transport, replaced wholesale on every reconnect. Doubles as
3727
+ * the staleness guard: async work captures the connection it belongs to
3728
+ * and bails when `this.connection` no longer matches.
3729
+ */
3730
+ private connection;
3731
+ private heartbeat;
3732
+ private sendLimiter;
3733
+ /** Which handshake the next HELLO should trigger. */
3734
+ private handshake;
3735
+ private currentState;
3736
+ /** Session state. Survives reconnects and is required for resuming. */
3737
+ private sequence;
3738
+ private sessionId;
3739
+ private resumeGatewayUrl;
3740
+ private reconnectAttempts;
3741
+ private reconnectTimer;
3742
+ private helloTimer;
3743
+ private forceCloseTimer;
3744
+ private intentionalClose;
3745
+ private lastIdentifyAt;
3746
+ /** Non-heartbeat sends chain here so budget delays can't reorder them. */
3747
+ private sendChain;
3748
+ /** Settles the promise returned by connect() on first READY or fatal close. */
3749
+ private pendingConnect;
3750
+ constructor(options: ShardOptions);
3751
+ /** The current connection state. */
3752
+ get state(): ShardState;
3753
+ /** Heartbeat round-trip time in ms, or null before the first ack. */
3754
+ get latencyMs(): number | null;
3755
+ /** Updates this shard's presence. */
3756
+ updatePresence(presence: GatewayPresence): Promise<void>;
3757
+ /** Requests members for one guild on this shard. */
3758
+ requestGuildMembers(request: RequestGuildMembersData): Promise<void>;
3759
+ /**
3760
+ * Connects and logs in. Resolves once the shard is READY; rejects on a
3761
+ * fatal close (bad token, disallowed intents). After it resolves, the
3762
+ * shard handles drops and reconnects on its own.
3763
+ */
3764
+ connect(): Promise<void>;
3765
+ /**
3766
+ * Closes the connection permanently and disables auto-reconnect.
3767
+ * The default close code 1000 tells Discord to discard the session.
3768
+ */
3769
+ disconnect(code?: number, reason?: string): void;
3770
+ private startConnection;
3771
+ private handlePayload;
3772
+ /** Handles HELLO: starts the heartbeat loop, then identifies or resumes. */
3773
+ private handleHello;
3774
+ /** Sends IDENTIFY, starting a new session. */
3775
+ private identify;
3776
+ /**
3777
+ * Sends RESUME.
3778
+ *
3779
+ * Discord replays every event after `seq` in order and then sends RESUMED,
3780
+ * so no events are lost and no identify is spent.
3781
+ */
3782
+ private resume;
3783
+ /**
3784
+ * Handles a dispatch.
3785
+ *
3786
+ * READY and RESUMED are treated specially because they carry session state.
3787
+ * Every dispatch is then emitted through the generic "dispatch" event.
3788
+ */
3789
+ private handleDispatch;
3790
+ /**
3791
+ * Sends one payload, respecting the outbound limit.
3792
+ *
3793
+ * Heartbeats use reserved slots and skip the queue, because a delayed
3794
+ * heartbeat makes the connection look dead. Everything else goes through a
3795
+ * FIFO chain so a budget delay cannot reorder payloads.
3796
+ */
3797
+ private enqueueSend;
3798
+ /** Waits out the send budget if needed, then writes unless the connection was replaced. */
3799
+ private writeWhenAllowed;
3800
+ /**
3801
+ * Kills the current connection so the reconnect machinery replaces it.
3802
+ * For recoverable teardowns only; disconnect() is the permanent version.
3803
+ */
3804
+ private recycle;
3805
+ /**
3806
+ * Asks the connection to close, with a deadline: if the close handshake
3807
+ * never completes, the close is declared locally after the grace period
3808
+ * (1006 = closed abnormally).
3809
+ */
3810
+ private closeConnection;
3811
+ /**
3812
+ * The single teardown path for a live connection. Every ending funnels
3813
+ * through here exactly once; the identity guard makes duplicate calls
3814
+ * (the socket's close event racing the force timer) no-ops.
3815
+ */
3816
+ private finalizeClose;
3817
+ /** Decides what a close means: stop for good, or schedule a comeback. */
3818
+ private settleClose;
3819
+ /** Plans resume-vs-identify and the backoff, then waits it out. */
3820
+ private scheduleReconnect;
3821
+ private setState;
3822
+ private assertReady;
3823
+ }
3824
+ //#endregion
3825
+ //#region packages/gateway/src/manager.d.ts
3826
+ type ShardPlan = "auto" | number | {
3827
+ total: number;
3828
+ ids?: readonly number[];
3829
+ };
3830
+ interface ShardManagerOptions {
3831
+ gateway: GatewayBotInfo;
3832
+ token: string;
3833
+ intents: number;
3834
+ shards?: ShardPlan;
3835
+ presence?: GatewayPresence;
3836
+ largeThreshold?: number;
3837
+ logger?: Logger;
3838
+ }
3839
+ interface ShardManager {
3840
+ on(event: "ready", listener: (sessions: readonly ReadyData[]) => void): this;
3841
+ on(event: "dispatch", listener: (shardId: number, eventName: string, data: unknown) => void): this;
3842
+ on(event: "resumed", listener: (shardId: number) => void): this;
3843
+ on(event: "reconnecting", listener: (shardId: number, info: ReconnectInfo) => void): this;
3844
+ on(event: "closed", listener: (shardId: number, info: CloseInfo) => void): this;
3845
+ emit(event: "ready", sessions: readonly ReadyData[]): boolean;
3846
+ emit(event: "dispatch", shardId: number, eventName: string, data: unknown): boolean;
3847
+ emit(event: "resumed", shardId: number): boolean;
3848
+ emit(event: "reconnecting", shardId: number, info: ReconnectInfo): boolean;
3849
+ emit(event: "closed", shardId: number, info: CloseInfo): boolean;
3850
+ }
3851
+ /** Owns a bot's shard set and identify concurrency. */
3852
+ declare class ShardManager extends EventEmitter {
3853
+ private readonly options;
3854
+ private readonly shardsById;
3855
+ private readonly readyById;
3856
+ private started;
3857
+ readonly totalShards: number;
3858
+ readonly shardIds: readonly number[];
3859
+ constructor(options: ShardManagerOptions);
3860
+ /** Connects every assigned shard and resolves when all are ready. */
3861
+ connect(): Promise<void>;
3862
+ /** Permanently closes every shard. */
3863
+ destroy(reason?: string): void;
3864
+ /** Sends one member request to the shard that owns its guild. */
3865
+ requestGuildMembers(request: RequestGuildMembersData): Promise<void>;
3866
+ /** Applies a presence to every assigned shard. */
3867
+ updatePresence(presence: GatewayPresence): Promise<void>;
3868
+ /** Returns the current heartbeat latency for each shard. */
3869
+ get latencies(): ReadonlyMap<number, number | null>;
3870
+ get averageLatencyMs(): number | null;
3871
+ private shardForGuild;
3872
+ }
3873
+ /** Calculates the shard that owns a guild. */
3874
+ declare function shardIdForGuild(guildId: string, shardCount: number): number;
3875
+ //#endregion
3876
+ //#region packages/client/src/domains/cached.d.ts
3877
+ /**
3878
+ * Shared get/peek/pull triad for domains keyed by a single id.
3879
+ * get = cache first, network on miss; peek = sync cache only;
3880
+ * pull = network always, cache refreshed.
3881
+ */
3882
+ declare abstract class CachedDomain<Raw, Value> {
3883
+ protected readonly ctx: StructureContext;
3884
+ protected readonly store: CacheStore<Raw>;
3885
+ protected constructor(ctx: StructureContext, store: CacheStore<Raw>);
3886
+ protected abstract route(id: string): RoutePath;
3887
+ protected abstract hydrate(raw: Raw): Value;
3888
+ get(id: string): Promise<Value>;
3889
+ peek(id: string): Value | undefined;
3890
+ pull(id: string): Promise<Value>;
3891
+ }
3892
+ //#endregion
3893
+ //#region packages/client/src/domains/channels.d.ts
3894
+ /** Channel cache accessors and REST operations. */
3895
+ declare class ChannelsDomain extends CachedDomain<Channel$1, Channel> {
3896
+ constructor(ctx: StructureContext);
3897
+ protected route(id: string): RoutePath;
3898
+ protected hydrate(raw: Channel$1): Channel;
3899
+ edit(channelId: string, input: ChannelEditInput, audit?: AuditLogOptions): Promise<Channel>;
3900
+ delete(channelId: string, audit?: AuditLogOptions): Promise<Channel>;
3901
+ typing(channelId: string): Promise<void>;
3902
+ }
3903
+ //#endregion
3904
+ //#region packages/client/src/domains/guilds.d.ts
3905
+ /** Guild cache accessors. */
3906
+ declare class GuildsDomain extends CachedDomain<Guild$1, Guild> {
3907
+ constructor(ctx: StructureContext);
3908
+ protected route(id: string): RoutePath;
3909
+ protected hydrate(raw: Guild$1): Guild;
3910
+ }
3911
+ //#endregion
3912
+ //#region packages/client/src/domains/members.d.ts
3913
+ /** Guild member cache accessors and REST operations. */
3914
+ declare class MembersDomain {
3915
+ private readonly ctx;
3916
+ constructor(ctx: StructureContext);
3917
+ get(guildId: string, userId: string): Promise<GuildMember>;
3918
+ peek(guildId: string, userId: string): GuildMember | undefined;
3919
+ pull(guildId: string, userId: string): Promise<GuildMember>;
3920
+ edit(guildId: string, userId: string, input: MemberEditInput): Promise<GuildMember>;
3921
+ kick(guildId: string, userId: string, audit?: AuditLogOptions): Promise<void>;
3922
+ ban(guildId: string, userId: string, input?: BanInput): Promise<void>;
3923
+ unban(guildId: string, userId: string, audit?: AuditLogOptions): Promise<void>;
3924
+ addRole(guildId: string, userId: string, roleId: string, audit?: AuditLogOptions): Promise<void>;
3925
+ removeRole(guildId: string, userId: string, roleId: string, audit?: AuditLogOptions): Promise<void>;
3926
+ private hydrated;
3927
+ }
3928
+ //#endregion
3929
+ //#region packages/client/src/domains/messages.d.ts
3930
+ /** Message cache accessors and REST operations. */
3931
+ declare class MessagesDomain {
3932
+ private readonly ctx;
3933
+ constructor(ctx: StructureContext);
3934
+ get(channelId: string, messageId: string): Promise<Message>;
3935
+ peek(channelId: string, messageId: string): Message | undefined;
3936
+ pull(channelId: string, messageId: string): Promise<Message>;
3937
+ send(channelId: string, input: Sendable): Promise<Message>;
3938
+ edit(channelId: string, messageId: string, input: Sendable): Promise<Message>;
3939
+ delete(channelId: string, messageId: string): Promise<void>;
3940
+ private cacheMessage;
3941
+ }
3942
+ //#endregion
3943
+ //#region packages/client/src/domains/pins.d.ts
3944
+ /** Pin REST operations. */
3945
+ declare class PinsDomain {
3946
+ private readonly ctx;
3947
+ constructor(ctx: StructureContext);
3948
+ add(channelId: string, messageId: string): Promise<void>;
3949
+ remove(channelId: string, messageId: string): Promise<void>;
3950
+ private setPinned;
3951
+ }
3952
+ //#endregion
3953
+ //#region packages/client/src/domains/reactions.d.ts
3954
+ /** Reaction REST operations. */
3955
+ declare class ReactionsDomain {
3956
+ private readonly ctx;
3957
+ constructor(ctx: StructureContext);
3958
+ /** Adds the bot's reaction. */
3959
+ add(channelId: string, messageId: string, emoji: string): Promise<void>;
3960
+ /** Removes one user's reaction; the bot's own when no user id is given. */
3961
+ remove(channelId: string, messageId: string, emoji: string, userId?: string): Promise<void>;
3962
+ /** Removes every reaction, or every reaction for one emoji. */
3963
+ clear(channelId: string, messageId: string, emoji?: string): Promise<void>;
3964
+ }
3965
+ //#endregion
3966
+ //#region packages/client/src/domains/roles.d.ts
3967
+ /** Role cache accessors and REST operations. */
3968
+ declare class RolesDomain {
3969
+ private readonly ctx;
3970
+ constructor(ctx: StructureContext);
3971
+ get(guildId: string, roleId: string): Promise<Role>;
3972
+ peek(guildId: string, roleId: string): Role | undefined;
3973
+ pull(guildId: string, roleId: string): Promise<Role>;
3974
+ list(guildId: string): Promise<ReadonlyMap<string, Role>>;
3975
+ create(guildId: string, input?: RoleEditInput, audit?: AuditLogOptions): Promise<Role>;
3976
+ edit(guildId: string, roleId: string, input: RoleEditInput, audit?: AuditLogOptions): Promise<Role>;
3977
+ delete(guildId: string, roleId: string, audit?: AuditLogOptions): Promise<void>;
3978
+ }
3979
+ //#endregion
3980
+ //#region packages/client/src/domains/users.d.ts
3981
+ /** User cache accessors. */
3982
+ declare class UsersDomain extends CachedDomain<User$1, User> {
3983
+ constructor(ctx: StructureContext);
3984
+ protected route(id: string): RoutePath;
3985
+ protected hydrate(raw: User$1): User;
3986
+ }
3987
+ //#endregion
3988
+ //#region packages/client/src/modules.d.ts
3989
+ interface EuniaModule {
3990
+ readonly name: string;
3991
+ readonly dependsOn?: readonly string[];
3992
+ setup?(client: Client): Awaitable$1<void>;
3993
+ start?(client: Client): Awaitable$1<void>;
3994
+ stop?(client: Client): Awaitable$1<void>;
3995
+ }
3996
+ /** Orders modules so every dependency starts first. */
3997
+ declare function orderModules(modules: readonly EuniaModule[]): readonly EuniaModule[];
3998
+ //#endregion
3999
+ //#region packages/client/src/options.d.ts
4000
+ type IntentInput = number | readonly number[];
4001
+ interface ClientGatewayOptions {
4002
+ readonly shards?: ShardPlan;
4003
+ readonly presence?: GatewayPresence;
4004
+ readonly largeThreshold?: number;
4005
+ }
4006
+ interface ClientCommandOptions extends CommandManagerOptions {
4007
+ readonly commands?: readonly CommandNode[];
4008
+ readonly publishOnStart?: false | CommandPublishTarget;
4009
+ }
4010
+ interface ClientOptions {
4011
+ readonly token: string;
4012
+ readonly intents: IntentInput;
4013
+ readonly applicationId?: string;
4014
+ readonly botId?: string;
4015
+ readonly ownerIds?: readonly string[];
4016
+ readonly rest?: Omit<RestOptions, "token">;
4017
+ readonly gateway?: ClientGatewayOptions;
4018
+ readonly cache?: CacheOptions | StructureCache;
4019
+ readonly commands?: ClientCommandOptions;
4020
+ readonly modules?: readonly EuniaModule[];
4021
+ readonly logger?: Logger;
4022
+ }
4023
+ declare function resolveIntents(intents: IntentInput): number;
4024
+ //#endregion
4025
+ //#region packages/client/src/services.d.ts
4026
+ type ServiceKey = string | symbol;
4027
+ /** Stores services shared by Eunia modules. */
4028
+ declare class ServiceRegistry {
4029
+ private readonly services;
4030
+ provide<T>(key: ServiceKey, service: T): this;
4031
+ get<T>(key: ServiceKey): T;
4032
+ resolve<T>(key: ServiceKey): T | undefined;
4033
+ has(key: ServiceKey): boolean;
4034
+ delete(key: ServiceKey): boolean;
4035
+ clear(): void;
4036
+ }
4037
+ //#endregion
4038
+ //#region packages/client/src/client.d.ts
4039
+ type ClientState = "idle" | "starting" | "ready" | "stopping" | "stopped" | "failed";
4040
+ interface GuildDeleteInfo {
4041
+ readonly id: string;
4042
+ readonly unavailable: boolean;
4043
+ readonly guild?: Guild;
4044
+ }
4045
+ interface GuildMemberRemoveInfo {
4046
+ readonly guildId: string;
4047
+ readonly userId: string;
4048
+ readonly member?: GuildMember;
4049
+ }
4050
+ interface RoleDeleteInfo {
4051
+ readonly guildId: string;
4052
+ readonly roleId: string;
4053
+ readonly role?: Role;
4054
+ }
4055
+ interface MessageDeleteInfo extends MessageDeleteEvent {
4056
+ readonly message?: Message;
4057
+ }
4058
+ interface MessageDeleteBulkInfo extends MessageDeleteBulkEvent {
4059
+ readonly messages: readonly Message[];
4060
+ }
4061
+ interface Client {
4062
+ embeds: EmbedRegistry;
4063
+ components: ComponentRegistry;
4064
+ modals: ModalRegistry;
4065
+ on(event: "ready", listener: (user: User) => void): this;
4066
+ on(event: "stopped", listener: () => void): this;
4067
+ on(event: "stateChange", listener: (state: ClientState, previous: ClientState) => void): this;
4068
+ on(event: "userUpdate", listener: (user: User, previous?: User) => void): this;
4069
+ on(event: "guildCreate", listener: (guild: Guild) => void): this;
4070
+ on(event: "guildUpdate", listener: (guild: Guild, previous?: Guild) => void): this;
4071
+ on(event: "guildDelete", listener: (info: GuildDeleteInfo) => void): this;
4072
+ on(event: "channelCreate", listener: (channel: Channel) => void): this;
4073
+ on(event: "channelUpdate", listener: (channel: Channel, previous?: Channel) => void): this;
4074
+ on(event: "channelDelete", listener: (channel: Channel) => void): this;
4075
+ on(event: "messageCreate", listener: (message: Message) => void): this;
4076
+ on(event: "messageUpdate", listener: (message: Message | undefined, previous: Message | undefined, raw: MessageUpdateEvent) => void): this;
4077
+ on(event: "messageDelete", listener: (info: MessageDeleteInfo) => void): this;
4078
+ on(event: "messageDeleteBulk", listener: (info: MessageDeleteBulkInfo) => void): this;
4079
+ on(event: "guildMemberAdd", listener: (member: GuildMember) => void): this;
4080
+ on(event: "guildMemberUpdate", listener: (member: GuildMember, previous?: GuildMember) => void): this;
4081
+ on(event: "guildMemberRemove", listener: (info: GuildMemberRemoveInfo) => void): this;
4082
+ on(event: "roleCreate", listener: (role: Role) => void): this;
4083
+ on(event: "roleUpdate", listener: (role: Role, previous?: Role) => void): this;
4084
+ on(event: "roleDelete", listener: (info: RoleDeleteInfo) => void): this;
4085
+ on(event: "interactionCreate", listener: (interaction: Interaction) => void): this;
4086
+ on(event: "dispatch", listener: (eventName: string, data: unknown, shardId: number) => void): this;
4087
+ on(event: "shardReconnecting", listener: (shardId: number, info: ReconnectInfo) => void): this;
4088
+ on(event: "shardResumed", listener: (shardId: number) => void): this;
4089
+ on(event: "shardClosed", listener: (shardId: number, info: CloseInfo) => void): this;
4090
+ on(event: "commandResult", listener: (result: CommandHandleResult, source: Interaction | Message) => void): this;
4091
+ on(event: "commandError", listener: (error: CommandError, context?: CommandContext | AutocompleteContext) => void): this;
4092
+ on(event: "clientError", listener: (error: unknown, source: string) => void): this;
4093
+ emit(event: "ready", user: User): boolean;
4094
+ emit(event: "stopped"): boolean;
4095
+ emit(event: "stateChange", state: ClientState, previous: ClientState): boolean;
4096
+ emit(event: "userUpdate", user: User, previous?: User): boolean;
4097
+ emit(event: "guildCreate", guild: Guild): boolean;
4098
+ emit(event: "guildUpdate", guild: Guild, previous?: Guild): boolean;
4099
+ emit(event: "guildDelete", info: GuildDeleteInfo): boolean;
4100
+ emit(event: "channelCreate", channel: Channel): boolean;
4101
+ emit(event: "channelUpdate", channel: Channel, previous?: Channel): boolean;
4102
+ emit(event: "channelDelete", channel: Channel): boolean;
4103
+ emit(event: "messageCreate", message: Message): boolean;
4104
+ emit(event: "messageUpdate", message: Message | undefined, previous: Message | undefined, raw: MessageUpdateEvent): boolean;
4105
+ emit(event: "messageDelete", info: MessageDeleteInfo): boolean;
4106
+ emit(event: "messageDeleteBulk", info: MessageDeleteBulkInfo): boolean;
4107
+ emit(event: "guildMemberAdd", member: GuildMember): boolean;
4108
+ emit(event: "guildMemberUpdate", member: GuildMember, previous?: GuildMember): boolean;
4109
+ emit(event: "guildMemberRemove", info: GuildMemberRemoveInfo): boolean;
4110
+ emit(event: "roleCreate", role: Role): boolean;
4111
+ emit(event: "roleUpdate", role: Role, previous?: Role): boolean;
4112
+ emit(event: "roleDelete", info: RoleDeleteInfo): boolean;
4113
+ emit(event: "interactionCreate", interaction: Interaction): boolean;
4114
+ emit(event: "dispatch", eventName: string, data: unknown, shardId: number): boolean;
4115
+ emit(event: "shardReconnecting", shardId: number, info: ReconnectInfo): boolean;
4116
+ emit(event: "shardResumed", shardId: number): boolean;
4117
+ emit(event: "shardClosed", shardId: number, info: CloseInfo): boolean;
4118
+ emit(event: "commandResult", result: CommandHandleResult, source: Interaction | Message): boolean;
4119
+ emit(event: "commandError", error: CommandError, context?: CommandContext | AutocompleteContext): boolean;
4120
+ emit(event: "clientError", error: unknown, source: string): boolean;
4121
+ }
4122
+ /** Connects Eunia's transport, cache, structures, commands, and modules. */
4123
+ declare class Client extends EventEmitter {
4124
+ readonly rest: EuniaRest;
4125
+ readonly cache: StructureCache;
4126
+ readonly context: StructureContext;
4127
+ readonly commands: CommandManager;
4128
+ readonly services: ServiceRegistry;
4129
+ readonly users: UsersDomain;
4130
+ readonly guilds: GuildsDomain;
4131
+ readonly channels: ChannelsDomain;
4132
+ readonly messages: MessagesDomain;
4133
+ readonly members: MembersDomain;
4134
+ readonly roles: RolesDomain;
4135
+ readonly reactions: ReactionsDomain;
4136
+ readonly pins: PinsDomain;
4137
+ private readonly log;
4138
+ private readonly token;
4139
+ private readonly intents;
4140
+ private readonly gatewayOptions;
4141
+ private readonly publishOnStart;
4142
+ private readonly configuredModules;
4143
+ private readonly activeModules;
4144
+ private readonly readyByShard;
4145
+ private gatewayManager?;
4146
+ private currentState;
4147
+ private startPromise?;
4148
+ private stopPromise?;
4149
+ private stopRequested;
4150
+ private startupError;
4151
+ private applicationIdValue;
4152
+ private botIdValue;
4153
+ constructor(options: ClientOptions);
4154
+ get state(): ClientState;
4155
+ get isReady(): boolean;
4156
+ get applicationId(): string | undefined;
4157
+ get botId(): string | undefined;
4158
+ get self(): User | undefined;
4159
+ get latencyMs(): number | null;
4160
+ get latencies(): ReadonlyMap<number, number | null>;
4161
+ get shardIds(): readonly number[];
4162
+ get totalShards(): number;
4163
+ get readySessions(): ReadonlyMap<number, Readonly<ReadyEvent>>;
4164
+ use(module: EuniaModule): this;
4165
+ start(): Promise<this>;
4166
+ stop(): Promise<void>;
4167
+ destroy(): Promise<void>;
4168
+ [Symbol.asyncDispose](): Promise<void>;
4169
+ updatePresence(presence: GatewayPresence): Promise<void>;
4170
+ requestGuildMembers(request: RequestGuildMembersData): Promise<void>;
4171
+ /** @internal Updates identity from one shard's READY event. */
4172
+ recordReady(ready: ReadyEvent, shardId: number): void;
4173
+ /** @internal Sends a structure through the command framework. */
4174
+ handleCommand(source: Interaction | Message): Promise<CommandHandleResult>;
4175
+ private startInternal;
4176
+ private stopInternal;
4177
+ private stopModules;
4178
+ private wireGateway;
4179
+ private commandPermissions;
4180
+ private loadPermissionResource;
4181
+ private requireGateway;
4182
+ private throwIfStopRequested;
4183
+ private setState;
4184
+ private emitSafely;
4185
+ private reportClientError;
4186
+ }
4187
+ //#endregion
4188
+ export { API_VERSION, ActivityType, type AttachmentOptionConfig, type AuditLogOptions, type AutoDeferOptions, type AutocompleteContext, AutocompleteError, type Awaitable, type BanInput, type BooleanOptionConfig, type BuiltInCacheAdapterConfig, type BuiltInCacheDomain, ButtonListenerField, type CDNImageOptions, CDN_BASE_URL, Cache, Cache as EuniaCache, type CacheAdapter, type CacheAdapterOperation, CacheBackpressureError, type CacheBackpressureOperation, type CacheErrorContext, type CacheErrorHandler, type CacheOptions, type CachePolicy, type CacheShape, CacheStore, type CacheStoreOptions, Channel, type ChannelEditInput, type ChannelOptionConfig, Client, type ClientCommandOptions, type ClientGatewayOptions, type ClientOptions, type ClientState, type CloseInfo, Command, type CommandChoice, type CommandContext, CommandError, type CommandErrorCode, CommandExecutionError, CommandGroup, type CommandGuard, type CommandGuardFailure, type CommandHandleOptions, type CommandHandleResult, type CommandHost, type CommandKind, CommandManager, type CommandManagerOptions, type CommandMessageFactory, type CommandMessages, type CommandMiddleware, type CommandNode, type CommandNodeClass, CommandOptionError, type CommandPermissionData, type CommandPublishResult, type CommandPublishTarget, type CommandRateLimit, CommandRejection, type CommandRejectionCode, type CommandRest, CommandValidationError, ComponentRegistry, ComponentTemplates, ConsoleLogger, type CooldownRequest, type CooldownResult, type CooldownScope, type CooldownStore, CooldownStoreError, DEFAULT_CACHE_MAX_PENDING_OPERATIONS, DEFAULT_CACHE_POLICIES, DEFAULT_CACHE_READ_THROUGH_TTL, DISCORD_EPOCH, type DeferOptions, DiscordError, DuplicateCommandError, EmbedRegistry, EmbedTemplates, type EuniaModule, EuniaRest, FATAL_CLOSE_CODES, type FocusedOption, GATEWAY_VERSION, type GatewayActivity, type GatewayBotInfo, GatewayCloseCode, GatewayOpcode, type GatewayPayload, type GatewayPresence, Guild, type GuildBanInput, type GuildDeleteInfo, GuildMember, type GuildMemberRemoveInfo, type HelloData, type HttpMethod, type IdentifyData, type ImageExtension, type IntentInput, Intents, type Interaction, InteractionAlreadyAcknowledgedError, type InteractionKind, InteractionNotAcknowledgedError, type InteractionState, type ListenerButtonInput, type ListenerContext, type ListenerField, type ListenerHandler, type ListenerKind, type ListenerModalInput, type ListenerSelectInput, type LogLevel, type Logger, type LoggerOptions, type MemberEditInput, type MemoryAdapterConfig, MemoryCooldownStore, type MemoryCooldownStoreOptions, MemoryStore, type MemoryStoreOptions, type MentionableOptionConfig, Message, type MessageDeleteBulkInfo, type MessageDeleteInfo, type MessageRequestParts, MiddlewareError, type ModalFieldValue, ModalListenerField, ModalRegistry, ModalTemplatePayload, ModalTemplates, type NumericOptionConfig, type OptionAccess, OptionField, type OriginalMessage, PermissionFlags, type PrefixCommandContext, type PrefixMatch, type PrefixOptions, type PrefixResolver, type PrefixValue, type QueryValue, RateLimitExhaustedError, type ReadyData, type ReconnectInfo, type RedisAdapterConfig, RedisCacheAdapter, type RedisCacheAdapterOptions, type RedisClientLike, RegistrationFrozenError, type RequestGuildMembersData, type RequestPath, type ResolvedAttachment, type ResolvedCachePolicy, type ResolvedChannel, type ResolvedMentionable, type ResolvedRole, type ResolvedStructureSource, type ResolvedUser, type RestDiagnostics, type RestFile, type RestOptions, type RestRequestOptions, type ResumeData, Role, type RoleCreateInput, type RoleDeleteInfo, type RoleEditInput, type RoleOptionConfig, type RoutePath, SelectListenerField, type Sendable, type ServiceKey, ServiceRegistry, Shard, ShardManager, type ShardManagerOptions, type ShardOptions, type ShardPlan, ShardState, SilentLogger, type SlashCommandContext, type StringOptionConfig, type StructureCache, type StructureCacheShape, type StructureContext, type TemplateMap, type TemplateRegistry, User, type UserOptionConfig, ValkeyCacheAdapter, can, canAny, cdnAssetUrl, componentTemplates, createInteraction, createLogger, defineComponents, defineEmbeds, defineModals, embedTemplates, formatLogPrefix, isInteraction, memberCacheKey, missing, modalTemplates, normalizeSendable, onButton, onModal, onSelect, option, orderModules, removeCachedGuildChannel, removeCachedGuildMember, resolveIntents, routePath, shardIdForGuild, snowflakeTimestamp, splitMessageFiles, toFlagNames, toPermissionBits, tokenizePrefix, index_d_exports as types, upsertCachedGuildChannel, upsertCachedGuildMember, upsertCachedGuildMembers, withQuery };