wumbly 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +275 -2
  3. package/dist/client.cjs +1437 -0
  4. package/dist/client.cjs.map +1 -0
  5. package/dist/client.d.cts +3 -0
  6. package/dist/client.d.ts +3 -0
  7. package/dist/client.js +1400 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/commands.cjs +244 -0
  10. package/dist/commands.cjs.map +1 -0
  11. package/dist/commands.d.cts +3 -0
  12. package/dist/commands.d.ts +3 -0
  13. package/dist/commands.js +209 -0
  14. package/dist/commands.js.map +1 -0
  15. package/dist/events.cjs +133 -0
  16. package/dist/events.cjs.map +1 -0
  17. package/dist/events.d.cts +3 -0
  18. package/dist/events.d.ts +3 -0
  19. package/dist/events.js +97 -0
  20. package/dist/events.js.map +1 -0
  21. package/dist/index-0P9mmVy0.d.cts +597 -0
  22. package/dist/index-CR7RtVXn.d.ts +597 -0
  23. package/dist/index.cjs +1578 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +77 -0
  26. package/dist/index.d.ts +77 -0
  27. package/dist/index.js +1494 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/loader.cjs +208 -0
  30. package/dist/loader.cjs.map +1 -0
  31. package/dist/loader.d.cts +3 -0
  32. package/dist/loader.d.ts +3 -0
  33. package/dist/loader.js +178 -0
  34. package/dist/loader.js.map +1 -0
  35. package/dist/permissions.cjs +250 -0
  36. package/dist/permissions.cjs.map +1 -0
  37. package/dist/permissions.d.cts +135 -0
  38. package/dist/permissions.d.ts +135 -0
  39. package/dist/permissions.js +214 -0
  40. package/dist/permissions.js.map +1 -0
  41. package/dist/voice.cjs +125 -0
  42. package/dist/voice.cjs.map +1 -0
  43. package/dist/voice.d.cts +3 -0
  44. package/dist/voice.d.ts +3 -0
  45. package/dist/voice.js +97 -0
  46. package/dist/voice.js.map +1 -0
  47. package/package.json +81 -4
