vimcord 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/dist/index.cjs +878 -727
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +294 -186
- package/dist/index.d.ts +294 -186
- package/dist/index.js +874 -727
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +54 -54
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import {
|
|
2
|
+
import { SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, PermissionResolvable, ActivityType, ContextMenuCommandBuilder, ChatInputCommandInteraction, REST, ClientEvents, CommandInteraction, RepliableInteraction, TextBasedChannel, Message, GuildMember, User, EmbedBuilder, DMChannel, TextChannel, NewsChannel, ThreadChannel, ColorResolvable, ButtonComponentData, APIThumbnailComponent, ActionRowBuilder, MessageActionRowComponentBuilder, ContainerBuilder, BaseMessageOptions, StickerResolvable, PollData, InteractionReplyOptions, MessageMentionOptions, ReplyOptions, ForwardOptions, Client, APIEmbedField, APIEmbed, ClientOptions, Guild, ContextMenuCommandInteraction, MessageComponentType, UserResolvable as UserResolvable$1, MappedInteractionTypes, InteractionCollector, APITextInputComponent, APIStringSelectComponent, APIChannelSelectComponent, APIUserSelectComponent, APIRoleSelectComponent, APIMentionableSelectComponent, APIFileUploadComponent, ModalSubmitInteraction, APIModalInteractionResponseCallbackData, ModalBuilder, Interaction, AwaitModalSubmitOptions, AttachmentBuilder, SelectMenuComponentOptionData, StringSelectMenuOptionBuilder, StringSelectMenuInteraction, ButtonInteraction, MessageReaction, StringSelectMenuBuilder, ButtonBuilder, ReactionCollector, APIButtonComponent, ChannelType, PartialGroupDMChannel, PartialDMChannel, GuildBasedChannel, AnyThreadChannel, VoiceBasedChannel, CategoryChannel, Channel, Role, GuildTextBasedChannel } from 'discord.js';
|
|
3
3
|
import { DotenvConfigOptions } from 'dotenv';
|
|
4
|
-
import mongoose, { QueryOptions, HydratedDocument, Require_id, SchemaDefinition, Schema, Model, RootFilterQuery, ProjectionType, UpdateQuery, PipelineStage, AggregateOptions } from 'mongoose';
|
|
4
|
+
import mongoose, { ClientSessionOptions, QueryOptions, HydratedDocument, Require_id, SchemaDefinition, Schema, Model, RootFilterQuery, mongo, MongooseBaseQueryOptions, CreateOptions, ProjectionType, UpdateQuery, MongooseUpdateQueryOptions, PipelineStage, AggregateOptions } from 'mongoose';
|
|
5
5
|
import { PartialDeep } from 'type-fest';
|
|
6
|
-
import { ScheduledTask } from 'node-cron';
|
|
7
6
|
import EventEmitter from 'node:events';
|
|
7
|
+
import { Loop } from 'qznt';
|
|
8
8
|
import { Interface } from 'node:readline';
|
|
9
9
|
|
|
10
10
|
type AnySlashCommandBuilder = SlashCommandBuilder$1 | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandBuilder | SlashCommandSubcommandsOnlyBuilder | SlashCommandSubcommandGroupBuilder;
|
|
@@ -76,7 +76,9 @@ interface MongoConnectionOptions {
|
|
|
76
76
|
/** The maximum number of attempts to connect to MongoDB @defaultValue `3` */
|
|
77
77
|
maxRetries?: number;
|
|
78
78
|
}
|
|
79
|
-
declare function useMongoDatabase(
|
|
79
|
+
declare function useMongoDatabase(instanceIndex?: number): Promise<MongoDatabase>;
|
|
80
|
+
declare function useReadyMongoDatabase(instanceIndex?: number): Promise<MongoDatabase>;
|
|
81
|
+
declare function createMongoSession(instanceIndex?: number, options?: ClientSessionOptions): Promise<mongoose.mongo.ClientSession>;
|
|
80
82
|
declare class MongoDatabase {
|
|
81
83
|
client: Vimcord;
|
|
82
84
|
readonly name: string;
|
|
@@ -140,6 +142,11 @@ interface VimcordPrefixCommandConfig extends BaseCommandConfig<CommandType.Prefi
|
|
|
140
142
|
allowMentionAsPrefix: boolean;
|
|
141
143
|
/** @default true */
|
|
142
144
|
allowCaseInsensitiveCommandNames: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* A custom resolver to fetch a guild-specific prefix.
|
|
147
|
+
* Returns a string (the prefix) or null/undefined to fallback to default.
|
|
148
|
+
*/
|
|
149
|
+
guildPrefixResolver?: (client: Vimcord, guildId: string) => Promise<string | null | undefined> | string | null | undefined;
|
|
143
150
|
}
|
|
144
151
|
declare function createVimcordPrefixCommandConfig(options?: PartialDeep<VimcordPrefixCommandConfig>): VimcordPrefixCommandConfig;
|
|
145
152
|
|
|
@@ -148,7 +155,7 @@ interface VimcordContextCommandConfig extends BaseCommandConfig<CommandType.Cont
|
|
|
148
155
|
declare function createVimcordContextCommandConfig(options?: PartialDeep<VimcordContextCommandConfig>): VimcordContextCommandConfig;
|
|
149
156
|
|
|
150
157
|
interface LoggerOptions {
|
|
151
|
-
colors?: Partial<typeof
|
|
158
|
+
colors?: Partial<typeof LOGGER_COLORS>;
|
|
152
159
|
prefix?: string | null;
|
|
153
160
|
prefixEmoji?: string | null;
|
|
154
161
|
minLevel?: LogLevel;
|
|
@@ -162,7 +169,7 @@ declare enum LogLevel {
|
|
|
162
169
|
WARN = 3,
|
|
163
170
|
ERROR = 4
|
|
164
171
|
}
|
|
165
|
-
declare const
|
|
172
|
+
declare const LOGGER_COLORS: {
|
|
166
173
|
primary: string;
|
|
167
174
|
success: string;
|
|
168
175
|
warn: string;
|
|
@@ -196,7 +203,7 @@ declare class Logger {
|
|
|
196
203
|
setPrefixEmoji(prefixEmoji: string | null): this;
|
|
197
204
|
setMinLevel(minLevel: LogLevel): this;
|
|
198
205
|
setShowTimestamp(show: boolean): this;
|
|
199
|
-
setColors(colors: Partial<typeof
|
|
206
|
+
setColors(colors: Partial<typeof LOGGER_COLORS>): this;
|
|
200
207
|
log(message: string, ...args: any[]): void;
|
|
201
208
|
debug(message: string, ...args: any[]): void;
|
|
202
209
|
info(message: string, ...args: any[]): void;
|
|
@@ -242,9 +249,9 @@ type VimcordStatusManagerEvents = {
|
|
|
242
249
|
changed: [ClientActivity];
|
|
243
250
|
cleared: [];
|
|
244
251
|
rotation: [ClientActivity];
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
252
|
+
paused: [Loop];
|
|
253
|
+
started: [Loop];
|
|
254
|
+
destroyed: [];
|
|
248
255
|
};
|
|
249
256
|
declare class VimcordStatusManager {
|
|
250
257
|
client: Vimcord;
|
|
@@ -267,116 +274,121 @@ declare class VimcordStatusManager {
|
|
|
267
274
|
clear(): Promise<this>;
|
|
268
275
|
}
|
|
269
276
|
|
|
270
|
-
interface ContextCommandConfig extends
|
|
271
|
-
/** Context menu command builder */
|
|
277
|
+
interface ContextCommandConfig extends BaseCommandConfig<CommandType.Context>, BaseAppCommandConfig {
|
|
272
278
|
builder: ContextMenuCommandBuilder | ((builder: ContextMenuCommandBuilder) => ContextMenuCommandBuilder);
|
|
273
|
-
/** Defer reply */
|
|
274
279
|
deferReply?: boolean | {
|
|
275
280
|
ephemeral?: boolean;
|
|
276
281
|
};
|
|
277
282
|
}
|
|
278
283
|
declare class ContextCommandBuilder extends BaseCommandBuilder<CommandType.Context, ContextCommandConfig> {
|
|
279
284
|
builder: ContextMenuCommandBuilder;
|
|
280
|
-
deferReply?: boolean | {
|
|
281
|
-
ephemeral?: boolean;
|
|
282
|
-
};
|
|
283
|
-
deployment?: AppCommandDeployment;
|
|
284
285
|
constructor(config: ContextCommandConfig);
|
|
286
|
+
private handleExecution;
|
|
285
287
|
private validateBuilder;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
setBuilder(builder: ContextMenuCommandBuilder | ((builder: ContextMenuCommandBuilder) => ContextMenuCommandBuilder)): this;
|
|
289
|
-
setDeferReply(defer: boolean | {
|
|
290
|
-
ephemeral?: boolean;
|
|
291
|
-
}): this;
|
|
288
|
+
setBuilder(builder: ContextCommandConfig["builder"]): this;
|
|
289
|
+
setDeferReply(defer: ContextCommandConfig["deferReply"]): this;
|
|
292
290
|
setDeployment(deployment: AppCommandDeployment): this;
|
|
293
|
-
|
|
291
|
+
setExecute(fn: ContextCommandConfig["execute"]): this;
|
|
292
|
+
toConfig(): ContextCommandConfig;
|
|
294
293
|
}
|
|
295
294
|
|
|
296
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Configuration specific to Prefix-based commands
|
|
297
|
+
*/
|
|
298
|
+
interface PrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
|
|
299
|
+
/** The primary name of the command */
|
|
297
300
|
name: string;
|
|
301
|
+
/** Alternative triggers for this command */
|
|
298
302
|
aliases?: string[];
|
|
303
|
+
/** A brief explanation of what the command does */
|
|
299
304
|
description?: string;
|
|
300
305
|
}
|
|
301
306
|
declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
|
|
302
|
-
name: string;
|
|
303
|
-
aliases?: string[];
|
|
304
|
-
description?: string;
|
|
305
307
|
constructor(config: PrefixCommandConfig);
|
|
306
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Specialized execution logic for Prefix Commands.
|
|
310
|
+
*/
|
|
311
|
+
private handleExecution;
|
|
312
|
+
private validatePrefixConfig;
|
|
313
|
+
/**
|
|
314
|
+
* Set the primary name of the command.
|
|
315
|
+
*/
|
|
316
|
+
setName(name: string): this;
|
|
317
|
+
/**
|
|
318
|
+
* Set or replace the command aliases.
|
|
319
|
+
*/
|
|
320
|
+
setAliases(aliases: string[]): this;
|
|
321
|
+
/**
|
|
322
|
+
* Add additional aliases without clearing existing ones.
|
|
323
|
+
*/
|
|
324
|
+
addAliases(...aliases: string[]): this;
|
|
325
|
+
/**
|
|
326
|
+
* Set the command description.
|
|
327
|
+
*/
|
|
328
|
+
setDescription(description: string): this;
|
|
329
|
+
/**
|
|
330
|
+
* Override setExecute to ensure handleExecution remains the entry point.
|
|
331
|
+
* This is the only base method we need to redefine.
|
|
332
|
+
*/
|
|
333
|
+
setExecute(fn: PrefixCommandConfig["execute"]): this;
|
|
334
|
+
/**
|
|
335
|
+
* Converts the current builder state back into a config object.
|
|
336
|
+
*/
|
|
307
337
|
toConfig(): PrefixCommandConfig;
|
|
308
|
-
executeCommand(client: Vimcord<true>, message: Message): Promise<any>;
|
|
309
338
|
}
|
|
310
339
|
|
|
311
|
-
interface SlashCommandConfig extends
|
|
312
|
-
/** Slash command builder */
|
|
340
|
+
interface SlashCommandConfig extends BaseCommandConfig<CommandType.Slash>, BaseAppCommandConfig {
|
|
313
341
|
builder: AnySlashCommandBuilder | ((builder: SlashCommandBuilder$1) => AnySlashCommandBuilder);
|
|
314
|
-
/** Defer reply */
|
|
315
342
|
deferReply?: boolean | {
|
|
316
343
|
ephemeral?: boolean;
|
|
317
344
|
};
|
|
318
|
-
|
|
319
|
-
deployment?: AppCommandDeployment;
|
|
320
|
-
/** Map sub-command names to their own execute handler */
|
|
321
|
-
routes?: {
|
|
345
|
+
routes?: Array<{
|
|
322
346
|
name: string;
|
|
323
347
|
handler: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
324
|
-
}
|
|
325
|
-
/** Executed when an unmapped sub-command route is used */
|
|
348
|
+
}>;
|
|
326
349
|
onUnknownRouteHandler?: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
327
350
|
}
|
|
328
351
|
declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash, SlashCommandConfig> {
|
|
329
352
|
builder: AnySlashCommandBuilder;
|
|
330
|
-
|
|
331
|
-
ephemeral?: boolean;
|
|
332
|
-
};
|
|
333
|
-
deployment?: AppCommandDeployment;
|
|
334
|
-
routes: Map<string, (...args: any) => any>;
|
|
335
|
-
onUnknownRouteHandler?: (...args: any) => any;
|
|
353
|
+
private readonly routes;
|
|
336
354
|
constructor(config: SlashCommandConfig);
|
|
355
|
+
private handleExecution;
|
|
337
356
|
private validateBuilder;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
setBuilder(builder: AnySlashCommandBuilder | ((builder: SlashCommandBuilder$1) => AnySlashCommandBuilder)): this;
|
|
341
|
-
setDeferReply(defer: boolean | {
|
|
342
|
-
ephemeral?: boolean;
|
|
343
|
-
}): this;
|
|
357
|
+
setBuilder(builder: SlashCommandConfig["builder"]): this;
|
|
358
|
+
setDeferReply(defer: SlashCommandConfig["deferReply"]): this;
|
|
344
359
|
setDeployment(deployment: AppCommandDeployment): this;
|
|
345
|
-
setRoutes(...routes:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
name: string;
|
|
351
|
-
handler: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
352
|
-
}[]): this;
|
|
353
|
-
setUnknownRouteHandler(handler: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any): this;
|
|
354
|
-
executeCommand(client: Vimcord<true>, interaction: ChatInputCommandInteraction): Promise<any>;
|
|
360
|
+
setRoutes(...routes: NonNullable<SlashCommandConfig["routes"]>): this;
|
|
361
|
+
addRoutes(...routes: NonNullable<SlashCommandConfig["routes"]>): this;
|
|
362
|
+
setUnknownRouteHandler(handler: SlashCommandConfig["onUnknownRouteHandler"]): this;
|
|
363
|
+
setExecute(fn: SlashCommandConfig["execute"]): this;
|
|
364
|
+
toConfig(): SlashCommandConfig;
|
|
355
365
|
}
|
|
356
366
|
|
|
357
367
|
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
358
368
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Shared logic for Application Commands (Slash & Context)
|
|
371
|
+
*/
|
|
372
|
+
declare abstract class VimcordAppCommandManager<T extends CommandType.Slash | CommandType.Context> {
|
|
373
|
+
protected client: Vimcord;
|
|
374
|
+
protected typeName: string;
|
|
375
|
+
commands: Map<string, VimcordCommandBuilderByType<T>>;
|
|
376
|
+
protected rest: REST;
|
|
377
|
+
constructor(client: Vimcord, typeName: string);
|
|
378
|
+
get(name: string): VimcordCommandBuilderByType<T> | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* Filters and returns commands based on deployment options
|
|
381
|
+
*/
|
|
371
382
|
getAll(options?: {
|
|
372
383
|
names?: string[];
|
|
373
384
|
fuzzyNames?: string[];
|
|
374
|
-
guilds?: string[];
|
|
375
385
|
globalOnly?: boolean;
|
|
376
386
|
ignoreDeploymentOptions?: boolean;
|
|
377
|
-
}): Map<string,
|
|
378
|
-
|
|
379
|
-
|
|
387
|
+
}): Map<string, VimcordCommandBuilderByType<T>>;
|
|
388
|
+
registerGlobal(options?: {
|
|
389
|
+
commands?: string[];
|
|
390
|
+
fuzzyCommands?: string[];
|
|
391
|
+
}): Promise<void>;
|
|
380
392
|
registerGuild(options?: {
|
|
381
393
|
commands?: string[];
|
|
382
394
|
fuzzyCommands?: string[];
|
|
@@ -385,27 +397,28 @@ declare class VimcordSlashCommandManager {
|
|
|
385
397
|
unregisterGuild(options?: {
|
|
386
398
|
guilds?: string[];
|
|
387
399
|
}): Promise<void>;
|
|
388
|
-
registerGlobal(options?: {
|
|
389
|
-
commands?: string[];
|
|
390
|
-
fuzzyCommands?: string[];
|
|
391
|
-
}): Promise<void>;
|
|
392
400
|
unregisterGlobal(): Promise<void>;
|
|
393
401
|
}
|
|
402
|
+
declare class VimcordSlashCommandManager extends VimcordAppCommandManager<CommandType.Slash> {
|
|
403
|
+
constructor(client: Vimcord);
|
|
404
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
405
|
+
}
|
|
406
|
+
declare class VimcordContextCommandManager extends VimcordAppCommandManager<CommandType.Context> {
|
|
407
|
+
constructor(client: Vimcord);
|
|
408
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
409
|
+
}
|
|
394
410
|
declare class VimcordPrefixCommandManager {
|
|
395
|
-
client
|
|
411
|
+
private client;
|
|
396
412
|
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
397
413
|
constructor(client: Vimcord);
|
|
398
|
-
|
|
399
|
-
getByAlias(alias: string): PrefixCommandBuilder | undefined;
|
|
400
|
-
/** Import command modules that end with `.prefix` */
|
|
414
|
+
resolve(trigger: string): PrefixCommandBuilder | undefined;
|
|
401
415
|
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
402
416
|
}
|
|
403
|
-
declare class
|
|
404
|
-
|
|
405
|
-
|
|
417
|
+
declare class VimcordCommandManager {
|
|
418
|
+
readonly slash: VimcordSlashCommandManager;
|
|
419
|
+
readonly prefix: VimcordPrefixCommandManager;
|
|
420
|
+
readonly context: VimcordContextCommandManager;
|
|
406
421
|
constructor(client: Vimcord);
|
|
407
|
-
/** Import command modules that end with `.ctx` */
|
|
408
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
409
422
|
}
|
|
410
423
|
|
|
411
424
|
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
@@ -544,10 +557,17 @@ interface VimcordToolsConfig {
|
|
|
544
557
|
embedColor: ColorResolvable[];
|
|
545
558
|
embedColorDev: ColorResolvable[];
|
|
546
559
|
timeouts: {
|
|
560
|
+
collectorTimeout: number;
|
|
561
|
+
collectorIdle: number;
|
|
547
562
|
pagination: number;
|
|
548
563
|
prompt: number;
|
|
549
564
|
modalSubmit: number;
|
|
550
565
|
};
|
|
566
|
+
collector: {
|
|
567
|
+
notAParticipantMessage: string;
|
|
568
|
+
userLockMessage: string;
|
|
569
|
+
notAParticipantWarningCooldown: number;
|
|
570
|
+
};
|
|
551
571
|
paginator: {
|
|
552
572
|
notAParticipantMessage: string;
|
|
553
573
|
jumpableThreshold: number;
|
|
@@ -575,10 +595,17 @@ declare function createToolsConfig(options?: PartialDeep<VimcordToolsConfig>): V
|
|
|
575
595
|
embedColor?: ColorResolvable[] | undefined;
|
|
576
596
|
embedColorDev?: ColorResolvable[] | undefined;
|
|
577
597
|
timeouts?: {
|
|
598
|
+
collectorTimeout?: number | undefined;
|
|
599
|
+
collectorIdle?: number | undefined;
|
|
578
600
|
pagination?: number | undefined;
|
|
579
601
|
prompt?: number | undefined;
|
|
580
602
|
modalSubmit?: number | undefined;
|
|
581
603
|
} | undefined;
|
|
604
|
+
collector?: {
|
|
605
|
+
notAParticipantMessage?: string | undefined;
|
|
606
|
+
userLockMessage?: string | undefined;
|
|
607
|
+
notAParticipantWarningCooldown?: number | undefined;
|
|
608
|
+
} | undefined;
|
|
582
609
|
paginator?: {
|
|
583
610
|
notAParticipantMessage?: string | undefined;
|
|
584
611
|
jumpableThreshold?: number | undefined;
|
|
@@ -649,14 +676,14 @@ declare class BetterContainer {
|
|
|
649
676
|
divider?: boolean;
|
|
650
677
|
spacing?: number;
|
|
651
678
|
}): this;
|
|
652
|
-
addText(text: string | string[]): this;
|
|
679
|
+
addText(text: string | (string | null | undefined)[]): this;
|
|
653
680
|
addMedia(...media: {
|
|
654
681
|
url: string | string[];
|
|
655
682
|
spoiler?: boolean;
|
|
656
683
|
description?: string;
|
|
657
684
|
}[]): this;
|
|
658
685
|
addSection(data: {
|
|
659
|
-
text?: string | string[];
|
|
686
|
+
text?: string | (string | null | undefined)[];
|
|
660
687
|
button?: Partial<ButtonComponentData>;
|
|
661
688
|
thumbnail?: Partial<APIThumbnailComponent>;
|
|
662
689
|
}): this;
|
|
@@ -665,6 +692,9 @@ declare class BetterContainer {
|
|
|
665
692
|
send(handler: SendHandler, options?: DynaSendOptions): Promise<Message | null>;
|
|
666
693
|
}
|
|
667
694
|
|
|
695
|
+
type Mutable<T> = {
|
|
696
|
+
-readonly [P in keyof T]: T[P];
|
|
697
|
+
};
|
|
668
698
|
type SendableComponent = ContainerBuilder | BetterContainer | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
669
699
|
type RequiredDynaSendOptions = DynaSendOptions & ({
|
|
670
700
|
content: string;
|
|
@@ -673,7 +703,7 @@ type RequiredDynaSendOptions = DynaSendOptions & ({
|
|
|
673
703
|
} | {
|
|
674
704
|
components: DynaSendOptions["components"];
|
|
675
705
|
} | {
|
|
676
|
-
files: BaseMessageOptions["files"]
|
|
706
|
+
files: Mutable<BaseMessageOptions["files"]>;
|
|
677
707
|
} | {
|
|
678
708
|
stickers: StickerResolvable[];
|
|
679
709
|
} | {
|
|
@@ -691,7 +721,7 @@ interface DynaSendOptions {
|
|
|
691
721
|
/** Components to send with the message */
|
|
692
722
|
components?: SendableComponent[];
|
|
693
723
|
/** Attachments to send with the message */
|
|
694
|
-
files?: BaseMessageOptions["files"]
|
|
724
|
+
files?: Mutable<BaseMessageOptions["files"]>;
|
|
695
725
|
/** Stickers to send with the message */
|
|
696
726
|
stickers?: StickerResolvable[];
|
|
697
727
|
/** Send a poll */
|
|
@@ -749,10 +779,10 @@ interface BetterEmbedData {
|
|
|
749
779
|
author?: string | BetterEmbedAuthor | null;
|
|
750
780
|
title?: string | BetterEmbedTitle | null;
|
|
751
781
|
thumbnailUrl?: string | null;
|
|
752
|
-
description?: string | string[] | null;
|
|
782
|
+
description?: string | (string | null | undefined)[] | null;
|
|
753
783
|
imageUrl?: string | null;
|
|
754
784
|
footer?: string | BetterEmbedFooter | null;
|
|
755
|
-
fields?: APIEmbedField[];
|
|
785
|
+
fields?: (APIEmbedField | null | undefined)[];
|
|
756
786
|
color?: ColorResolvable | ColorResolvable[] | null;
|
|
757
787
|
timestamp?: number | boolean | Date | null;
|
|
758
788
|
acf?: boolean;
|
|
@@ -945,60 +975,39 @@ declare enum RateLimitScope {
|
|
|
945
975
|
}
|
|
946
976
|
type BaseCommandParameters<T extends CommandType> = T extends CommandType.Slash ? [client: Vimcord<true>, interaction: ChatInputCommandInteraction] : T extends CommandType.Prefix ? [client: Vimcord<true>, message: Message] : T extends CommandType.Context ? [client: Vimcord<true>, interaction: ContextMenuCommandInteraction] : never;
|
|
947
977
|
interface BaseCommandConfig<T extends CommandType> {
|
|
948
|
-
/** Is this command enabled?
|
|
949
|
-
* @default true */
|
|
950
|
-
enabled?: boolean;
|
|
951
|
-
conditions?: Array<(...args: BaseCommandParameters<T>) => boolean>;
|
|
952
|
-
permissions?: CommandPermissions;
|
|
953
|
-
metadata?: CommandMetadata;
|
|
954
|
-
rateLimit?: CommandRateLimitOptions<(...args: BaseCommandParameters<T>) => any>;
|
|
955
|
-
/** Log whenever a command is executed?
|
|
956
|
-
* @default true */
|
|
957
|
-
logExecution?: boolean;
|
|
958
|
-
beforeExecute?: (...args: BaseCommandParameters<T>) => any;
|
|
959
|
-
execute?: (...args: BaseCommandParameters<T>) => any;
|
|
960
|
-
afterExecute?: (result: any, ...args: BaseCommandParameters<T>) => any;
|
|
961
|
-
onMissingPermissions?: (results: CommandPermissionResults, ...args: BaseCommandParameters<T>) => any;
|
|
962
|
-
onConditionsNotMet?: (...args: BaseCommandParameters<T>) => any;
|
|
963
|
-
onUsedWhenDisabled?: (...args: BaseCommandParameters<T>) => any;
|
|
964
|
-
onRateLimit?: (...args: BaseCommandParameters<T>) => any;
|
|
965
|
-
onError?: (error: Error, ...args: BaseCommandParameters<T>) => any;
|
|
966
|
-
}
|
|
967
|
-
interface BaseCommandOptions<T extends CommandType> {
|
|
968
|
-
/** Is this command enabled?
|
|
969
|
-
* @default true */
|
|
978
|
+
/** Is this command enabled? @default true */
|
|
970
979
|
enabled?: boolean;
|
|
971
980
|
/** Custom conditions that must be met for this command to execute */
|
|
972
|
-
conditions?: Array<(...args: BaseCommandParameters<T>) => boolean
|
|
981
|
+
conditions?: Array<(...args: BaseCommandParameters<T>) => boolean | Promise<boolean>>;
|
|
973
982
|
/** Command permission requirements */
|
|
974
983
|
permissions?: CommandPermissions;
|
|
975
984
|
/** Command metadata configuration */
|
|
976
985
|
metadata?: CommandMetadata;
|
|
977
986
|
/** Rate limiting options */
|
|
978
987
|
rateLimit?: CommandRateLimitOptions<(...args: BaseCommandParameters<T>) => any>;
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
deployment?: AppCommandDeployment;
|
|
983
|
-
}
|
|
984
|
-
interface BaseCommandFunctionConfig<T extends CommandType> {
|
|
985
|
-
/** Before command execution */
|
|
988
|
+
/** Log whenever a command is executed? @default true */
|
|
989
|
+
logExecution?: boolean;
|
|
990
|
+
/** Executed before the main command logic */
|
|
986
991
|
beforeExecute?: (...args: BaseCommandParameters<T>) => any;
|
|
987
992
|
/** The main command function that will be executed */
|
|
988
993
|
execute?: (...args: BaseCommandParameters<T>) => any;
|
|
989
|
-
/**
|
|
994
|
+
/** Executed after successful execution */
|
|
990
995
|
afterExecute?: (result: any, ...args: BaseCommandParameters<T>) => any;
|
|
991
|
-
/** Executed when the rate limit is hit */
|
|
992
|
-
onRateLimit?: (...args: BaseCommandParameters<T>) => any;
|
|
993
996
|
/** Executed when the required permissions are not met */
|
|
994
997
|
onMissingPermissions?: (results: CommandPermissionResults, ...args: BaseCommandParameters<T>) => any;
|
|
995
998
|
/** Executed when the required conditions are not met */
|
|
996
999
|
onConditionsNotMet?: (...args: BaseCommandParameters<T>) => any;
|
|
997
1000
|
/** Executed when this command is used when its disabled */
|
|
998
1001
|
onUsedWhenDisabled?: (...args: BaseCommandParameters<T>) => any;
|
|
1002
|
+
/** Executed when the rate limit is hit */
|
|
1003
|
+
onRateLimit?: (...args: BaseCommandParameters<T>) => any;
|
|
999
1004
|
/** Custom error handler */
|
|
1000
1005
|
onError?: (error: Error, ...args: BaseCommandParameters<T>) => any;
|
|
1001
1006
|
}
|
|
1007
|
+
interface BaseAppCommandConfig {
|
|
1008
|
+
/** Command deployment configuration */
|
|
1009
|
+
deployment?: AppCommandDeployment;
|
|
1010
|
+
}
|
|
1002
1011
|
interface CommandInternalRateLimitData {
|
|
1003
1012
|
/** Number of times executed */
|
|
1004
1013
|
executions: number;
|
|
@@ -1006,55 +1015,96 @@ interface CommandInternalRateLimitData {
|
|
|
1006
1015
|
timestamp: number;
|
|
1007
1016
|
}
|
|
1008
1017
|
|
|
1009
|
-
declare class BaseCommandBuilder<T extends CommandType,
|
|
1018
|
+
declare abstract class BaseCommandBuilder<T extends CommandType, O extends BaseCommandConfig<T> = BaseCommandConfig<T>> {
|
|
1010
1019
|
readonly uuid: string;
|
|
1011
1020
|
readonly commandType: T;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
afterExecute?: (result: any, ...args: BaseCommandParameters<T>) => any;
|
|
1021
|
-
onRateLimit?: (...args: BaseCommandParameters<T>) => any;
|
|
1022
|
-
onMissingPermissions?: (results: CommandPermissionResults, ...args: BaseCommandParameters<T>) => any;
|
|
1023
|
-
onConditionsNotMet?: (...args: BaseCommandParameters<T>) => any;
|
|
1024
|
-
onUsedWhenDisabled?: (...args: BaseCommandParameters<T>) => any;
|
|
1025
|
-
onError?: (error: Error, ...args: BaseCommandParameters<T>) => any;
|
|
1026
|
-
private globalRateLimitData;
|
|
1027
|
-
private userRateLimitData;
|
|
1028
|
-
private guildRateLimitData;
|
|
1029
|
-
private channelRateLimitData;
|
|
1030
|
-
constructor(type: T, config: CommandConfig);
|
|
1021
|
+
/** Local command configuration and hooks */
|
|
1022
|
+
protected options: O;
|
|
1023
|
+
/** Internal state for rate limiting across different scopes */
|
|
1024
|
+
private readonly rlStores;
|
|
1025
|
+
/** * Mapping of CommandTypes to their respective config keys in the Vimcord client
|
|
1026
|
+
*/
|
|
1027
|
+
private readonly typeConfigMapping;
|
|
1028
|
+
constructor(type: T, options?: O);
|
|
1031
1029
|
private validateBaseConfig;
|
|
1032
|
-
|
|
1030
|
+
/**
|
|
1031
|
+
* Resolves the final configuration by merging layers:
|
|
1032
|
+
* Client Defaults < Client Type-Specific < Local Command Options
|
|
1033
|
+
*/
|
|
1034
|
+
protected resolveConfig(client: Vimcord): O;
|
|
1035
|
+
/**
|
|
1036
|
+
* Executes the command lifecycle.
|
|
1037
|
+
* Merges global client config with local command options at runtime.
|
|
1038
|
+
*/
|
|
1039
|
+
run(client: Vimcord<true>, ...args: BaseCommandParameters<T>): Promise<void>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Internal logic to determine if a command execution should be throttled.
|
|
1042
|
+
* @param config The merged configuration to use for limits.
|
|
1043
|
+
* @param ctx Extracted Discord context (User, Guild, Channel).
|
|
1044
|
+
*/
|
|
1045
|
+
private isRateLimited;
|
|
1046
|
+
/**
|
|
1047
|
+
* Validates if the user has required permissions.
|
|
1048
|
+
*/
|
|
1049
|
+
private checkPermissions;
|
|
1050
|
+
/**
|
|
1051
|
+
* Evaluates all custom conditions defined for the command.
|
|
1052
|
+
*/
|
|
1053
|
+
private checkConditions;
|
|
1054
|
+
/**
|
|
1055
|
+
* Normalizes the trigger arguments into a standard context object.
|
|
1056
|
+
*/
|
|
1057
|
+
private extractContext;
|
|
1058
|
+
/**
|
|
1059
|
+
* Resolves the storage key based on the RateLimit scope.
|
|
1060
|
+
*/
|
|
1061
|
+
private getScopeKey;
|
|
1062
|
+
/**
|
|
1063
|
+
* Handles command errors by checking local handlers before falling back to global handlers.
|
|
1064
|
+
*/
|
|
1065
|
+
private handleError;
|
|
1066
|
+
/** Toggle command availability */
|
|
1033
1067
|
setEnabled(enabled: boolean): this;
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1068
|
+
/** Merge new permission requirements into the existing ones */
|
|
1069
|
+
setPermissions(perms: CommandPermissions): this;
|
|
1070
|
+
/** Add custom logic checks that run before execution */
|
|
1071
|
+
addConditions(...conditions: Array<(...args: BaseCommandParameters<T>) => boolean | Promise<boolean>>): this;
|
|
1072
|
+
/** Set the primary command execution logic */
|
|
1073
|
+
setExecute(fn: (...args: BaseCommandParameters<T>) => any): this;
|
|
1074
|
+
/** * Set the custom conditions that must be met for this command to execute
|
|
1075
|
+
*/
|
|
1076
|
+
setConditions(conditions: Array<(...args: BaseCommandParameters<T>) => boolean | Promise<boolean>>): this;
|
|
1077
|
+
/** * Set the command metadata configuration
|
|
1078
|
+
*/
|
|
1037
1079
|
setMetadata(metadata: CommandMetadata): this;
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1080
|
+
/** * Set the rate limiting options for this command
|
|
1081
|
+
*/
|
|
1082
|
+
setRateLimit(options: CommandRateLimitOptions<(...args: BaseCommandParameters<T>) => any>): this;
|
|
1083
|
+
/** * Set whether to log whenever this command is executed
|
|
1084
|
+
* @default true
|
|
1085
|
+
*/
|
|
1086
|
+
setLogExecution(log: boolean): this;
|
|
1087
|
+
/** * Set the function to execute before the main command logic
|
|
1088
|
+
*/
|
|
1089
|
+
setBeforeExecute(callback: (...args: BaseCommandParameters<T>) => any): this;
|
|
1090
|
+
/** * Set the function to execute after successful command execution
|
|
1091
|
+
*/
|
|
1092
|
+
setAfterExecute(callback: (result: any, ...args: BaseCommandParameters<T>) => any): this;
|
|
1093
|
+
/** * Set the function to execute when the required permissions are not met
|
|
1094
|
+
*/
|
|
1095
|
+
setOnMissingPermissions(callback: (results: CommandPermissionResults, ...args: BaseCommandParameters<T>) => any): this;
|
|
1096
|
+
/** * Set the function to execute when the required conditions are not met
|
|
1097
|
+
*/
|
|
1098
|
+
setOnConditionsNotMet(callback: (...args: BaseCommandParameters<T>) => any): this;
|
|
1099
|
+
/** * Set the function to execute when this command is used when its disabled
|
|
1100
|
+
*/
|
|
1101
|
+
setOnUsedWhenDisabled(callback: (...args: BaseCommandParameters<T>) => any): this;
|
|
1102
|
+
/** * Set the function to execute when the rate limit is hit
|
|
1103
|
+
*/
|
|
1104
|
+
setOnRateLimit(callback: (...args: BaseCommandParameters<T>) => any): this;
|
|
1105
|
+
/** * Set a custom error handler for this command
|
|
1106
|
+
*/
|
|
1107
|
+
setOnError(callback: (error: Error, ...args: BaseCommandParameters<T>) => any): this;
|
|
1058
1108
|
}
|
|
1059
1109
|
|
|
1060
1110
|
type ExtractReturn<T> = T extends (this: any, ...args: any) => infer R ? Awaited<R> : never;
|
|
@@ -1083,30 +1133,82 @@ declare class MongoSchemaBuilder<Definition extends object> {
|
|
|
1083
1133
|
on<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1084
1134
|
once<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1085
1135
|
off<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1086
|
-
|
|
1136
|
+
/** Execute a function while ensuring the connection is ready. On error it will retry using an exponential backoff. */
|
|
1137
|
+
execute<T extends (...args: any) => any>(fn: T): Promise<ExtractReturn<T> | undefined>;
|
|
1087
1138
|
createHexId(bytes: number, path: keyof Require_id<Definition>, maxRetries?: number): Promise<string | undefined>;
|
|
1088
|
-
count(filter?: RootFilterQuery<Definition>): Promise<number | undefined>;
|
|
1139
|
+
count(filter?: RootFilterQuery<Definition>, options?: mongo.CountOptions & MongooseBaseQueryOptions<Definition> & mongo.Abortable): Promise<number | undefined>;
|
|
1089
1140
|
exists(filter: RootFilterQuery<Definition>): Promise<boolean | undefined>;
|
|
1090
|
-
create(query: Partial<Require_id<Definition>>): Promise<(mongoose.Document<unknown, {}, Definition, {}, {}> & (mongoose.Require_id<Definition> extends infer T ? T extends mongoose.Require_id<Definition> ? T extends {
|
|
1141
|
+
create(query: Partial<Require_id<Definition>>[], options?: CreateOptions): Promise<(mongoose.Document<unknown, {}, Definition, {}, {}> & (mongoose.Require_id<Definition> extends infer T ? T extends mongoose.Require_id<Definition> ? T extends {
|
|
1091
1142
|
__v?: infer U;
|
|
1092
1143
|
} ? T : T & {
|
|
1093
1144
|
__v: number;
|
|
1094
|
-
} : never : never))
|
|
1145
|
+
} : never : never))[]>;
|
|
1095
1146
|
upsert(filter: RootFilterQuery<Definition>, query: Partial<Require_id<Definition>>, options?: QueryOptions<Definition>): Promise<(mongoose.Document<unknown, {}, Definition, {}, {}> & (mongoose.Require_id<Definition> extends infer T ? T extends mongoose.Require_id<Definition> ? T extends {
|
|
1096
1147
|
__v?: infer U;
|
|
1097
1148
|
} ? T : T & {
|
|
1098
1149
|
__v: number;
|
|
1099
1150
|
} : never : never)) | undefined>;
|
|
1100
|
-
delete(filter: RootFilterQuery<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1101
|
-
deleteAll(filter: RootFilterQuery<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1102
|
-
distinct<K extends keyof Require_id<Definition> & string>(key: K, filter?: RootFilterQuery<Definition>): Promise<(K extends keyof Definition | mongoose.NestedPaths<Required<Definition>, keyof Definition> ? mongoose.WithoutUndefined<mongoose.Unpacked<mongoose.WithLevel1NestedPaths<Definition, keyof Definition>[K]>> : unknown)[] | undefined>;
|
|
1151
|
+
delete(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1152
|
+
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1153
|
+
distinct<K extends keyof Require_id<Definition> & string>(key: K, filter?: RootFilterQuery<Definition>, options?: QueryOptions<Definition>): Promise<(K extends keyof Definition | mongoose.NestedPaths<Required<Definition>, keyof Definition> ? mongoose.WithoutUndefined<mongoose.Unpacked<mongoose.WithLevel1NestedPaths<Definition, keyof Definition>[K]>> : unknown)[] | undefined>;
|
|
1103
1154
|
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1104
1155
|
fetchAll<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1105
1156
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1106
|
-
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?:
|
|
1157
|
+
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1107
1158
|
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
1108
1159
|
}
|
|
1109
1160
|
|
|
1161
|
+
interface BetterCollectorOptions<T extends MessageComponentType> {
|
|
1162
|
+
type?: T;
|
|
1163
|
+
participants?: UserResolvable$1[];
|
|
1164
|
+
idle?: number;
|
|
1165
|
+
timeout?: number;
|
|
1166
|
+
/** Run listeners in sequence, awaiting each other */
|
|
1167
|
+
sequential?: boolean;
|
|
1168
|
+
/** Prevent a user from triggering another interaction until their previous one is resolved */
|
|
1169
|
+
userLock?: boolean;
|
|
1170
|
+
max?: number;
|
|
1171
|
+
maxComponents?: number;
|
|
1172
|
+
maxUsers?: number;
|
|
1173
|
+
onTimeout?: CollectorTimeoutType;
|
|
1174
|
+
config?: VimcordToolsConfig;
|
|
1175
|
+
}
|
|
1176
|
+
interface ListenerOptions<ComponentType extends MessageComponentType = MessageComponentType, InGuild extends boolean = boolean> {
|
|
1177
|
+
participants?: UserResolvable$1[];
|
|
1178
|
+
defer?: boolean | {
|
|
1179
|
+
update?: boolean;
|
|
1180
|
+
ephemeral?: boolean;
|
|
1181
|
+
};
|
|
1182
|
+
finally?: (arg: MappedInteractionTypes<InGuild>[ComponentType]) => any;
|
|
1183
|
+
}
|
|
1184
|
+
declare enum CollectorTimeoutType {
|
|
1185
|
+
DisableComponents = 0,
|
|
1186
|
+
DeleteMessage = 1,
|
|
1187
|
+
DoNothing = 2
|
|
1188
|
+
}
|
|
1189
|
+
declare class BetterCollector<ComponentType extends MessageComponentType, InGuild extends boolean = boolean> {
|
|
1190
|
+
message?: Message;
|
|
1191
|
+
collector?: InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
|
|
1192
|
+
options?: BetterCollectorOptions<ComponentType>;
|
|
1193
|
+
private activeUsers;
|
|
1194
|
+
private participantWarningCooldowns;
|
|
1195
|
+
private config;
|
|
1196
|
+
private events;
|
|
1197
|
+
static create<T extends MessageComponentType>(message: Message | undefined | null, options: BetterCollectorOptions<T>): BetterCollector<T, boolean>;
|
|
1198
|
+
private validateParticipant;
|
|
1199
|
+
private build;
|
|
1200
|
+
private setupListeners;
|
|
1201
|
+
private handleListenerError;
|
|
1202
|
+
constructor(message: Message | undefined | null, options?: BetterCollectorOptions<ComponentType>);
|
|
1203
|
+
/** Triggers on any interaction */
|
|
1204
|
+
on(fn: (interaction: MappedInteractionTypes<InGuild>[ComponentType]) => any, options?: ListenerOptions<ComponentType, InGuild>): this;
|
|
1205
|
+
/** Triggers when the interaction's customId matches */
|
|
1206
|
+
on(customId: string, fn: (interaction: MappedInteractionTypes<InGuild>[ComponentType]) => any, options?: ListenerOptions<ComponentType, InGuild>): this;
|
|
1207
|
+
onEnd(fn: (collected: MappedInteractionTypes<InGuild>[ComponentType][], reason: string) => any, options?: ListenerOptions): this;
|
|
1208
|
+
/** Manually stop the collector and trigger cleanup */
|
|
1209
|
+
stop(reason?: string): void;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1110
1212
|
type _TextInputComponentData = Partial<APITextInputComponent> & _LabelComponentData;
|
|
1111
1213
|
type _StringSelectComponentData = Partial<APIStringSelectComponent> & _LabelComponentData;
|
|
1112
1214
|
type _ChannelSelectComponentData = Partial<APIChannelSelectComponent> & _LabelComponentData;
|
|
@@ -1188,7 +1290,7 @@ declare class BetterModal {
|
|
|
1188
1290
|
showAndAwait<T extends Record<string, any> = Record<string, string>>(interaction: Interaction, options?: Omit<AwaitModalSubmitOptions<ModalSubmitInteraction>, "filter">): Promise<ModalSubmitResult<T> | null>;
|
|
1189
1291
|
}
|
|
1190
1292
|
|
|
1191
|
-
type SinglePageResolvable = string | EmbedResolvable | ContainerBuilder | BetterContainer;
|
|
1293
|
+
type SinglePageResolvable = string | EmbedResolvable | ContainerBuilder | BetterContainer | AttachmentBuilder;
|
|
1192
1294
|
type PageResolvable = SinglePageResolvable | EmbedResolvable[];
|
|
1193
1295
|
type Chapter = PageResolvable[];
|
|
1194
1296
|
interface PageIndex {
|
|
@@ -1197,6 +1299,8 @@ interface PageIndex {
|
|
|
1197
1299
|
}
|
|
1198
1300
|
interface ChapterData extends Omit<SelectMenuComponentOptionData, "value"> {
|
|
1199
1301
|
value?: string;
|
|
1302
|
+
/** Optional attachments mapped to each nested page index */
|
|
1303
|
+
files?: (AttachmentBuilder | undefined)[];
|
|
1200
1304
|
}
|
|
1201
1305
|
interface PaginationEvent {
|
|
1202
1306
|
beforeChapterChange: [chapterIndex: number];
|
|
@@ -1210,7 +1314,8 @@ interface PaginationEvent {
|
|
|
1210
1314
|
last: [page: PageResolvable, index: PageIndex];
|
|
1211
1315
|
collect: [interaction: StringSelectMenuInteraction | ButtonInteraction, page: PageResolvable, index: PageIndex];
|
|
1212
1316
|
react: [reaction: MessageReaction, user: User, page: PageResolvable, index: PageIndex];
|
|
1213
|
-
|
|
1317
|
+
preTimeout: [message: Message];
|
|
1318
|
+
postTimeout: [message: Message];
|
|
1214
1319
|
}
|
|
1215
1320
|
interface PaginatorOptions {
|
|
1216
1321
|
/** @default {@link PaginationType.Short} */
|
|
@@ -1223,7 +1328,6 @@ interface PaginatorOptions {
|
|
|
1223
1328
|
/** @default false */
|
|
1224
1329
|
dynamic?: boolean;
|
|
1225
1330
|
timeout?: number;
|
|
1226
|
-
/** @default {@link PaginationTimeoutType.ClearComponents} */
|
|
1227
1331
|
onTimeout?: PaginationTimeoutType;
|
|
1228
1332
|
config?: VimcordToolsConfig;
|
|
1229
1333
|
}
|
|
@@ -1270,12 +1374,14 @@ declare enum PaginationType {
|
|
|
1270
1374
|
declare enum PaginationTimeoutType {
|
|
1271
1375
|
DisableComponents = 0,
|
|
1272
1376
|
ClearComponents = 1,
|
|
1273
|
-
DeleteMessage = 2
|
|
1377
|
+
DeleteMessage = 2,
|
|
1378
|
+
DoNothing = 3
|
|
1274
1379
|
}
|
|
1275
1380
|
declare class Paginator {
|
|
1276
1381
|
chapters: {
|
|
1277
1382
|
id: string;
|
|
1278
1383
|
pages: Chapter;
|
|
1384
|
+
files?: (AttachmentBuilder | undefined)[];
|
|
1279
1385
|
}[];
|
|
1280
1386
|
private options;
|
|
1281
1387
|
private config;
|
|
@@ -1325,6 +1431,7 @@ interface PromptOptions {
|
|
|
1325
1431
|
content?: string;
|
|
1326
1432
|
embed?: EmbedResolvable;
|
|
1327
1433
|
container?: ContainerBuilder | BetterContainer;
|
|
1434
|
+
textOnly?: boolean;
|
|
1328
1435
|
buttons?: {
|
|
1329
1436
|
confirm?: ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | Partial<APIButtonComponent>;
|
|
1330
1437
|
reject?: ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | Partial<APIButtonComponent>;
|
|
@@ -1346,6 +1453,7 @@ declare class Prompt {
|
|
|
1346
1453
|
readonly content?: string;
|
|
1347
1454
|
readonly embed: EmbedResolvable;
|
|
1348
1455
|
readonly container?: ContainerBuilder | BetterContainer;
|
|
1456
|
+
readonly textOnly?: boolean;
|
|
1349
1457
|
readonly buttons: {
|
|
1350
1458
|
confirm: ButtonBuilder;
|
|
1351
1459
|
reject: ButtonBuilder;
|
|
@@ -1490,4 +1598,4 @@ declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Gui
|
|
|
1490
1598
|
|
|
1491
1599
|
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1492
1600
|
|
|
1493
|
-
export { type AnySlashCommandBuilder, type AppCommandDeployment, type BaseAppCommandConfig, BaseCommandBuilder, type BaseCommandConfig, type
|
|
1601
|
+
export { type AnySlashCommandBuilder, type AppCommandDeployment, type BaseAppCommandConfig, BaseCommandBuilder, type BaseCommandConfig, type BaseCommandParameters, type BetterChannelSelectComponent, BetterCollector, type BetterCollectorOptions, BetterContainer, type BetterContainerData, BetterEmbed, type BetterEmbedAuthor, type BetterEmbedContext, type BetterEmbedData, type BetterEmbedFooter, type BetterEmbedTitle, type BetterFileUploadSelectComponent, type BetterMentionableSelectComponent, BetterModal, type BetterModalComponent, type BetterModalOptions, type BetterRoleSelectComponent, type BetterStringSelectComponent, type BetterTextInputComponent, type BetterUserSelectComponent, type ButtonHandler, CLI, type Chapter, type ChapterData, type ClientActivity, type ClientStatus, CollectorTimeoutType, type CommandErrorMessageConfig, type CommandInternalRateLimitData, type CommandMetadata, type CommandPermissionResults, type CommandPermissions, type CommandRateLimitOptions, CommandType, ContextCommandBuilder, type ContextCommandConfig, type CustomButton, DynaSend, type DynaSendOptions, type EmbedResolvable, EventBuilder, type EventConfig, type EventDeployment, type EventMetadata, type EventParameters, type EventRateLimitOptions, type ExtractReturn, type FetchedChannel, type FetchedMessageMention, type GetMessageMentionOptions, type InteractionBasedSendHandler, type InteractionResolveable, LOGGER_COLORS, type LeanOrHydratedDocument, type ListenerOptions, LogLevel, Logger, type LoggerOptions, type MentionType, MissingPermissionReason, type ModalSubmitResult, MongoDatabase, MongoSchemaBuilder, type MongoSchemaEvents, type MongoSchemaOptions, type PageIndex, type PageResolvable, type PaginationEvent, PaginationTimeoutType, PaginationType, Paginator, type PaginatorData, type PaginatorOptions, PrefixCommandBuilder, type PrefixCommandConfig, Prompt, type PromptOptions, PromptResolveType, type PromptResult, RateLimitScope, type RequiredDynaSendOptions, type SendHandler, SendMethod, type SendableComponent, type SendableTextChannel, type SinglePageResolvable, SlashCommandBuilder, type SlashCommandConfig, StatusType, type UserResolvable, Vimcord, type VimcordAppConfig, VimcordCLI, type VimcordCLIOptions, type VimcordClientStatus, type VimcordCommandBuilderByType, VimcordCommandManager, type VimcordConfig, type VimcordConfigOptions, type VimcordContextCommandConfig, VimcordContextCommandManager, type VimcordDatabaseManager, VimcordEventManager, type VimcordFeatures, type VimcordPrefixCommandConfig, VimcordPrefixCommandManager, type VimcordSlashCommandConfig, VimcordSlashCommandManager, type VimcordStaffConfig, VimcordStatusManager, type VimcordToolsConfig, __zero, cleanMention, clientInstances, createClient, createMongoSchema, createMongoSession, createToolsConfig, createVimcordAppConfig, createVimcordContextCommandConfig, createVimcordPrefixCommandConfig, createVimcordSlashCommandConfig, createVimcordStaffConfig, createVimcordStatusConfig, defineGlobalToolsConfig, dynaSend, fetchChannel, fetchGuild, fetchMember, fetchMessage, fetchRole, fetchUser, formatThousands, getCallerFileName, getClientInstances, getFirstMentionId, getMessageMention, getProcessDir, globalVimcordToolsConfig, importModulesFromDir, initCLI, isMentionOrSnowflake, logger, pickRandom, prompt, retryExponentialBackoff, sendCommandErrorEmbed, useClient, useMongoDatabase, useReadyClient, useReadyMongoDatabase, validateCommandPermissions };
|