vimcord 1.0.23 → 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 +209 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +69 -67
- package/dist/index.d.ts +69 -67
- package/dist/index.js +203 -205
- 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';
|
|
@@ -110,6 +110,17 @@ interface VimcordAppConfig {
|
|
|
110
110
|
/** Disable the vimcord client banner on startup
|
|
111
111
|
* @default false */
|
|
112
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
|
+
};
|
|
113
124
|
}
|
|
114
125
|
declare function createVimcordAppConfig(options?: PartialDeep<VimcordAppConfig>): VimcordAppConfig;
|
|
115
126
|
|
|
@@ -249,7 +260,7 @@ interface VimcordClientStatus {
|
|
|
249
260
|
}
|
|
250
261
|
declare function createVimcordStatusConfig(options?: PartialDeep<VimcordClientStatus>): VimcordClientStatus;
|
|
251
262
|
|
|
252
|
-
type
|
|
263
|
+
type StatusManagerEvents = {
|
|
253
264
|
changed: [ClientActivity];
|
|
254
265
|
cleared: [];
|
|
255
266
|
rotation: [ClientActivity];
|
|
@@ -257,10 +268,10 @@ type VimcordStatusManagerEvents = {
|
|
|
257
268
|
started: [Loop];
|
|
258
269
|
destroyed: [];
|
|
259
270
|
};
|
|
260
|
-
declare class
|
|
271
|
+
declare class StatusManager {
|
|
261
272
|
client: Vimcord;
|
|
262
273
|
logger: Logger;
|
|
263
|
-
emitter: EventEmitter<
|
|
274
|
+
emitter: EventEmitter<StatusManagerEvents>;
|
|
264
275
|
lastActivity: ClientActivity | null;
|
|
265
276
|
lastActivityIndex: number;
|
|
266
277
|
private task;
|
|
@@ -371,75 +382,66 @@ declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash,
|
|
|
371
382
|
|
|
372
383
|
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
373
384
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
+
*/
|
|
383
405
|
get(name: string): VimcordCommandBuilderByType<T> | undefined;
|
|
384
406
|
/**
|
|
385
|
-
*
|
|
407
|
+
* Gets/filters commands and orders them alphabetically
|
|
386
408
|
*/
|
|
387
|
-
getAll(options?:
|
|
388
|
-
names?: string[];
|
|
389
|
-
fuzzyNames?: string[];
|
|
390
|
-
globalOnly?: boolean;
|
|
391
|
-
ignoreDeploymentOptions?: boolean;
|
|
392
|
-
}): VimcordCommandBuilderByType<T>[];
|
|
409
|
+
getAll(options?: CommandFilter): VimcordCommandBuilderByType<T>[];
|
|
393
410
|
/**
|
|
394
|
-
* Groups commands by category alphabetically
|
|
411
|
+
* Groups commands by category alphabetically.
|
|
395
412
|
*/
|
|
396
|
-
sortByCategory():
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
fuzzyCommands?: string[];
|
|
404
|
-
}): Promise<void>;
|
|
405
|
-
registerGuild(options?: {
|
|
406
|
-
commands?: string[];
|
|
407
|
-
fuzzyCommands?: string[];
|
|
408
|
-
guilds?: string[];
|
|
409
|
-
}): Promise<void>;
|
|
410
|
-
unregisterGuild(options?: {
|
|
411
|
-
guilds?: string[];
|
|
412
|
-
}): Promise<void>;
|
|
413
|
-
unregisterGlobal(): Promise<void>;
|
|
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>>>;
|
|
414
420
|
}
|
|
415
|
-
declare class
|
|
421
|
+
declare class SlashCommandManager extends BaseCommandManager<CommandType.Slash> {
|
|
416
422
|
constructor(client: Vimcord);
|
|
417
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
418
423
|
}
|
|
419
|
-
declare class
|
|
424
|
+
declare class ContextCommandManager extends BaseCommandManager<CommandType.Context> {
|
|
420
425
|
constructor(client: Vimcord);
|
|
421
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
422
426
|
}
|
|
423
|
-
declare class
|
|
424
|
-
private client;
|
|
425
|
-
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
427
|
+
declare class PrefixCommandManager extends BaseCommandManager<CommandType.Prefix> {
|
|
426
428
|
constructor(client: Vimcord);
|
|
427
|
-
resolve(trigger: string): PrefixCommandBuilder | undefined;
|
|
428
|
-
/**
|
|
429
|
-
* Groups commands by category alphabetically
|
|
430
|
-
*/
|
|
431
|
-
sortByCategory(): {
|
|
432
|
-
name: string;
|
|
433
|
-
emoji: string | undefined;
|
|
434
|
-
commands: VimcordCommandBuilderByType<CommandType.Prefix>[];
|
|
435
|
-
}[];
|
|
436
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
437
429
|
}
|
|
438
|
-
declare class
|
|
439
|
-
readonly
|
|
440
|
-
readonly
|
|
441
|
-
readonly
|
|
430
|
+
declare class CommandManager {
|
|
431
|
+
readonly client: Vimcord;
|
|
432
|
+
readonly slash: SlashCommandManager;
|
|
433
|
+
readonly prefix: PrefixCommandManager;
|
|
434
|
+
readonly context: ContextCommandManager;
|
|
442
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>;
|
|
443
445
|
}
|
|
444
446
|
|
|
445
447
|
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
@@ -540,7 +542,7 @@ declare class EventBuilder<T extends keyof ClientEvents = keyof ClientEvents> im
|
|
|
540
542
|
executeEvent(...args: EventParameters<T>): Promise<any>;
|
|
541
543
|
}
|
|
542
544
|
|
|
543
|
-
declare class
|
|
545
|
+
declare class EventManager {
|
|
544
546
|
client: Vimcord;
|
|
545
547
|
events: Map<string, EventBuilder<any>>;
|
|
546
548
|
logger: Logger;
|
|
@@ -928,9 +930,9 @@ declare class Vimcord<Ready extends boolean = boolean> extends Client<Ready> {
|
|
|
928
930
|
readonly clientOptions: ClientOptions;
|
|
929
931
|
readonly features: VimcordFeatures;
|
|
930
932
|
readonly config: VimcordConfig;
|
|
931
|
-
status:
|
|
932
|
-
events:
|
|
933
|
-
commands:
|
|
933
|
+
status: StatusManager;
|
|
934
|
+
events: EventManager;
|
|
935
|
+
commands: CommandManager;
|
|
934
936
|
database?: VimcordDatabaseManager;
|
|
935
937
|
logger: Logger & {
|
|
936
938
|
clientBanner(client: Vimcord): void;
|
|
@@ -1173,7 +1175,7 @@ declare class MongoSchemaBuilder<Definition extends object> {
|
|
|
1173
1175
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1174
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>;
|
|
1175
1177
|
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1176
|
-
fetchAll<Options extends QueryOptions<Definition>>(filter
|
|
1178
|
+
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1177
1179
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1178
1180
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1179
1181
|
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
@@ -1601,7 +1603,7 @@ declare function createClient(options: ClientOptions, features?: VimcordFeatures
|
|
|
1601
1603
|
declare function getClientInstances(): Vimcord<boolean>[];
|
|
1602
1604
|
|
|
1603
1605
|
declare function getProcessDir(): string;
|
|
1604
|
-
declare function importModulesFromDir<T extends any>(dir: string,
|
|
1606
|
+
declare function importModulesFromDir<T extends any>(dir: string, suffix?: string): Promise<{
|
|
1605
1607
|
module: T;
|
|
1606
1608
|
path: string;
|
|
1607
1609
|
}[]>;
|
|
@@ -1619,4 +1621,4 @@ declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Gui
|
|
|
1619
1621
|
|
|
1620
1622
|
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1621
1623
|
|
|
1622
|
-
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';
|
|
@@ -110,6 +110,17 @@ interface VimcordAppConfig {
|
|
|
110
110
|
/** Disable the vimcord client banner on startup
|
|
111
111
|
* @default false */
|
|
112
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
|
+
};
|
|
113
124
|
}
|
|
114
125
|
declare function createVimcordAppConfig(options?: PartialDeep<VimcordAppConfig>): VimcordAppConfig;
|
|
115
126
|
|
|
@@ -249,7 +260,7 @@ interface VimcordClientStatus {
|
|
|
249
260
|
}
|
|
250
261
|
declare function createVimcordStatusConfig(options?: PartialDeep<VimcordClientStatus>): VimcordClientStatus;
|
|
251
262
|
|
|
252
|
-
type
|
|
263
|
+
type StatusManagerEvents = {
|
|
253
264
|
changed: [ClientActivity];
|
|
254
265
|
cleared: [];
|
|
255
266
|
rotation: [ClientActivity];
|
|
@@ -257,10 +268,10 @@ type VimcordStatusManagerEvents = {
|
|
|
257
268
|
started: [Loop];
|
|
258
269
|
destroyed: [];
|
|
259
270
|
};
|
|
260
|
-
declare class
|
|
271
|
+
declare class StatusManager {
|
|
261
272
|
client: Vimcord;
|
|
262
273
|
logger: Logger;
|
|
263
|
-
emitter: EventEmitter<
|
|
274
|
+
emitter: EventEmitter<StatusManagerEvents>;
|
|
264
275
|
lastActivity: ClientActivity | null;
|
|
265
276
|
lastActivityIndex: number;
|
|
266
277
|
private task;
|
|
@@ -371,75 +382,66 @@ declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash,
|
|
|
371
382
|
|
|
372
383
|
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
373
384
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
+
*/
|
|
383
405
|
get(name: string): VimcordCommandBuilderByType<T> | undefined;
|
|
384
406
|
/**
|
|
385
|
-
*
|
|
407
|
+
* Gets/filters commands and orders them alphabetically
|
|
386
408
|
*/
|
|
387
|
-
getAll(options?:
|
|
388
|
-
names?: string[];
|
|
389
|
-
fuzzyNames?: string[];
|
|
390
|
-
globalOnly?: boolean;
|
|
391
|
-
ignoreDeploymentOptions?: boolean;
|
|
392
|
-
}): VimcordCommandBuilderByType<T>[];
|
|
409
|
+
getAll(options?: CommandFilter): VimcordCommandBuilderByType<T>[];
|
|
393
410
|
/**
|
|
394
|
-
* Groups commands by category alphabetically
|
|
411
|
+
* Groups commands by category alphabetically.
|
|
395
412
|
*/
|
|
396
|
-
sortByCategory():
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
fuzzyCommands?: string[];
|
|
404
|
-
}): Promise<void>;
|
|
405
|
-
registerGuild(options?: {
|
|
406
|
-
commands?: string[];
|
|
407
|
-
fuzzyCommands?: string[];
|
|
408
|
-
guilds?: string[];
|
|
409
|
-
}): Promise<void>;
|
|
410
|
-
unregisterGuild(options?: {
|
|
411
|
-
guilds?: string[];
|
|
412
|
-
}): Promise<void>;
|
|
413
|
-
unregisterGlobal(): Promise<void>;
|
|
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>>>;
|
|
414
420
|
}
|
|
415
|
-
declare class
|
|
421
|
+
declare class SlashCommandManager extends BaseCommandManager<CommandType.Slash> {
|
|
416
422
|
constructor(client: Vimcord);
|
|
417
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
418
423
|
}
|
|
419
|
-
declare class
|
|
424
|
+
declare class ContextCommandManager extends BaseCommandManager<CommandType.Context> {
|
|
420
425
|
constructor(client: Vimcord);
|
|
421
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
422
426
|
}
|
|
423
|
-
declare class
|
|
424
|
-
private client;
|
|
425
|
-
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
427
|
+
declare class PrefixCommandManager extends BaseCommandManager<CommandType.Prefix> {
|
|
426
428
|
constructor(client: Vimcord);
|
|
427
|
-
resolve(trigger: string): PrefixCommandBuilder | undefined;
|
|
428
|
-
/**
|
|
429
|
-
* Groups commands by category alphabetically
|
|
430
|
-
*/
|
|
431
|
-
sortByCategory(): {
|
|
432
|
-
name: string;
|
|
433
|
-
emoji: string | undefined;
|
|
434
|
-
commands: VimcordCommandBuilderByType<CommandType.Prefix>[];
|
|
435
|
-
}[];
|
|
436
|
-
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
437
429
|
}
|
|
438
|
-
declare class
|
|
439
|
-
readonly
|
|
440
|
-
readonly
|
|
441
|
-
readonly
|
|
430
|
+
declare class CommandManager {
|
|
431
|
+
readonly client: Vimcord;
|
|
432
|
+
readonly slash: SlashCommandManager;
|
|
433
|
+
readonly prefix: PrefixCommandManager;
|
|
434
|
+
readonly context: ContextCommandManager;
|
|
442
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>;
|
|
443
445
|
}
|
|
444
446
|
|
|
445
447
|
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
@@ -540,7 +542,7 @@ declare class EventBuilder<T extends keyof ClientEvents = keyof ClientEvents> im
|
|
|
540
542
|
executeEvent(...args: EventParameters<T>): Promise<any>;
|
|
541
543
|
}
|
|
542
544
|
|
|
543
|
-
declare class
|
|
545
|
+
declare class EventManager {
|
|
544
546
|
client: Vimcord;
|
|
545
547
|
events: Map<string, EventBuilder<any>>;
|
|
546
548
|
logger: Logger;
|
|
@@ -928,9 +930,9 @@ declare class Vimcord<Ready extends boolean = boolean> extends Client<Ready> {
|
|
|
928
930
|
readonly clientOptions: ClientOptions;
|
|
929
931
|
readonly features: VimcordFeatures;
|
|
930
932
|
readonly config: VimcordConfig;
|
|
931
|
-
status:
|
|
932
|
-
events:
|
|
933
|
-
commands:
|
|
933
|
+
status: StatusManager;
|
|
934
|
+
events: EventManager;
|
|
935
|
+
commands: CommandManager;
|
|
934
936
|
database?: VimcordDatabaseManager;
|
|
935
937
|
logger: Logger & {
|
|
936
938
|
clientBanner(client: Vimcord): void;
|
|
@@ -1173,7 +1175,7 @@ declare class MongoSchemaBuilder<Definition extends object> {
|
|
|
1173
1175
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongoose.mongo.DeleteResult | undefined>;
|
|
1174
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>;
|
|
1175
1177
|
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1176
|
-
fetchAll<Options extends QueryOptions<Definition>>(filter
|
|
1178
|
+
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1177
1179
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1178
1180
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1179
1181
|
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
@@ -1601,7 +1603,7 @@ declare function createClient(options: ClientOptions, features?: VimcordFeatures
|
|
|
1601
1603
|
declare function getClientInstances(): Vimcord<boolean>[];
|
|
1602
1604
|
|
|
1603
1605
|
declare function getProcessDir(): string;
|
|
1604
|
-
declare function importModulesFromDir<T extends any>(dir: string,
|
|
1606
|
+
declare function importModulesFromDir<T extends any>(dir: string, suffix?: string): Promise<{
|
|
1605
1607
|
module: T;
|
|
1606
1608
|
path: string;
|
|
1607
1609
|
}[]>;
|
|
@@ -1619,4 +1621,4 @@ declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Gui
|
|
|
1619
1621
|
|
|
1620
1622
|
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1621
1623
|
|
|
1622
|
-
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 };
|