@@ -0,0 +1,597 @@
1
+ import { Permissions, PermissionResolvable, PermissionOverwrite } from './permissions.js';
2
+ import { EventEmitter } from 'node:events';
3
+
4
+ interface RestOptions {
5
+ token?: string;
6
+ baseUrl?: string;
7
+ }
8
+ declare class RestClient {
9
+ token: string | null;
10
+ baseUrl: string;
11
+ constructor(options?: RestOptions);
12
+ setToken(token: string): void;
13
+ request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
14
+ get<T = unknown>(path: string): Promise<T>;
15
+ post<T = unknown>(path: string, body?: unknown): Promise<T>;
16
+ patch<T = unknown>(path: string, body?: unknown): Promise<T>;
17
+ put<T = unknown>(path: string, body?: unknown): Promise<T>;
18
+ delete<T = unknown>(path: string, body?: unknown): Promise<T>;
19
+ }
20
+
21
+ interface User {
22
+ id: string;
23
+ username?: string;
24
+ bot?: boolean;
25
+ global_name?: string | null;
26
+ discriminator?: string;
27
+ [k: string]: unknown;
28
+ }
29
+ interface GuildRole {
30
+ id: string;
31
+ name?: string;
32
+ color?: number;
33
+ position?: number;
34
+ permissions?: string | number | bigint;
35
+ [k: string]: unknown;
36
+ }
37
+ interface Guild {
38
+ id: string;
39
+ name?: string;
40
+ shardId?: number;
41
+ ownerId?: string | null;
42
+ icon?: string | null;
43
+ iconURL?: (opts?: any) => string | null;
44
+ roles?: GuildRole[];
45
+ channels?: {
46
+ cache?: Map<string, Channel> | Record<string, Channel>;
47
+ get?: (id: string) => Channel | undefined;
48
+ fetch?: (id: string) => Promise<Channel>;
49
+ };
50
+ members?: {
51
+ me?: GuildMember | null;
52
+ cache?: Map<string, GuildMember>;
53
+ get?: (id: string) => GuildMember | undefined;
54
+ fetch?: (id: string) => Promise<GuildMember>;
55
+ fetchMe?: () => Promise<GuildMember>;
56
+ };
57
+ [k: string]: unknown;
58
+ }
59
+ interface GuildMember {
60
+ id?: string;
61
+ user?: User;
62
+ roles?: Array<string | {
63
+ id?: string;
64
+ }>;
65
+ permissions?: Permissions;
66
+ permissionsIn?: (channel: Channel) => Permissions;
67
+ has?: (...flags: PermissionResolvable[]) => boolean;
68
+ voice?: {
69
+ channelId?: string | null;
70
+ channel_id?: string | null;
71
+ };
72
+ voiceState?: {
73
+ channelId?: string | null;
74
+ channel_id?: string | null;
75
+ };
76
+ [k: string]: unknown;
77
+ }
78
+ interface PermissionOverwriteEditOptions {
79
+ /** Defaults to the cached type, then to a role overwrite. */
80
+ type?: number;
81
+ allow?: PermissionResolvable;
82
+ deny?: PermissionResolvable;
83
+ }
84
+ interface PermissionOverwriteManager {
85
+ readonly cache: Map<string, PermissionOverwrite>;
86
+ get(id: string): PermissionOverwrite | null;
87
+ has(id: string): boolean;
88
+ values(): IterableIterator<PermissionOverwrite>;
89
+ toArray(): PermissionOverwrite[];
90
+ edit(id: string, options: PermissionOverwriteEditOptions): Promise<PermissionOverwrite>;
91
+ create(id: string, options: PermissionOverwriteEditOptions): Promise<PermissionOverwrite>;
92
+ delete(id: string): Promise<void>;
93
+ }
94
+ interface Channel {
95
+ id: string;
96
+ guildId?: string;
97
+ guild?: Guild | null;
98
+ type?: number;
99
+ send?: (options: any) => Promise<Message>;
100
+ isVoice?: () => boolean;
101
+ isTextBased?: () => boolean;
102
+ permissionOverwrites?: PermissionOverwriteManager;
103
+ members?: Map<string, GuildMember> | GuildMember[] | {
104
+ values?: () => Iterable<GuildMember>;
105
+ };
106
+ [k: string]: unknown;
107
+ }
108
+ interface Message {
109
+ id?: string;
110
+ content: string;
111
+ author: User;
112
+ guildId?: string | null;
113
+ channelId?: string;
114
+ channel?: Channel | null;
115
+ guild?: Guild | null;
116
+ member?: GuildMember | null;
117
+ reply: (options: any, replyOptions?: any) => Promise<Message>;
118
+ [k: string]: unknown;
119
+ }
120
+ interface ClientEventMap {
121
+ ready: [];
122
+ messageCreate: [Message];
123
+ messageUpdate: [Message, Message];
124
+ messageDelete: [Message];
125
+ guildCreate: [Guild];
126
+ guildDelete: [any];
127
+ voiceStateUpdate: [any];
128
+ voiceServerUpdate: [any];
129
+ voiceStateAck: [any];
130
+ voiceStatesSync: [any];
131
+ error: [unknown];
132
+ raw: [any];
133
+ [k: string]: any[];
134
+ }
135
+ type ClientEventName = keyof ClientEventMap;
136
+ type ClientEvents = ClientEventMap;
137
+
138
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
139
+ interface PlatformClientOptions {
140
+ token?: string;
141
+ apiBase?: string;
142
+ gatewayUrl?: string;
143
+ intents?: number;
144
+ /** Minimum level written to the console. Defaults to `info`. */
145
+ logLevel?: LogLevel;
146
+ }
147
+ declare function makeLogger(level?: LogLevel): {
148
+ debug: (msg: string, data?: unknown) => void;
149
+ info: (msg: string, data?: unknown) => void;
150
+ warn: (msg: string, data?: unknown) => void;
151
+ error: (msg: string, data?: unknown) => void;
152
+ };
153
+ declare class PlatformClient extends EventEmitter {
154
+ readonly rest: RestClient;
155
+ readonly logger: ReturnType<typeof makeLogger>;
156
+ readonly guilds: any;
157
+ readonly channels: any;
158
+ readonly users: Map<string, User>;
159
+ user: User | null;
160
+ ws: any;
161
+ options: PlatformClientOptions;
162
+ readyAt: number | null;
163
+ private readyResolve;
164
+ constructor(options?: PlatformClientOptions);
165
+ get uptime(): number | null;
166
+ /**
167
+ * Normalize a guild payload. Gateway payloads often omit `owner_id` and
168
+ * deliver members as an array, so both are handled here.
169
+ */
170
+ private wrapGuild;
171
+ /** Attach permission helpers to a raw member payload. */
172
+ private wrapMember;
173
+ private wrapChannel;
174
+ /** Overwrite manager backed by `PUT/DELETE /channels/:id/permissions/:id`. */
175
+ private createOverwriteManager;
176
+ login(token: string, _options?: {
177
+ signal?: AbortSignal;
178
+ }): Promise<void>;
179
+ destroy(): Promise<void>;
180
+ sendToGateway(_shardId: number, payload: any): void;
181
+ private handleDispatch;
182
+ /**
183
+ * Cache a gateway guild. Gateway payloads can include `roles` but omit
184
+ * `owner_id`, so the REST guild is fetched once and merged before the
185
+ * `guildCreate` event is emitted.
186
+ */
187
+ private handleGuildCreate;
188
+ sendMessage(channelId: string, options: any): Promise<Message>;
189
+ }
190
+
191
+ /** Call to continue to the next middleware or to the command itself. */
192
+ type MiddlewareNext = () => Promise<void>;
193
+ /** Options accepted by {@link Middleware}. */
194
+ interface MiddlewareOptions {
195
+ /** Optional label used in logs and errors. */
196
+ name?: string;
197
+ run: (ctx: CommandContext, next: MiddlewareNext) => Awaitable<unknown>;
198
+ }
199
+ /**
200
+ * Code that runs before a command.
201
+ *
202
+ * Call `next()` to continue. Skip it to stop the command, optionally replying
203
+ * through `ctx.reply()` first.
204
+ *
205
+ * @example
206
+ * export default createMiddleware({
207
+ * name: 'guild-only',
208
+ * run: async (ctx, next) => {
209
+ * if (!ctx.guild) {
210
+ * await ctx.reply('This command only works in a server.');
211
+ * return;
212
+ * }
213
+ * await next();
214
+ * },
215
+ * });
216
+ */
217
+ declare class Middleware {
218
+ readonly name: string | null;
219
+ readonly run: (ctx: CommandContext, next: MiddlewareNext) => Awaitable<unknown>;
220
+ constructor(options: MiddlewareOptions);
221
+ }
222
+ /** Create a middleware. */
223
+ declare function createMiddleware(options: MiddlewareOptions): Middleware;
224
+
225
+ /** Anything a provider can play. Providers may support only a subset. */
226
+ type VoiceSource = string | Uint8Array | AsyncIterable<Uint8Array>;
227
+ interface VoicePlayOptions {
228
+ /** Optional volume hint, 0..1. */
229
+ volume?: number;
230
+ /** Loop the source when the provider supports it. */
231
+ loop?: boolean;
232
+ }
233
+ /** One active voice connection. */
234
+ interface VoiceSession {
235
+ readonly provider: string;
236
+ readonly channel: Channel;
237
+ /** Leave the channel and release resources. */
238
+ leave(): Promise<void>;
239
+ /** Play a source. Optional: not every provider implements playback. */
240
+ play?(source: VoiceSource, options?: VoicePlayOptions): Promise<void>;
241
+ /** Stop the current source. Optional. */
242
+ stop?(): void;
243
+ }
244
+ /**
245
+ * Voice is a plug-in boundary on purpose.
246
+ */
247
+ interface VoiceProvider {
248
+ readonly name: string;
249
+ join(client: Client, channel: Channel): Promise<VoiceSession>;
250
+ }
251
+
252
+ /** A value that may or may not be a promise. */
253
+ type Awaitable<T> = T | Promise<T>;
254
+ /**
255
+ * Prefix for text commands.
256
+ *
257
+ * A function receives the message and can return a prefix, `null` to ignore it,
258
+ * or a promise for either. Returning a string does not mean the message matched:
259
+ * the client still checks `message.content.startsWith(prefix)`.
260
+ */
261
+ type PrefixOption = string | readonly string[] | ((message: Message) => Awaitable<string | null | false | undefined>);
262
+ /** User-facing strings used by the framework. Override any of them. */
263
+ interface ClientMessages {
264
+ guildOnly: string;
265
+ ownerOnly: string;
266
+ cooldown: (retryAfterMs: number) => string;
267
+ error: string;
268
+ }
269
+ /** Options accepted by {@link Client}. */
270
+ interface ClientOptions {
271
+ /** Options forwarded to the underlying platform client. */
272
+ client?: PlatformClientOptions;
273
+ /** Prefix (or prefixes) used for text commands. Default: `!`. */
274
+ prefix?: PrefixOption;
275
+ /** User IDs allowed to run commands marked `ownerOnly`. */
276
+ owners?: readonly string[];
277
+ /** Whether messages from other bots are allowed to trigger commands. Default: `false`. */
278
+ allowBots?: boolean;
279
+ /** Whether commands can run in DMs. Default: `true`. */
280
+ allowDMs?: boolean;
281
+ /** Middlewares that run before every command, in order. */
282
+ middlewares?: readonly Middleware[];
283
+ /** Directory containing commands. Loaded by `load()`. */
284
+ commandsDir?: string;
285
+ /** Directory containing events. Loaded by `load()`. */
286
+ eventsDir?: string;
287
+ /** @deprecated Use `eventsDir`. */
288
+ listenersDir?: string;
289
+ /** Extra directories to scan for both commands and events. */
290
+ loadDirs?: readonly string[];
291
+ /** File extensions the loader accepts. Defaults to JS on Node and JS+TS on Bun. */
292
+ extensions?: readonly string[];
293
+ /** File or directory names skipped by the loader. */
294
+ ignore?: readonly string[];
295
+ /** Add a cache-busting query to imported files. Default: `true`. */
296
+ cacheBust?: boolean;
297
+ /** Custom voice provider. No native voice package is bundled. */
298
+ voice?: VoiceProvider;
299
+ /** Overrides for built-in messages. */
300
+ messages?: Partial<ClientMessages>;
301
+ /** Called when a command throws. Default: log and reply with `messages.error`. */
302
+ onCommandError?: (error: unknown, ctx: CommandContext) => Awaitable<unknown>;
303
+ /** Called when an event throws. Default: log the event and error. */
304
+ onEventError?: (error: unknown, event: ClientEventName, args: readonly unknown[]) => Awaitable<unknown>;
305
+ /** @deprecated Use `onEventError`. */
306
+ onListenerError?: (error: unknown, event: ClientEventName, args: readonly unknown[]) => Awaitable<unknown>;
307
+ }
308
+
309
+ /** Runtime brand used by the loader to recognise commands. */
310
+ declare const COMMAND_BRAND: unique symbol;
311
+ /** Where a cooldown bucket is stored. Default: `user`. */
312
+ type CooldownScope = 'user' | 'guild' | 'channel' | 'global';
313
+ /** Sliding-window cooldown. */
314
+ interface CooldownOptions {
315
+ /** How many uses are allowed inside the window. */
316
+ limit: number;
317
+ /** Window size in milliseconds. */
318
+ window: number;
319
+ /** Bucket scope. Default: `user`. */
320
+ scope?: CooldownScope;
321
+ }
322
+ /** Options accepted by {@link CommandContext.reply}. */
323
+ type ReplyInput = string | Record<string, unknown>;
324
+ /** Everything a command receives when it runs. */
325
+ interface CommandContext {
326
+ readonly client: Client;
327
+ readonly message: Message;
328
+ readonly command: Command;
329
+ readonly author: User;
330
+ readonly args: readonly string[];
331
+ /** Raw text after the prefix, including the command name. */
332
+ readonly input: string;
333
+ /** `args` joined back together. */
334
+ readonly rest: string;
335
+ readonly channel: Channel | null;
336
+ readonly guild: Guild | null;
337
+ readonly member: GuildMember | null;
338
+ /** Reply to the triggering message. */
339
+ reply(options: ReplyInput): Promise<Message>;
340
+ /** Send in the same channel without a reply reference. */
341
+ send(options: ReplyInput): Promise<Message>;
342
+ }
343
+ /** Options accepted by {@link Command}. */
344
+ interface CommandOptions {
345
+ name: string;
346
+ description?: string;
347
+ aliases?: readonly string[];
348
+ category?: string;
349
+ guildOnly?: boolean;
350
+ ownerOnly?: boolean;
351
+ /** Number means "one use every N milliseconds". */
352
+ cooldown?: CooldownOptions | number;
353
+ middlewares?: readonly Middleware[];
354
+ run: (ctx: CommandContext) => Awaitable<unknown>;
355
+ }
356
+
357
+ /**
358
+ * An immutable command definition.
359
+ *
360
+ * @example
361
+ * export default new Command({
362
+ * name: 'ping',
363
+ * description: 'Check the latency',
364
+ * run: (ctx) => ctx.reply('Pong!'),
365
+ * });
366
+ */
367
+ declare class Command {
368
+ readonly [COMMAND_BRAND]: true;
369
+ readonly name: string;
370
+ readonly description: string;
371
+ readonly aliases: readonly string[];
372
+ readonly category: string | null;
373
+ readonly guildOnly: boolean;
374
+ readonly ownerOnly: boolean;
375
+ readonly cooldown: CooldownOptions | null;
376
+ readonly middlewares: readonly Middleware[];
377
+ readonly run: (ctx: CommandContext) => unknown | Promise<unknown>;
378
+ constructor(options: CommandOptions);
379
+ }
380
+ /** Type guard used by the directory loader. */
381
+ declare function isCommand(value: unknown): value is Command;
382
+ /** Build the object passed to a command's `run`. */
383
+ declare function createCommandContext(client: Client, message: Message, command: Command, args: readonly string[], input: string): CommandContext;
384
+ /** Create a command definition. */
385
+ declare function createCommand(options: CommandOptions): Command;
386
+
387
+ /** Sliding-window cooldown buckets keyed by command and scope. */
388
+ declare class CooldownStore {
389
+ private readonly buckets;
390
+ /** Register a use, or report how long the caller has to wait. */
391
+ consume(command: Command, ctx: CommandContext): {
392
+ ok: true;
393
+ } | {
394
+ ok: false;
395
+ retryAfter: number;
396
+ };
397
+ clear(): void;
398
+ }
399
+
400
+ /** Registry for commands and their aliases. Lookups are case-insensitive. */
401
+ declare class CommandStore {
402
+ private byName;
403
+ private byAlias;
404
+ /** Register one command. Throws if its name or an alias is already taken. */
405
+ add(command: Command): void;
406
+ /** Register several commands, validating every key before committing. */
407
+ addMany(commands: Iterable<Command>): void;
408
+ /** Find a command by name or alias. */
409
+ get(name: string): Command | null;
410
+ has(name: string): boolean;
411
+ /** All registered commands, in insertion order. */
412
+ list(): Command[];
413
+ get size(): number;
414
+ clear(): void;
415
+ }
416
+
417
+ /** Runtime brand used by the loader to recognise events. */
418
+ declare const EVENT_BRAND: unique symbol;
419
+ /** Options accepted by {@link Event}. */
420
+ interface EventOptions<K extends ClientEventName> {
421
+ event: K;
422
+ once?: boolean;
423
+ run: (client: Client, ...args: ClientEvents[K]) => Awaitable<unknown>;
424
+ }
425
+ /**
426
+ * An immutable event definition.
427
+ *
428
+ * @example
429
+ * export default new Event({
430
+ * event: 'ready',
431
+ * once: true,
432
+ * run: (client) => client.logger.info(`Logged in as ${client.user?.username}`),
433
+ * });
434
+ */
435
+ declare class Event<K extends ClientEventName = ClientEventName> {
436
+ readonly [EVENT_BRAND]: true;
437
+ readonly event: K;
438
+ readonly once: boolean;
439
+ readonly run: (client: Client, ...args: ClientEvents[K]) => Awaitable<unknown>;
440
+ constructor(input: EventOptions<K>);
441
+ }
442
+ /** Type guard used by the directory loader. */
443
+ declare function isEvent(value: unknown): value is Event;
444
+ /** Create an event definition. */
445
+ declare function createEvent<K extends ClientEventName>(input: EventOptions<K>): Event<K>;
446
+ /** @deprecated Use `createEvent`. */
447
+ declare function createListener<K extends ClientEventName>(input: EventOptions<K>): Event<K>;
448
+ /** @deprecated Use `EVENT_BRAND`. */
449
+ declare const LISTENER_BRAND: symbol;
450
+ /** @deprecated Use `EventOptions`. */
451
+ type ListenerOptions<K extends ClientEventName> = EventOptions<K>;
452
+ /** @deprecated Use `Event`. */
453
+ declare const Listener: typeof Event;
454
+ /** @deprecated Use `Event`. */
455
+ type Listener<K extends ClientEventName = ClientEventName> = Event<K>;
456
+ /** @deprecated Use `isEvent`. */
457
+ declare function isListener(value: unknown): value is Event;
458
+
459
+ /** Keeps events registered and attaches them to the Fluxer client. */
460
+ declare class EventStore {
461
+ private readonly items;
462
+ private readonly handlers;
463
+ add(event: Event): void;
464
+ addMany(events: Iterable<Event>): void;
465
+ list(): Event[];
466
+ get size(): number;
467
+ /** Attach a event if it has not been attached yet. */
468
+ attachOne(client: Client, event: Event): void;
469
+ /** Attach every known event. */
470
+ attach(client: Client): void;
471
+ /** Remove every attached handler from the client. */
472
+ detach(client: Client): void;
473
+ clear(): void;
474
+ }
475
+ /** @deprecated Use `EventStore`. */
476
+ declare const ListenerStore: typeof EventStore;
477
+ /** @deprecated Use `EventStore`. */
478
+ type ListenerStore = EventStore;
479
+
480
+ interface WalkOptions {
481
+ /** Extensions to include. Defaults to the runtime's defaults. */
482
+ extensions?: readonly string[];
483
+ /** Entry names to skip. Dotfiles and `node_modules` are always skipped. */
484
+ ignore?: readonly string[];
485
+ }
486
+ /** Recursively collect importable module files from a directory. */
487
+ declare function collectFiles(directory: string, options?: WalkOptions): Promise<string[]>;
488
+
489
+ interface LoadOptions extends WalkOptions {
490
+ /** Add a unique query string to each import. Default: `true`. */
491
+ cacheBust?: boolean;
492
+ }
493
+ interface LoadedModules {
494
+ commands: Command[];
495
+ events: Event[];
496
+ files: string[];
497
+ }
498
+ /** Error thrown when a module cannot be imported. */
499
+ declare class ModuleLoadError extends Error {
500
+ readonly file: string;
501
+ constructor(file: string, cause: unknown);
502
+ }
503
+ /** Import a single file and pull commands/events out of its exports. */
504
+ declare function loadFile(file: string, options?: LoadOptions): Promise<{
505
+ commands: Command[];
506
+ events: Event[];
507
+ }>;
508
+ /** Scan a directory recursively and import every command/event it exports. */
509
+ declare function loadDirectory(directory: string, options?: LoadOptions): Promise<LoadedModules>;
510
+
511
+ /** Thrown when voice is used without a provider. */
512
+ declare class VoiceUnavailableError extends Error {
513
+ constructor();
514
+ }
515
+ /** Provider-agnostic voice session registry. */
516
+ declare class VoiceManager {
517
+ readonly client: Client;
518
+ private provider;
519
+ private readonly sessions;
520
+ private readonly voiceStates;
521
+ private attached;
522
+ constructor(client: Client, provider?: VoiceProvider | null);
523
+ /** Start tracking gateway voice states for `getVoiceChannelId`. */
524
+ attach(): this;
525
+ getVoiceChannelId(guildId: string, userId: string): string | null;
526
+ get available(): boolean;
527
+ use(provider: VoiceProvider | null): this;
528
+ get(channelId: string): VoiceSession | null;
529
+ join(channel: Channel): Promise<VoiceSession>;
530
+ leave(channelOrId: Channel | string): Promise<boolean>;
531
+ leaveAll(): Promise<void>;
532
+ }
533
+
534
+ interface ResolvedClientOptions {
535
+ prefix: PrefixOption;
536
+ owners: readonly string[];
537
+ allowBots: boolean;
538
+ allowDMs: boolean;
539
+ middlewares: readonly Middleware[];
540
+ loadDirs: readonly string[];
541
+ extensions?: readonly string[];
542
+ ignore: readonly string[];
543
+ cacheBust: boolean;
544
+ messages: ClientMessages;
545
+ onCommandError?: ClientOptions['onCommandError'];
546
+ onEventError?: ClientOptions['onEventError'];
547
+ }
548
+ /**
549
+ * Client with commands, events, middleware and loading on top.
550
+ */
551
+ declare class Client extends PlatformClient {
552
+ readonly commands: CommandStore;
553
+ readonly eventStore: EventStore;
554
+ /** @deprecated Use `eventStore`. */
555
+ get listenerStore(): EventStore;
556
+ readonly cooldowns: CooldownStore;
557
+ readonly config: ResolvedClientOptions;
558
+ readonly voice: VoiceManager;
559
+ private readonly loadedDirs;
560
+ private started;
561
+ private readonly onMessage;
562
+ constructor(options?: ClientOptions);
563
+ /** Register commands and/or events. */
564
+ register(...items: Array<Command | Event>): this;
565
+ registerCommand(...commands: Command[]): this;
566
+ registerEvent(...events: Event[]): this;
567
+ /** @deprecated Use `registerEvent`. */
568
+ registerListener(...events: Event[]): this;
569
+ /** Load commands and events from the configured directories. */
570
+ load(): Promise<LoadedModules>;
571
+ /** Drop loaded commands/events and scan the configured directories again. */
572
+ reload(): Promise<LoadedModules>;
573
+ /**
574
+ * Load modules, attach events and log in.
575
+ *
576
+ * @param token Token to use. Defaults to `FLUXER_BOT_TOKEN`.
577
+ */
578
+ start(token?: string, options?: {
579
+ signal?: AbortSignal;
580
+ }): Promise<this>;
581
+ /** Detach events, leave voice, and disconnect from Fluxer. */
582
+ stop(): Promise<void>;
583
+ /** Whether `start()` has been called on this instance. */
584
+ get isStarted(): boolean;
585
+ /** Whether a user ID is in `owners`. */
586
+ isOwner(userId: string): boolean;
587
+ /** Called by the event store when an event throws. */
588
+ handleEventError(error: unknown, event: Event, args: readonly unknown[]): Promise<void>;
589
+ /** @deprecated Use `handleEventError`. */
590
+ handleListenerError(error: unknown, event: Event, args: readonly unknown[]): Promise<void>;
591
+ private handleMessage;
592
+ private runMiddlewares;
593
+ private handleCommandError;
594
+ private replySafely;
595
+ }
596
+
597
+ export { createCommandContext as $, type Awaitable as A, type MiddlewareNext as B, COMMAND_BRAND as C, type MiddlewareOptions as D, EVENT_BRAND as E, ModuleLoadError as F, type Guild as G, type PermissionOverwriteManager as H, PlatformClient as I, type PlatformClientOptions as J, type PrefixOption as K, LISTENER_BRAND as L, type Message as M, type ResolvedClientOptions as N, RestClient as O, type PermissionOverwriteEditOptions as P, type VoicePlayOptions as Q, type ReplyInput as R, type VoiceProvider as S, type VoiceSession as T, type User as U, VoiceManager as V, type VoiceSource as W, VoiceUnavailableError as X, type WalkOptions as Y, collectFiles as Z, createCommand as _, type Channel as a, createEvent as a0, createListener as a1, createMiddleware as a2, isCommand as a3, isEvent as a4, isListener as a5, loadDirectory as a6, loadFile as a7, Client as b, type ClientEventMap as c, type ClientEventName as d, type ClientEvents as e, type ClientMessages as f, type ClientOptions as g, Command as h, type CommandContext as i, type CommandOptions as j, CommandStore as k, type CooldownOptions as l, type CooldownScope as m, CooldownStore as n, Event as o, type EventOptions as p, EventStore as q, type GuildMember as r, type GuildRole as s, Listener as t, type ListenerOptions as u, ListenerStore as v, type LoadOptions as w, type LoadedModules as x, type LogLevel as y, Middleware as z };