vimcord 1.0.22 → 1.0.24
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/dist/index.cjs +234 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +77 -54
- package/dist/index.d.ts +77 -54
- package/dist/index.js +228 -181
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, PermissionResolvable, ActivityType, ContextMenuCommandBuilder, ChatInputCommandInteraction,
|
|
2
|
+
import { SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, PermissionResolvable, ActivityType, ContextMenuCommandBuilder, ChatInputCommandInteraction, 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
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';
|
|
@@ -35,6 +35,10 @@ interface CommandPermissions {
|
|
|
35
35
|
interface CommandMetadata {
|
|
36
36
|
/** Command category for categorizing commands */
|
|
37
37
|
category?: string;
|
|
38
|
+
/** Command category emoji
|
|
39
|
+
* @remarks I recommend mapping your own category emojis separately instead of using this
|
|
40
|
+
*/
|
|
41
|
+
categoryEmoji?: string;
|
|
38
42
|
/** Command tags for categorizing commands */
|
|
39
43
|
tags?: string[];
|
|
40
44
|
/** Command usage examples */
|
|
@@ -106,6 +110,17 @@ interface VimcordAppConfig {
|
|
|
106
110
|
/** Disable the vimcord client banner on startup
|
|
107
111
|
* @default false */
|
|
108
112
|
disableBanner: boolean;
|
|
113
|
+
/** Only auto import modules that end with these suffixes */
|
|
114
|
+
moduleSuffixes: {
|
|
115
|
+
/** @default slash */
|
|
116
|
+
slashCommand: "slash";
|
|
117
|
+
/** @default ctx */
|
|
118
|
+
contextCommand: "ctx";
|
|
119
|
+
/** @default prefix */
|
|
120
|
+
prefixCommand: "prefix";
|
|
121
|
+
/** @default event */
|
|
122
|
+
event: "event";
|
|
123
|
+
};
|
|
109
124
|
}
|
|
110
125
|
declare function createVimcordAppConfig(options?: PartialDeep<VimcordAppConfig>): VimcordAppConfig;
|
|
111
126
|
|
|
@@ -245,7 +260,7 @@ interface VimcordClientStatus {
|
|
|
245
260
|
}
|
|
246
261
|
declare function createVimcordStatusConfig(options?: PartialDeep<VimcordClientStatus>): VimcordClientStatus;
|
|
247
262
|
|
|
248
|
-
type
|
|
263
|
+
type StatusManagerEvents = {
|
|
249
264
|
changed: [ClientActivity];
|
|
250
265
|
cleared: [];
|
|
251
266
|
rotation: [ClientActivity];
|
|
@@ -253,10 +268,10 @@ type VimcordStatusManagerEvents = {
|
|
|
253
268
|
started: [Loop];
|
|
254
269
|
destroyed: [];
|
|
255
270
|
};
|
|
256
|
-
declare class
|
|
271
|
+
declare class StatusManager {
|
|
257
272
|
client: Vimcord;
|
|
258
273
|
logger: Logger;
|
|
259
|
-
emitter: EventEmitter<
|
|
274
|
+
emitter: EventEmitter<StatusManagerEvents>;
|
|
260
275
|
lastActivity: ClientActivity | null;
|
|
261
276
|
lastActivityIndex: number;
|
|
262
277
|
private task;
|
|
@@ -304,7 +319,8 @@ interface PrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
|
|
|
304
319
|
description?: string;
|
|
305
320
|
}
|
|
306
321
|
declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
|
|
307
|
-
|
|
322
|
+
options: PrefixCommandConfig;
|
|
323
|
+
constructor(options: PrefixCommandConfig);
|
|
308
324
|
/**
|
|
309
325
|
* Specialized execution logic for Prefix Commands.
|
|
310
326
|
*/
|
|
@@ -366,59 +382,66 @@ declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash,
|
|
|
366
382
|
|
|
367
383
|
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
368
384
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
385
|
+
interface CommandFilter {
|
|
386
|
+
names?: string[];
|
|
387
|
+
fuzzyNames?: string[];
|
|
388
|
+
globalOnly?: boolean;
|
|
389
|
+
ignoreDeploymentOptions?: boolean;
|
|
390
|
+
}
|
|
391
|
+
interface CommandByCategory<T extends CommandType> {
|
|
392
|
+
name: string;
|
|
393
|
+
emoji: string | undefined;
|
|
394
|
+
commands: VimcordCommandBuilderByType<T>[];
|
|
395
|
+
}
|
|
396
|
+
declare class BaseCommandManager<T extends CommandType> {
|
|
397
|
+
readonly type: T;
|
|
398
|
+
readonly client: Vimcord;
|
|
399
|
+
readonly commands: Map<string, VimcordCommandBuilderByType<T>>;
|
|
400
|
+
readonly moduleSuffix?: string;
|
|
401
|
+
constructor(client: Vimcord, type: T, moduleSuffix?: string);
|
|
402
|
+
/**
|
|
403
|
+
* Gets a command by name.
|
|
404
|
+
*/
|
|
378
405
|
get(name: string): VimcordCommandBuilderByType<T> | undefined;
|
|
379
406
|
/**
|
|
380
|
-
*
|
|
407
|
+
* Gets/filters commands and orders them alphabetically
|
|
381
408
|
*/
|
|
382
|
-
getAll(options?:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
commands?: string[];
|
|
394
|
-
fuzzyCommands?: string[];
|
|
395
|
-
guilds?: string[];
|
|
396
|
-
}): Promise<void>;
|
|
397
|
-
unregisterGuild(options?: {
|
|
398
|
-
guilds?: string[];
|
|
399
|
-
}): Promise<void>;
|
|
400
|
-
unregisterGlobal(): Promise<void>;
|
|
409
|
+
getAll(options?: CommandFilter): VimcordCommandBuilderByType<T>[];
|
|
410
|
+
/**
|
|
411
|
+
* Groups commands by category alphabetically.
|
|
412
|
+
*/
|
|
413
|
+
sortByCategory(): CommandByCategory<T>[];
|
|
414
|
+
/**
|
|
415
|
+
* Imports command modules from a directory.
|
|
416
|
+
* @param dir Path of one or more folders.
|
|
417
|
+
* @param set Replaces imported command modules with the ones found.
|
|
418
|
+
*/
|
|
419
|
+
importFrom(dir: string | string[], set?: boolean): Promise<Map<string, VimcordCommandBuilderByType<T>>>;
|
|
401
420
|
}
|
|
402
|
-
declare class
|
|
421
|
+
declare class SlashCommandManager extends BaseCommandManager<CommandType.Slash> {
|
|
403
422
|
constructor(client: Vimcord);
|
|
404
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
405
423
|
}
|
|
406
|
-
declare class
|
|
424
|
+
declare class ContextCommandManager extends BaseCommandManager<CommandType.Context> {
|
|
407
425
|
constructor(client: Vimcord);
|
|
408
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
409
426
|
}
|
|
410
|
-
declare class
|
|
411
|
-
private client;
|
|
412
|
-
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
427
|
+
declare class PrefixCommandManager extends BaseCommandManager<CommandType.Prefix> {
|
|
413
428
|
constructor(client: Vimcord);
|
|
414
|
-
resolve(trigger: string): PrefixCommandBuilder | undefined;
|
|
415
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
416
429
|
}
|
|
417
|
-
declare class
|
|
418
|
-
readonly
|
|
419
|
-
readonly
|
|
420
|
-
readonly
|
|
430
|
+
declare class CommandManager {
|
|
431
|
+
readonly client: Vimcord;
|
|
432
|
+
readonly slash: SlashCommandManager;
|
|
433
|
+
readonly prefix: PrefixCommandManager;
|
|
434
|
+
readonly context: ContextCommandManager;
|
|
421
435
|
constructor(client: Vimcord);
|
|
436
|
+
getAllAppCommands(options?: CommandFilter): (ContextCommandBuilder | SlashCommandBuilder)[];
|
|
437
|
+
registerGlobal(options?: CommandFilter): Promise<void>;
|
|
438
|
+
unregisterGlobal(): Promise<void>;
|
|
439
|
+
registerGuild(options?: CommandFilter & {
|
|
440
|
+
guilds?: string[];
|
|
441
|
+
}): Promise<void>;
|
|
442
|
+
unregisterGuild(options?: {
|
|
443
|
+
guilds?: string[];
|
|
444
|
+
}): Promise<void>;
|
|
422
445
|
}
|
|
423
446
|
|
|
424
447
|
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
@@ -519,7 +542,7 @@ declare class EventBuilder<T extends keyof ClientEvents = keyof ClientEvents> im
|
|
|
519
542
|
executeEvent(...args: EventParameters<T>): Promise<any>;
|
|
520
543
|
}
|
|
521
544
|
|
|
522
|
-
declare class
|
|
545
|
+
declare class EventManager {
|
|
523
546
|
client: Vimcord;
|
|
524
547
|
events: Map<string, EventBuilder<any>>;
|
|
525
548
|
logger: Logger;
|
|
@@ -907,9 +930,9 @@ declare class Vimcord<Ready extends boolean = boolean> extends Client<Ready> {
|
|
|
907
930
|
readonly clientOptions: ClientOptions;
|
|
908
931
|
readonly features: VimcordFeatures;
|
|
909
932
|
readonly config: VimcordConfig;
|
|
910
|
-
status:
|
|
911
|
-
events:
|
|
912
|
-
commands:
|
|
933
|
+
status: StatusManager;
|
|
934
|
+
events: EventManager;
|
|
935
|
+
commands: CommandManager;
|
|
913
936
|
database?: VimcordDatabaseManager;
|
|
914
937
|
logger: Logger & {
|
|
915
938
|
clientBanner(client: Vimcord): void;
|
|
@@ -1152,7 +1175,7 @@ declare class MongoSchemaBuilder<Definition extends object> {
|
|
|
1152
1175
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1153
1176
|
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>;
|
|
1154
1177
|
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1155
|
-
fetchAll<Options extends QueryOptions<Definition>>(filter
|
|
1178
|
+
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1156
1179
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1157
1180
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1158
1181
|
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
@@ -1580,7 +1603,7 @@ declare function createClient(options: ClientOptions, features?: VimcordFeatures
|
|
|
1580
1603
|
declare function getClientInstances(): Vimcord<boolean>[];
|
|
1581
1604
|
|
|
1582
1605
|
declare function getProcessDir(): string;
|
|
1583
|
-
declare function importModulesFromDir<T extends any>(dir: string,
|
|
1606
|
+
declare function importModulesFromDir<T extends any>(dir: string, suffix?: string): Promise<{
|
|
1584
1607
|
module: T;
|
|
1585
1608
|
path: string;
|
|
1586
1609
|
}[]>;
|
|
@@ -1598,4 +1621,4 @@ declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Gui
|
|
|
1598
1621
|
|
|
1599
1622
|
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1600
1623
|
|
|
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,
|
|
1624
|
+
export { type AnySlashCommandBuilder, type AppCommandDeployment, type BaseAppCommandConfig, BaseCommandBuilder, type BaseCommandConfig, BaseCommandManager, 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 CommandByCategory, type CommandErrorMessageConfig, type CommandFilter, type CommandInternalRateLimitData, CommandManager, type CommandMetadata, type CommandPermissionResults, type CommandPermissions, type CommandRateLimitOptions, CommandType, ContextCommandBuilder, type ContextCommandConfig, ContextCommandManager, type CustomButton, DynaSend, type DynaSendOptions, type EmbedResolvable, EventBuilder, type EventConfig, type EventDeployment, EventManager, 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, PrefixCommandManager, Prompt, type PromptOptions, PromptResolveType, type PromptResult, RateLimitScope, type RequiredDynaSendOptions, type SendHandler, SendMethod, type SendableComponent, type SendableTextChannel, type SinglePageResolvable, SlashCommandBuilder, type SlashCommandConfig, SlashCommandManager, StatusManager, StatusType, type UserResolvable, Vimcord, type VimcordAppConfig, VimcordCLI, type VimcordCLIOptions, type VimcordClientStatus, type VimcordCommandBuilderByType, type VimcordConfig, type VimcordConfigOptions, type VimcordContextCommandConfig, type VimcordDatabaseManager, type VimcordFeatures, type VimcordPrefixCommandConfig, type VimcordSlashCommandConfig, type VimcordStaffConfig, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, PermissionResolvable, ActivityType, ContextMenuCommandBuilder, ChatInputCommandInteraction,
|
|
2
|
+
import { SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, PermissionResolvable, ActivityType, ContextMenuCommandBuilder, ChatInputCommandInteraction, 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
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';
|
|
@@ -35,6 +35,10 @@ interface CommandPermissions {
|
|
|
35
35
|
interface CommandMetadata {
|
|
36
36
|
/** Command category for categorizing commands */
|
|
37
37
|
category?: string;
|
|
38
|
+
/** Command category emoji
|
|
39
|
+
* @remarks I recommend mapping your own category emojis separately instead of using this
|
|
40
|
+
*/
|
|
41
|
+
categoryEmoji?: string;
|
|
38
42
|
/** Command tags for categorizing commands */
|
|
39
43
|
tags?: string[];
|
|
40
44
|
/** Command usage examples */
|
|
@@ -106,6 +110,17 @@ interface VimcordAppConfig {
|
|
|
106
110
|
/** Disable the vimcord client banner on startup
|
|
107
111
|
* @default false */
|
|
108
112
|
disableBanner: boolean;
|
|
113
|
+
/** Only auto import modules that end with these suffixes */
|
|
114
|
+
moduleSuffixes: {
|
|
115
|
+
/** @default slash */
|
|
116
|
+
slashCommand: "slash";
|
|
117
|
+
/** @default ctx */
|
|
118
|
+
contextCommand: "ctx";
|
|
119
|
+
/** @default prefix */
|
|
120
|
+
prefixCommand: "prefix";
|
|
121
|
+
/** @default event */
|
|
122
|
+
event: "event";
|
|
123
|
+
};
|
|
109
124
|
}
|
|
110
125
|
declare function createVimcordAppConfig(options?: PartialDeep<VimcordAppConfig>): VimcordAppConfig;
|
|
111
126
|
|
|
@@ -245,7 +260,7 @@ interface VimcordClientStatus {
|
|
|
245
260
|
}
|
|
246
261
|
declare function createVimcordStatusConfig(options?: PartialDeep<VimcordClientStatus>): VimcordClientStatus;
|
|
247
262
|
|
|
248
|
-
type
|
|
263
|
+
type StatusManagerEvents = {
|
|
249
264
|
changed: [ClientActivity];
|
|
250
265
|
cleared: [];
|
|
251
266
|
rotation: [ClientActivity];
|
|
@@ -253,10 +268,10 @@ type VimcordStatusManagerEvents = {
|
|
|
253
268
|
started: [Loop];
|
|
254
269
|
destroyed: [];
|
|
255
270
|
};
|
|
256
|
-
declare class
|
|
271
|
+
declare class StatusManager {
|
|
257
272
|
client: Vimcord;
|
|
258
273
|
logger: Logger;
|
|
259
|
-
emitter: EventEmitter<
|
|
274
|
+
emitter: EventEmitter<StatusManagerEvents>;
|
|
260
275
|
lastActivity: ClientActivity | null;
|
|
261
276
|
lastActivityIndex: number;
|
|
262
277
|
private task;
|
|
@@ -304,7 +319,8 @@ interface PrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
|
|
|
304
319
|
description?: string;
|
|
305
320
|
}
|
|
306
321
|
declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
|
|
307
|
-
|
|
322
|
+
options: PrefixCommandConfig;
|
|
323
|
+
constructor(options: PrefixCommandConfig);
|
|
308
324
|
/**
|
|
309
325
|
* Specialized execution logic for Prefix Commands.
|
|
310
326
|
*/
|
|
@@ -366,59 +382,66 @@ declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash,
|
|
|
366
382
|
|
|
367
383
|
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
368
384
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
385
|
+
interface CommandFilter {
|
|
386
|
+
names?: string[];
|
|
387
|
+
fuzzyNames?: string[];
|
|
388
|
+
globalOnly?: boolean;
|
|
389
|
+
ignoreDeploymentOptions?: boolean;
|
|
390
|
+
}
|
|
391
|
+
interface CommandByCategory<T extends CommandType> {
|
|
392
|
+
name: string;
|
|
393
|
+
emoji: string | undefined;
|
|
394
|
+
commands: VimcordCommandBuilderByType<T>[];
|
|
395
|
+
}
|
|
396
|
+
declare class BaseCommandManager<T extends CommandType> {
|
|
397
|
+
readonly type: T;
|
|
398
|
+
readonly client: Vimcord;
|
|
399
|
+
readonly commands: Map<string, VimcordCommandBuilderByType<T>>;
|
|
400
|
+
readonly moduleSuffix?: string;
|
|
401
|
+
constructor(client: Vimcord, type: T, moduleSuffix?: string);
|
|
402
|
+
/**
|
|
403
|
+
* Gets a command by name.
|
|
404
|
+
*/
|
|
378
405
|
get(name: string): VimcordCommandBuilderByType<T> | undefined;
|
|
379
406
|
/**
|
|
380
|
-
*
|
|
407
|
+
* Gets/filters commands and orders them alphabetically
|
|
381
408
|
*/
|
|
382
|
-
getAll(options?:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
commands?: string[];
|
|
394
|
-
fuzzyCommands?: string[];
|
|
395
|
-
guilds?: string[];
|
|
396
|
-
}): Promise<void>;
|
|
397
|
-
unregisterGuild(options?: {
|
|
398
|
-
guilds?: string[];
|
|
399
|
-
}): Promise<void>;
|
|
400
|
-
unregisterGlobal(): Promise<void>;
|
|
409
|
+
getAll(options?: CommandFilter): VimcordCommandBuilderByType<T>[];
|
|
410
|
+
/**
|
|
411
|
+
* Groups commands by category alphabetically.
|
|
412
|
+
*/
|
|
413
|
+
sortByCategory(): CommandByCategory<T>[];
|
|
414
|
+
/**
|
|
415
|
+
* Imports command modules from a directory.
|
|
416
|
+
* @param dir Path of one or more folders.
|
|
417
|
+
* @param set Replaces imported command modules with the ones found.
|
|
418
|
+
*/
|
|
419
|
+
importFrom(dir: string | string[], set?: boolean): Promise<Map<string, VimcordCommandBuilderByType<T>>>;
|
|
401
420
|
}
|
|
402
|
-
declare class
|
|
421
|
+
declare class SlashCommandManager extends BaseCommandManager<CommandType.Slash> {
|
|
403
422
|
constructor(client: Vimcord);
|
|
404
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
405
423
|
}
|
|
406
|
-
declare class
|
|
424
|
+
declare class ContextCommandManager extends BaseCommandManager<CommandType.Context> {
|
|
407
425
|
constructor(client: Vimcord);
|
|
408
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
409
426
|
}
|
|
410
|
-
declare class
|
|
411
|
-
private client;
|
|
412
|
-
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
427
|
+
declare class PrefixCommandManager extends BaseCommandManager<CommandType.Prefix> {
|
|
413
428
|
constructor(client: Vimcord);
|
|
414
|
-
resolve(trigger: string): PrefixCommandBuilder | undefined;
|
|
415
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
416
429
|
}
|
|
417
|
-
declare class
|
|
418
|
-
readonly
|
|
419
|
-
readonly
|
|
420
|
-
readonly
|
|
430
|
+
declare class CommandManager {
|
|
431
|
+
readonly client: Vimcord;
|
|
432
|
+
readonly slash: SlashCommandManager;
|
|
433
|
+
readonly prefix: PrefixCommandManager;
|
|
434
|
+
readonly context: ContextCommandManager;
|
|
421
435
|
constructor(client: Vimcord);
|
|
436
|
+
getAllAppCommands(options?: CommandFilter): (ContextCommandBuilder | SlashCommandBuilder)[];
|
|
437
|
+
registerGlobal(options?: CommandFilter): Promise<void>;
|
|
438
|
+
unregisterGlobal(): Promise<void>;
|
|
439
|
+
registerGuild(options?: CommandFilter & {
|
|
440
|
+
guilds?: string[];
|
|
441
|
+
}): Promise<void>;
|
|
442
|
+
unregisterGuild(options?: {
|
|
443
|
+
guilds?: string[];
|
|
444
|
+
}): Promise<void>;
|
|
422
445
|
}
|
|
423
446
|
|
|
424
447
|
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
@@ -519,7 +542,7 @@ declare class EventBuilder<T extends keyof ClientEvents = keyof ClientEvents> im
|
|
|
519
542
|
executeEvent(...args: EventParameters<T>): Promise<any>;
|
|
520
543
|
}
|
|
521
544
|
|
|
522
|
-
declare class
|
|
545
|
+
declare class EventManager {
|
|
523
546
|
client: Vimcord;
|
|
524
547
|
events: Map<string, EventBuilder<any>>;
|
|
525
548
|
logger: Logger;
|
|
@@ -907,9 +930,9 @@ declare class Vimcord<Ready extends boolean = boolean> extends Client<Ready> {
|
|
|
907
930
|
readonly clientOptions: ClientOptions;
|
|
908
931
|
readonly features: VimcordFeatures;
|
|
909
932
|
readonly config: VimcordConfig;
|
|
910
|
-
status:
|
|
911
|
-
events:
|
|
912
|
-
commands:
|
|
933
|
+
status: StatusManager;
|
|
934
|
+
events: EventManager;
|
|
935
|
+
commands: CommandManager;
|
|
913
936
|
database?: VimcordDatabaseManager;
|
|
914
937
|
logger: Logger & {
|
|
915
938
|
clientBanner(client: Vimcord): void;
|
|
@@ -1152,7 +1175,7 @@ declare class MongoSchemaBuilder<Definition extends object> {
|
|
|
1152
1175
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1153
1176
|
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>;
|
|
1154
1177
|
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1155
|
-
fetchAll<Options extends QueryOptions<Definition>>(filter
|
|
1178
|
+
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1156
1179
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1157
1180
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1158
1181
|
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
@@ -1580,7 +1603,7 @@ declare function createClient(options: ClientOptions, features?: VimcordFeatures
|
|
|
1580
1603
|
declare function getClientInstances(): Vimcord<boolean>[];
|
|
1581
1604
|
|
|
1582
1605
|
declare function getProcessDir(): string;
|
|
1583
|
-
declare function importModulesFromDir<T extends any>(dir: string,
|
|
1606
|
+
declare function importModulesFromDir<T extends any>(dir: string, suffix?: string): Promise<{
|
|
1584
1607
|
module: T;
|
|
1585
1608
|
path: string;
|
|
1586
1609
|
}[]>;
|
|
@@ -1598,4 +1621,4 @@ declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Gui
|
|
|
1598
1621
|
|
|
1599
1622
|
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1600
1623
|
|
|
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,
|
|
1624
|
+
export { type AnySlashCommandBuilder, type AppCommandDeployment, type BaseAppCommandConfig, BaseCommandBuilder, type BaseCommandConfig, BaseCommandManager, 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 CommandByCategory, type CommandErrorMessageConfig, type CommandFilter, type CommandInternalRateLimitData, CommandManager, type CommandMetadata, type CommandPermissionResults, type CommandPermissions, type CommandRateLimitOptions, CommandType, ContextCommandBuilder, type ContextCommandConfig, ContextCommandManager, type CustomButton, DynaSend, type DynaSendOptions, type EmbedResolvable, EventBuilder, type EventConfig, type EventDeployment, EventManager, 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, PrefixCommandManager, Prompt, type PromptOptions, PromptResolveType, type PromptResult, RateLimitScope, type RequiredDynaSendOptions, type SendHandler, SendMethod, type SendableComponent, type SendableTextChannel, type SinglePageResolvable, SlashCommandBuilder, type SlashCommandConfig, SlashCommandManager, StatusManager, StatusType, type UserResolvable, Vimcord, type VimcordAppConfig, VimcordCLI, type VimcordCLIOptions, type VimcordClientStatus, type VimcordCommandBuilderByType, type VimcordConfig, type VimcordConfigOptions, type VimcordContextCommandConfig, type VimcordDatabaseManager, type VimcordFeatures, type VimcordPrefixCommandConfig, type VimcordSlashCommandConfig, type VimcordStaffConfig, 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 };
|