vimcord 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4203 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +1493 -0
- package/dist/index.d.ts +1493 -0
- package/dist/index.js +4151 -0
- package/dist/index.js.map +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1493 @@
|
|
|
1
|
+
import * as discord_js from 'discord.js';
|
|
2
|
+
import { PermissionResolvable, SlashCommandBuilder as SlashCommandBuilder$1, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandGroupBuilder, ActivityType, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Message, ChatInputCommandInteraction, REST, ClientEvents, CommandInteraction, RepliableInteraction, TextBasedChannel, 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, APITextInputComponent, APIStringSelectComponent, APIChannelSelectComponent, APIUserSelectComponent, APIRoleSelectComponent, APIMentionableSelectComponent, APIFileUploadComponent, ModalSubmitInteraction, APIModalInteractionResponseCallbackData, ModalBuilder, Interaction, AwaitModalSubmitOptions, SelectMenuComponentOptionData, StringSelectMenuOptionBuilder, StringSelectMenuInteraction, ButtonInteraction, MessageReaction, UserResolvable as UserResolvable$1, StringSelectMenuBuilder, ButtonBuilder, InteractionCollector, ReactionCollector, APIButtonComponent, ChannelType, PartialGroupDMChannel, PartialDMChannel, GuildBasedChannel, AnyThreadChannel, VoiceBasedChannel, CategoryChannel, Channel, Role, GuildTextBasedChannel } from 'discord.js';
|
|
3
|
+
import { DotenvConfigOptions } from 'dotenv';
|
|
4
|
+
import mongoose, { QueryOptions, HydratedDocument, Require_id, SchemaDefinition, Schema, Model, RootFilterQuery, ProjectionType, UpdateQuery, PipelineStage, AggregateOptions } from 'mongoose';
|
|
5
|
+
import { PartialDeep } from 'type-fest';
|
|
6
|
+
import { ScheduledTask } from 'node-cron';
|
|
7
|
+
import EventEmitter from 'node:events';
|
|
8
|
+
import { Interface } from 'node:readline';
|
|
9
|
+
|
|
10
|
+
type AnySlashCommandBuilder = SlashCommandBuilder$1 | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandBuilder | SlashCommandSubcommandsOnlyBuilder | SlashCommandSubcommandGroupBuilder;
|
|
11
|
+
interface CommandPermissions {
|
|
12
|
+
/** Permissions the user is required to have to use this command
|
|
13
|
+
* @remarks If this is a slash command, use the builder's `setDefaultMemberPermissions` option instead */
|
|
14
|
+
user?: PermissionResolvable[];
|
|
15
|
+
/** Permissions the bot is required to have to execute this command */
|
|
16
|
+
bot?: PermissionResolvable[];
|
|
17
|
+
/** Roles allowed to use this command by ID */
|
|
18
|
+
roles?: string[];
|
|
19
|
+
/** Only allow these users to use this command by ID */
|
|
20
|
+
userWhitelist?: string[];
|
|
21
|
+
/** Users blacklisted from using this command by ID */
|
|
22
|
+
userBlacklist?: string[];
|
|
23
|
+
/** Roles blacklisted from using this command by ID */
|
|
24
|
+
roleBlacklist?: string[];
|
|
25
|
+
/** Should this command only be usable in guilds?
|
|
26
|
+
* @remarks If this is a slash command, use the builder's `setContexts` option instead */
|
|
27
|
+
guildOnly?: boolean;
|
|
28
|
+
/** Should only the guild owner be allowed to use this command? */
|
|
29
|
+
guildOwnerOnly?: boolean;
|
|
30
|
+
/** Should only the bot owner be allowed to use this command? */
|
|
31
|
+
botOwnerOnly?: boolean;
|
|
32
|
+
/** Should only the bot staff (including bot owner) be allowed to use this command? */
|
|
33
|
+
botStaffOnly?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface CommandMetadata {
|
|
36
|
+
/** Command category for categorizing commands */
|
|
37
|
+
category?: string;
|
|
38
|
+
/** Command tags for categorizing commands */
|
|
39
|
+
tags?: string[];
|
|
40
|
+
/** Command usage examples */
|
|
41
|
+
examples?: string[];
|
|
42
|
+
/** Command emoji */
|
|
43
|
+
emoji?: string;
|
|
44
|
+
/** Will this command show up in help commands? @defaultValue `false` */
|
|
45
|
+
hidden?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface AppCommandDeployment {
|
|
48
|
+
/** Specific guild IDs to deploy to */
|
|
49
|
+
guilds?: string[];
|
|
50
|
+
/** Whether to deploy globally */
|
|
51
|
+
global?: boolean;
|
|
52
|
+
/** Deployment environments */
|
|
53
|
+
environments?: ("development" | "production")[];
|
|
54
|
+
}
|
|
55
|
+
interface CommandRateLimitOptions<OnRateLimitParams extends (...args: any) => any = (...args: any) => any> {
|
|
56
|
+
/** Max executions per interval */
|
|
57
|
+
max: number;
|
|
58
|
+
/** Interval in milliseconds */
|
|
59
|
+
interval: number;
|
|
60
|
+
/** Rate limit scope */
|
|
61
|
+
scope: RateLimitScope;
|
|
62
|
+
/** What to do when rate limited */
|
|
63
|
+
onRateLimit?: OnRateLimitParams;
|
|
64
|
+
}
|
|
65
|
+
interface CommandPermissionResults {
|
|
66
|
+
validated: boolean;
|
|
67
|
+
failReason?: MissingPermissionReason;
|
|
68
|
+
missingUserPermissions?: PermissionResolvable[];
|
|
69
|
+
missingBotPermissions?: PermissionResolvable[];
|
|
70
|
+
missingRoles?: string[];
|
|
71
|
+
blacklistedUser?: string;
|
|
72
|
+
blacklistedRole?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface MongoConnectionOptions {
|
|
76
|
+
/** The maximum number of attempts to connect to MongoDB @defaultValue `3` */
|
|
77
|
+
maxRetries?: number;
|
|
78
|
+
}
|
|
79
|
+
declare function useMongoDatabase(index?: number): Promise<MongoDatabase>;
|
|
80
|
+
declare class MongoDatabase {
|
|
81
|
+
client: Vimcord;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly uuid: string;
|
|
84
|
+
readonly index: number;
|
|
85
|
+
private uri;
|
|
86
|
+
mongoose: mongoose.Mongoose;
|
|
87
|
+
private eventEmitter;
|
|
88
|
+
private isReady;
|
|
89
|
+
private isConnecting;
|
|
90
|
+
constructor(client: Vimcord, options?: mongoose.MongooseOptions);
|
|
91
|
+
waitForReady(): Promise<boolean>;
|
|
92
|
+
connect(uri?: string, connectionOptions?: mongoose.ConnectOptions, options?: MongoConnectionOptions): Promise<boolean>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type VimcordDatabaseManager = MongoDatabase;
|
|
96
|
+
|
|
97
|
+
interface VimcordAppConfig {
|
|
98
|
+
devMode: boolean;
|
|
99
|
+
name: string;
|
|
100
|
+
appVersion: string;
|
|
101
|
+
/** Enable verbose console logs?
|
|
102
|
+
* @default false */
|
|
103
|
+
verbose: boolean;
|
|
104
|
+
/** Disable the vimcord client banner on startup
|
|
105
|
+
* @default false */
|
|
106
|
+
disableBanner: boolean;
|
|
107
|
+
}
|
|
108
|
+
declare function createVimcordAppConfig(options?: PartialDeep<VimcordAppConfig>): VimcordAppConfig;
|
|
109
|
+
|
|
110
|
+
interface VimcordStaffConfig {
|
|
111
|
+
ownerId: string | null;
|
|
112
|
+
superUsers: string[];
|
|
113
|
+
superUserRoles: string[];
|
|
114
|
+
bypassers: {
|
|
115
|
+
commandName: string;
|
|
116
|
+
userIds: string[];
|
|
117
|
+
}[];
|
|
118
|
+
bypassesGuildAdmin: {
|
|
119
|
+
allBotStaff: boolean;
|
|
120
|
+
botOwner: boolean;
|
|
121
|
+
superUsers: boolean;
|
|
122
|
+
bypassers: boolean;
|
|
123
|
+
};
|
|
124
|
+
guild: {
|
|
125
|
+
id: string | null;
|
|
126
|
+
inviteUrl: string | null;
|
|
127
|
+
channels: Record<string, string>;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
declare function createVimcordStaffConfig(options?: PartialDeep<VimcordStaffConfig>): VimcordStaffConfig;
|
|
131
|
+
|
|
132
|
+
interface VimcordSlashCommandConfig extends BaseCommandConfig<CommandType.Slash> {
|
|
133
|
+
}
|
|
134
|
+
declare function createVimcordSlashCommandConfig(options?: PartialDeep<VimcordSlashCommandConfig>): VimcordSlashCommandConfig;
|
|
135
|
+
|
|
136
|
+
interface VimcordPrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
|
|
137
|
+
/** @default ! */
|
|
138
|
+
defaultPrefix: string;
|
|
139
|
+
/** @default true */
|
|
140
|
+
allowMentionAsPrefix: boolean;
|
|
141
|
+
/** @default true */
|
|
142
|
+
allowCaseInsensitiveCommandNames: boolean;
|
|
143
|
+
}
|
|
144
|
+
declare function createVimcordPrefixCommandConfig(options?: PartialDeep<VimcordPrefixCommandConfig>): VimcordPrefixCommandConfig;
|
|
145
|
+
|
|
146
|
+
interface VimcordContextCommandConfig extends BaseCommandConfig<CommandType.Context> {
|
|
147
|
+
}
|
|
148
|
+
declare function createVimcordContextCommandConfig(options?: PartialDeep<VimcordContextCommandConfig>): VimcordContextCommandConfig;
|
|
149
|
+
|
|
150
|
+
interface LoggerOptions {
|
|
151
|
+
colors?: Partial<typeof DEFAULT_COLORS>;
|
|
152
|
+
prefix?: string | null;
|
|
153
|
+
prefixEmoji?: string | null;
|
|
154
|
+
minLevel?: LogLevel;
|
|
155
|
+
/** @defaultValue `true` */
|
|
156
|
+
showTimestamp?: boolean;
|
|
157
|
+
}
|
|
158
|
+
declare enum LogLevel {
|
|
159
|
+
DEBUG = 0,
|
|
160
|
+
INFO = 1,
|
|
161
|
+
SUCCESS = 2,
|
|
162
|
+
WARN = 3,
|
|
163
|
+
ERROR = 4
|
|
164
|
+
}
|
|
165
|
+
declare const DEFAULT_COLORS: {
|
|
166
|
+
primary: string;
|
|
167
|
+
success: string;
|
|
168
|
+
warn: string;
|
|
169
|
+
danger: string;
|
|
170
|
+
muted: string;
|
|
171
|
+
text: string;
|
|
172
|
+
};
|
|
173
|
+
/** Reusable functions for using `console.log()`, but in 4k ultra HD retrocolor */
|
|
174
|
+
declare class Logger {
|
|
175
|
+
private logPrefixEmoji;
|
|
176
|
+
private logPrefix;
|
|
177
|
+
private minLevel;
|
|
178
|
+
private showTimestamp;
|
|
179
|
+
private colorScheme;
|
|
180
|
+
constructor(options?: LoggerOptions);
|
|
181
|
+
protected formatTimestamp(): string;
|
|
182
|
+
protected formatPrefix(): string;
|
|
183
|
+
protected shouldLog(level: LogLevel): boolean;
|
|
184
|
+
get prefixEmoji(): string | null;
|
|
185
|
+
get prefix(): string | null;
|
|
186
|
+
get colors(): {
|
|
187
|
+
primary: string;
|
|
188
|
+
success: string;
|
|
189
|
+
warn: string;
|
|
190
|
+
danger: string;
|
|
191
|
+
muted: string;
|
|
192
|
+
text: string;
|
|
193
|
+
};
|
|
194
|
+
extend<Extra extends Record<string, (...args: any) => void>>(extras: Extra & ThisType<Logger>): Logger & Extra;
|
|
195
|
+
setPrefix(prefix: string | null): this;
|
|
196
|
+
setPrefixEmoji(prefixEmoji: string | null): this;
|
|
197
|
+
setMinLevel(minLevel: LogLevel): this;
|
|
198
|
+
setShowTimestamp(show: boolean): this;
|
|
199
|
+
setColors(colors: Partial<typeof DEFAULT_COLORS>): this;
|
|
200
|
+
log(message: string, ...args: any[]): void;
|
|
201
|
+
debug(message: string, ...args: any[]): void;
|
|
202
|
+
info(message: string, ...args: any[]): void;
|
|
203
|
+
success(message: string, ...args: any[]): void;
|
|
204
|
+
warn(message: string, ...args: any[]): void;
|
|
205
|
+
error(message: string, error?: Error, ...args: any[]): void;
|
|
206
|
+
loader(message: string): (newMessage?: string) => void;
|
|
207
|
+
table(title: string, data: Record<string, any>): void;
|
|
208
|
+
section(title: string): void;
|
|
209
|
+
}
|
|
210
|
+
declare const logger: Logger;
|
|
211
|
+
|
|
212
|
+
declare enum StatusType {
|
|
213
|
+
DND = "dnd",
|
|
214
|
+
Idle = "idle",
|
|
215
|
+
Online = "online",
|
|
216
|
+
Invisible = "invisible"
|
|
217
|
+
}
|
|
218
|
+
interface ClientActivity {
|
|
219
|
+
/** Mappings:
|
|
220
|
+
* - `$USER_COUNT` - this.client.users.cache.size
|
|
221
|
+
* - `$GUILD_COUNT` - this.client.guilds.cache.size
|
|
222
|
+
* - `$STAFF_GUILD_MEMBER_COUNT` - self explanatory
|
|
223
|
+
*/
|
|
224
|
+
name: string;
|
|
225
|
+
type: ActivityType;
|
|
226
|
+
status: StatusType;
|
|
227
|
+
streamUrl?: string;
|
|
228
|
+
}
|
|
229
|
+
interface ClientStatus {
|
|
230
|
+
/** In seconds */
|
|
231
|
+
interval?: number;
|
|
232
|
+
randomize?: boolean;
|
|
233
|
+
activity: ClientActivity | ClientActivity[];
|
|
234
|
+
}
|
|
235
|
+
interface VimcordClientStatus {
|
|
236
|
+
production: ClientStatus;
|
|
237
|
+
development: ClientStatus;
|
|
238
|
+
}
|
|
239
|
+
declare function createVimcordStatusConfig(options?: PartialDeep<VimcordClientStatus>): VimcordClientStatus;
|
|
240
|
+
|
|
241
|
+
type VimcordStatusManagerEvents = {
|
|
242
|
+
changed: [ClientActivity];
|
|
243
|
+
cleared: [];
|
|
244
|
+
rotation: [ClientActivity];
|
|
245
|
+
rotationPaused: [ScheduledTask];
|
|
246
|
+
rotationStarted: [ScheduledTask];
|
|
247
|
+
rotationDestroyed: [];
|
|
248
|
+
};
|
|
249
|
+
declare class VimcordStatusManager {
|
|
250
|
+
client: Vimcord;
|
|
251
|
+
logger: Logger;
|
|
252
|
+
emitter: EventEmitter<VimcordStatusManagerEvents>;
|
|
253
|
+
lastActivity: ClientActivity | null;
|
|
254
|
+
lastActivityIndex: number;
|
|
255
|
+
private task;
|
|
256
|
+
constructor(client: Vimcord);
|
|
257
|
+
private clearData;
|
|
258
|
+
private getReadyClient;
|
|
259
|
+
private formatActivityName;
|
|
260
|
+
private setActivity;
|
|
261
|
+
private statusRotationTask;
|
|
262
|
+
private scheduleStatusRotation;
|
|
263
|
+
start(): this;
|
|
264
|
+
pause(): this;
|
|
265
|
+
set(status: PartialDeep<VimcordClientStatus>): Promise<this>;
|
|
266
|
+
destroy(): Promise<this>;
|
|
267
|
+
clear(): Promise<this>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface ContextCommandConfig extends BaseCommandOptions<CommandType.Context>, BaseAppCommandConfig, BaseCommandFunctionConfig<CommandType.Context> {
|
|
271
|
+
/** Context menu command builder */
|
|
272
|
+
builder: ContextMenuCommandBuilder | ((builder: ContextMenuCommandBuilder) => ContextMenuCommandBuilder);
|
|
273
|
+
/** Defer reply */
|
|
274
|
+
deferReply?: boolean | {
|
|
275
|
+
ephemeral?: boolean;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
declare class ContextCommandBuilder extends BaseCommandBuilder<CommandType.Context, ContextCommandConfig> {
|
|
279
|
+
builder: ContextMenuCommandBuilder;
|
|
280
|
+
deferReply?: boolean | {
|
|
281
|
+
ephemeral?: boolean;
|
|
282
|
+
};
|
|
283
|
+
deployment?: AppCommandDeployment;
|
|
284
|
+
constructor(config: ContextCommandConfig);
|
|
285
|
+
private validateBuilder;
|
|
286
|
+
private validateConfig;
|
|
287
|
+
toConfig(): ContextCommandConfig;
|
|
288
|
+
setBuilder(builder: ContextMenuCommandBuilder | ((builder: ContextMenuCommandBuilder) => ContextMenuCommandBuilder)): this;
|
|
289
|
+
setDeferReply(defer: boolean | {
|
|
290
|
+
ephemeral?: boolean;
|
|
291
|
+
}): this;
|
|
292
|
+
setDeployment(deployment: AppCommandDeployment): this;
|
|
293
|
+
executeCommand(client: Vimcord<true>, interaction: ContextMenuCommandInteraction): Promise<any>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface PrefixCommandConfig extends BaseCommandOptions<CommandType.Prefix>, BaseCommandFunctionConfig<CommandType.Prefix> {
|
|
297
|
+
name: string;
|
|
298
|
+
aliases?: string[];
|
|
299
|
+
description?: string;
|
|
300
|
+
}
|
|
301
|
+
declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
|
|
302
|
+
name: string;
|
|
303
|
+
aliases?: string[];
|
|
304
|
+
description?: string;
|
|
305
|
+
constructor(config: PrefixCommandConfig);
|
|
306
|
+
private validateConfig;
|
|
307
|
+
toConfig(): PrefixCommandConfig;
|
|
308
|
+
executeCommand(client: Vimcord<true>, message: Message): Promise<any>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface SlashCommandConfig extends BaseCommandOptions<CommandType.Slash>, BaseAppCommandConfig, BaseCommandFunctionConfig<CommandType.Slash> {
|
|
312
|
+
/** Slash command builder */
|
|
313
|
+
builder: AnySlashCommandBuilder | ((builder: SlashCommandBuilder$1) => AnySlashCommandBuilder);
|
|
314
|
+
/** Defer reply */
|
|
315
|
+
deferReply?: boolean | {
|
|
316
|
+
ephemeral?: boolean;
|
|
317
|
+
};
|
|
318
|
+
/** Deployment options */
|
|
319
|
+
deployment?: AppCommandDeployment;
|
|
320
|
+
/** Map sub-command names to their own execute handler */
|
|
321
|
+
routes?: {
|
|
322
|
+
name: string;
|
|
323
|
+
handler: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
324
|
+
}[];
|
|
325
|
+
/** Executed when an unmapped sub-command route is used */
|
|
326
|
+
onUnknownRouteHandler?: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
327
|
+
}
|
|
328
|
+
declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash, SlashCommandConfig> {
|
|
329
|
+
builder: AnySlashCommandBuilder;
|
|
330
|
+
deferReply?: boolean | {
|
|
331
|
+
ephemeral?: boolean;
|
|
332
|
+
};
|
|
333
|
+
deployment?: AppCommandDeployment;
|
|
334
|
+
routes: Map<string, (...args: any) => any>;
|
|
335
|
+
onUnknownRouteHandler?: (...args: any) => any;
|
|
336
|
+
constructor(config: SlashCommandConfig);
|
|
337
|
+
private validateBuilder;
|
|
338
|
+
private validateConfig;
|
|
339
|
+
toConfig(): SlashCommandConfig;
|
|
340
|
+
setBuilder(builder: AnySlashCommandBuilder | ((builder: SlashCommandBuilder$1) => AnySlashCommandBuilder)): this;
|
|
341
|
+
setDeferReply(defer: boolean | {
|
|
342
|
+
ephemeral?: boolean;
|
|
343
|
+
}): this;
|
|
344
|
+
setDeployment(deployment: AppCommandDeployment): this;
|
|
345
|
+
setRoutes(...routes: {
|
|
346
|
+
name: string;
|
|
347
|
+
handler: (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any;
|
|
348
|
+
}[]): this;
|
|
349
|
+
addRoutes(...routes: {
|
|
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>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
type VimcordCommandBuilderByType<T extends CommandType> = T extends CommandType.Slash ? SlashCommandBuilder : T extends CommandType.Context ? ContextCommandBuilder : T extends CommandType.Prefix ? PrefixCommandBuilder : never;
|
|
358
|
+
|
|
359
|
+
declare class VimcordCommandManager {
|
|
360
|
+
slash: VimcordSlashCommandManager;
|
|
361
|
+
prefix: VimcordPrefixCommandManager;
|
|
362
|
+
context: VimcordContextCommandManager;
|
|
363
|
+
constructor(client: Vimcord);
|
|
364
|
+
}
|
|
365
|
+
declare class VimcordSlashCommandManager {
|
|
366
|
+
client: Vimcord;
|
|
367
|
+
commands: Map<string, VimcordCommandBuilderByType<CommandType.Slash>>;
|
|
368
|
+
rest: REST;
|
|
369
|
+
constructor(client: Vimcord);
|
|
370
|
+
get(name: string): SlashCommandBuilder | undefined;
|
|
371
|
+
getAll(options?: {
|
|
372
|
+
names?: string[];
|
|
373
|
+
fuzzyNames?: string[];
|
|
374
|
+
guilds?: string[];
|
|
375
|
+
globalOnly?: boolean;
|
|
376
|
+
ignoreDeploymentOptions?: boolean;
|
|
377
|
+
}): Map<string, SlashCommandBuilder>;
|
|
378
|
+
/** Import command modules that end with `.slash` */
|
|
379
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, SlashCommandBuilder>>;
|
|
380
|
+
registerGuild(options?: {
|
|
381
|
+
commands?: string[];
|
|
382
|
+
fuzzyCommands?: string[];
|
|
383
|
+
guilds?: string[];
|
|
384
|
+
}): Promise<void>;
|
|
385
|
+
unregisterGuild(options?: {
|
|
386
|
+
guilds?: string[];
|
|
387
|
+
}): Promise<void>;
|
|
388
|
+
registerGlobal(options?: {
|
|
389
|
+
commands?: string[];
|
|
390
|
+
fuzzyCommands?: string[];
|
|
391
|
+
}): Promise<void>;
|
|
392
|
+
unregisterGlobal(): Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
declare class VimcordPrefixCommandManager {
|
|
395
|
+
client: Vimcord;
|
|
396
|
+
commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
|
|
397
|
+
constructor(client: Vimcord);
|
|
398
|
+
get(name: string): PrefixCommandBuilder | undefined;
|
|
399
|
+
getByAlias(alias: string): PrefixCommandBuilder | undefined;
|
|
400
|
+
/** Import command modules that end with `.prefix` */
|
|
401
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
|
|
402
|
+
}
|
|
403
|
+
declare class VimcordContextCommandManager {
|
|
404
|
+
client: Vimcord;
|
|
405
|
+
commands: Map<string, VimcordCommandBuilderByType<CommandType.Context>>;
|
|
406
|
+
constructor(client: Vimcord);
|
|
407
|
+
/** Import command modules that end with `.ctx` */
|
|
408
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, ContextCommandBuilder>>;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
type EventParameters<T extends keyof ClientEvents> = [client: Vimcord<true>, ...args: ClientEvents[T]];
|
|
412
|
+
|
|
413
|
+
interface EventMetadata {
|
|
414
|
+
/** Event category */
|
|
415
|
+
category?: string;
|
|
416
|
+
/** Tags for categorizing events */
|
|
417
|
+
tags?: string[];
|
|
418
|
+
}
|
|
419
|
+
interface EventDeployment {
|
|
420
|
+
/** Deployment environments */
|
|
421
|
+
environments?: ("development" | "production")[];
|
|
422
|
+
}
|
|
423
|
+
interface EventRateLimitOptions<T extends keyof ClientEvents> {
|
|
424
|
+
/** Max executions per interval */
|
|
425
|
+
max: number;
|
|
426
|
+
/** Interval in milliseconds */
|
|
427
|
+
interval: number;
|
|
428
|
+
/** What to do when rate limited */
|
|
429
|
+
onRateLimit?: (...args: EventParameters<T>) => any;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
interface EventConfig<T extends keyof ClientEvents> {
|
|
433
|
+
/** Discord.js event name */
|
|
434
|
+
event: T;
|
|
435
|
+
/** Human-readable name for the event */
|
|
436
|
+
name?: string;
|
|
437
|
+
/** Whether this event will be executed or not @defaultValue `true` */
|
|
438
|
+
enabled?: boolean;
|
|
439
|
+
/** Whether this event will be executed only once or not */
|
|
440
|
+
once?: boolean;
|
|
441
|
+
/** Priority for event execution order (lower = earlier) @defaultValue `0` */
|
|
442
|
+
priority?: number;
|
|
443
|
+
/** Conditions that must be met for this event to execute */
|
|
444
|
+
conditions?: Array<(...args: EventParameters<T>) => boolean>;
|
|
445
|
+
/** Event metadata */
|
|
446
|
+
metadata?: EventMetadata;
|
|
447
|
+
/** Event deployment */
|
|
448
|
+
deployment?: EventDeployment;
|
|
449
|
+
/** Rate limiting options */
|
|
450
|
+
rateLimit?: EventRateLimitOptions<T>;
|
|
451
|
+
/** Before event execution */
|
|
452
|
+
beforeExecute?: (...args: EventParameters<T>) => any;
|
|
453
|
+
/** The function that will be executed */
|
|
454
|
+
execute?: (...args: EventParameters<T>) => any;
|
|
455
|
+
/** After successful execution */
|
|
456
|
+
afterExecute?: (result: any, ...args: EventParameters<T>) => any;
|
|
457
|
+
/** Custom error handler */
|
|
458
|
+
onError?: (error: Error, ...args: EventParameters<T>) => any;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
declare class EventBuilder<T extends keyof ClientEvents = keyof ClientEvents> implements EventConfig<T> {
|
|
462
|
+
readonly uuid: string;
|
|
463
|
+
event: T;
|
|
464
|
+
name: string;
|
|
465
|
+
enabled: boolean;
|
|
466
|
+
once: boolean;
|
|
467
|
+
priority: number;
|
|
468
|
+
conditions: ((client: Vimcord<true>, ...args: ClientEvents[T]) => boolean)[] | undefined;
|
|
469
|
+
metadata: EventMetadata | undefined;
|
|
470
|
+
deployment: EventDeployment | undefined;
|
|
471
|
+
rateLimit: EventRateLimitOptions<T> | undefined;
|
|
472
|
+
beforeExecute: ((client: Vimcord<true>, ...args: ClientEvents[T]) => any) | undefined;
|
|
473
|
+
execute: ((client: Vimcord<true>, ...args: ClientEvents[T]) => any) | undefined;
|
|
474
|
+
afterExecute: ((result: any, client: Vimcord<true>, ...args: ClientEvents[T]) => any) | undefined;
|
|
475
|
+
onError: ((error: Error, client: Vimcord<true>, ...args: ClientEvents[T]) => any) | undefined;
|
|
476
|
+
private rateLimitData;
|
|
477
|
+
static create<T extends keyof ClientEvents>(event: T, name?: string): EventBuilder<T>;
|
|
478
|
+
constructor(config: EventConfig<T>);
|
|
479
|
+
validate(): void;
|
|
480
|
+
clone(): EventBuilder<T>;
|
|
481
|
+
toConfig(): EventConfig<T>;
|
|
482
|
+
setEvent(event: T): this;
|
|
483
|
+
setName(name: string): this;
|
|
484
|
+
setEnabled(enabled: boolean): this;
|
|
485
|
+
enable(): this;
|
|
486
|
+
disable(): this;
|
|
487
|
+
setOnce(once?: boolean): this;
|
|
488
|
+
setPriority(priority: number): this;
|
|
489
|
+
addCondition(condition: (...args: EventParameters<T>) => boolean): this;
|
|
490
|
+
setConditions(conditions: Array<(...args: EventParameters<T>) => boolean>): this;
|
|
491
|
+
setMetadata(metadata: EventMetadata): this;
|
|
492
|
+
setDeployment(deployment: EventDeployment): this;
|
|
493
|
+
setRateLimit(options: EventRateLimitOptions<T>): this;
|
|
494
|
+
setBeforeExecute(beforeExecute: (...args: EventParameters<T>) => Promise<any> | any): this;
|
|
495
|
+
setExecute(execute: (...args: EventParameters<T>) => Promise<any> | any): this;
|
|
496
|
+
setAfterExecute(afterExecute: (result: any, ...args: EventParameters<T>) => Promise<any> | any): this;
|
|
497
|
+
setOnError(onError: (error: Error, ...args: EventParameters<T>) => Promise<any> | any): this;
|
|
498
|
+
getRateLimitInfo(): {
|
|
499
|
+
executions: number;
|
|
500
|
+
timestamp: number;
|
|
501
|
+
isLimited: boolean;
|
|
502
|
+
} | null;
|
|
503
|
+
resetRateLimit(): this;
|
|
504
|
+
isRateLimited(updateExecutions?: boolean): boolean;
|
|
505
|
+
checkConditions(...args: EventParameters<T>): Promise<boolean>;
|
|
506
|
+
executeEvent(...args: EventParameters<T>): Promise<any>;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
declare class VimcordEventManager {
|
|
510
|
+
client: Vimcord;
|
|
511
|
+
events: Map<string, EventBuilder<any>>;
|
|
512
|
+
logger: Logger;
|
|
513
|
+
constructor(client: Vimcord);
|
|
514
|
+
register<T extends keyof ClientEvents>(...events: EventBuilder<T>[]): void;
|
|
515
|
+
unregister(...names: string[]): void;
|
|
516
|
+
clear(): void;
|
|
517
|
+
get(name: string): EventBuilder | undefined;
|
|
518
|
+
getByTag(tag: string): EventBuilder[];
|
|
519
|
+
getByCategory(category: string): EventBuilder[];
|
|
520
|
+
getByEvent<T extends keyof ClientEvents>(eventType: T): EventBuilder<T>[];
|
|
521
|
+
executeEvents<T extends keyof ClientEvents>(eventType: T, ...args: ClientEvents[T]): Promise<void>;
|
|
522
|
+
/** Import event modules that end with `.event` */
|
|
523
|
+
importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, EventBuilder<any>>>;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
declare enum SendMethod {
|
|
527
|
+
Reply = 0,
|
|
528
|
+
EditReply = 1,
|
|
529
|
+
FollowUp = 2,
|
|
530
|
+
Channel = 3,
|
|
531
|
+
MessageReply = 4,
|
|
532
|
+
MessageEdit = 5,
|
|
533
|
+
User = 6
|
|
534
|
+
}
|
|
535
|
+
type SendHandler = CommandInteraction | RepliableInteraction | TextBasedChannel | Message | GuildMember | User;
|
|
536
|
+
type InteractionBasedSendHandler = CommandInteraction | RepliableInteraction;
|
|
537
|
+
type EmbedResolvable = EmbedBuilder | BetterEmbed;
|
|
538
|
+
type InteractionResolveable = CommandInteraction | RepliableInteraction;
|
|
539
|
+
type UserResolvable = GuildMember | User | string;
|
|
540
|
+
type SendableTextChannel = DMChannel | TextChannel | NewsChannel | ThreadChannel;
|
|
541
|
+
|
|
542
|
+
interface VimcordToolsConfig {
|
|
543
|
+
devMode: boolean;
|
|
544
|
+
embedColor: ColorResolvable[];
|
|
545
|
+
embedColorDev: ColorResolvable[];
|
|
546
|
+
timeouts: {
|
|
547
|
+
pagination: number;
|
|
548
|
+
prompt: number;
|
|
549
|
+
modalSubmit: number;
|
|
550
|
+
};
|
|
551
|
+
paginator: {
|
|
552
|
+
notAParticipantMessage: string;
|
|
553
|
+
jumpableThreshold: number;
|
|
554
|
+
longThreshold: number;
|
|
555
|
+
buttons: Record<"first" | "back" | "jump" | "next" | "last", {
|
|
556
|
+
label: string;
|
|
557
|
+
emoji: {
|
|
558
|
+
animated?: boolean;
|
|
559
|
+
name: string;
|
|
560
|
+
id: string;
|
|
561
|
+
};
|
|
562
|
+
}>;
|
|
563
|
+
};
|
|
564
|
+
prompt: {
|
|
565
|
+
defaultTitle: string;
|
|
566
|
+
defaultDescription: string;
|
|
567
|
+
confirmLabel: string;
|
|
568
|
+
rejectLabel: string;
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
declare const globalVimcordToolsConfig: VimcordToolsConfig;
|
|
572
|
+
declare function defineGlobalToolsConfig(options: PartialDeep<VimcordToolsConfig>): void;
|
|
573
|
+
declare function createToolsConfig(options?: PartialDeep<VimcordToolsConfig>): VimcordToolsConfig & {
|
|
574
|
+
devMode?: boolean | undefined;
|
|
575
|
+
embedColor?: ColorResolvable[] | undefined;
|
|
576
|
+
embedColorDev?: ColorResolvable[] | undefined;
|
|
577
|
+
timeouts?: {
|
|
578
|
+
pagination?: number | undefined;
|
|
579
|
+
prompt?: number | undefined;
|
|
580
|
+
modalSubmit?: number | undefined;
|
|
581
|
+
} | undefined;
|
|
582
|
+
paginator?: {
|
|
583
|
+
notAParticipantMessage?: string | undefined;
|
|
584
|
+
jumpableThreshold?: number | undefined;
|
|
585
|
+
longThreshold?: number | undefined;
|
|
586
|
+
buttons?: {
|
|
587
|
+
first?: {
|
|
588
|
+
label?: string | undefined;
|
|
589
|
+
emoji?: {
|
|
590
|
+
animated?: boolean | undefined;
|
|
591
|
+
name?: string | undefined;
|
|
592
|
+
id?: string | undefined;
|
|
593
|
+
} | undefined;
|
|
594
|
+
} | undefined;
|
|
595
|
+
back?: {
|
|
596
|
+
label?: string | undefined;
|
|
597
|
+
emoji?: {
|
|
598
|
+
animated?: boolean | undefined;
|
|
599
|
+
name?: string | undefined;
|
|
600
|
+
id?: string | undefined;
|
|
601
|
+
} | undefined;
|
|
602
|
+
} | undefined;
|
|
603
|
+
jump?: {
|
|
604
|
+
label?: string | undefined;
|
|
605
|
+
emoji?: {
|
|
606
|
+
animated?: boolean | undefined;
|
|
607
|
+
name?: string | undefined;
|
|
608
|
+
id?: string | undefined;
|
|
609
|
+
} | undefined;
|
|
610
|
+
} | undefined;
|
|
611
|
+
next?: {
|
|
612
|
+
label?: string | undefined;
|
|
613
|
+
emoji?: {
|
|
614
|
+
animated?: boolean | undefined;
|
|
615
|
+
name?: string | undefined;
|
|
616
|
+
id?: string | undefined;
|
|
617
|
+
} | undefined;
|
|
618
|
+
} | undefined;
|
|
619
|
+
last?: {
|
|
620
|
+
label?: string | undefined;
|
|
621
|
+
emoji?: {
|
|
622
|
+
animated?: boolean | undefined;
|
|
623
|
+
name?: string | undefined;
|
|
624
|
+
id?: string | undefined;
|
|
625
|
+
} | undefined;
|
|
626
|
+
} | undefined;
|
|
627
|
+
} | undefined;
|
|
628
|
+
} | undefined;
|
|
629
|
+
prompt?: {
|
|
630
|
+
defaultTitle?: string | undefined;
|
|
631
|
+
defaultDescription?: string | undefined;
|
|
632
|
+
confirmLabel?: string | undefined;
|
|
633
|
+
rejectLabel?: string | undefined;
|
|
634
|
+
} | undefined;
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
interface BetterContainerData {
|
|
638
|
+
color?: string | string[] | null;
|
|
639
|
+
config?: VimcordToolsConfig;
|
|
640
|
+
}
|
|
641
|
+
declare class BetterContainer {
|
|
642
|
+
private container;
|
|
643
|
+
private data;
|
|
644
|
+
private config;
|
|
645
|
+
constructor(data?: BetterContainerData);
|
|
646
|
+
private configure;
|
|
647
|
+
build(): void;
|
|
648
|
+
addSeparator(options?: {
|
|
649
|
+
divider?: boolean;
|
|
650
|
+
spacing?: number;
|
|
651
|
+
}): this;
|
|
652
|
+
addText(text: string | string[]): this;
|
|
653
|
+
addMedia(...media: {
|
|
654
|
+
url: string | string[];
|
|
655
|
+
spoiler?: boolean;
|
|
656
|
+
description?: string;
|
|
657
|
+
}[]): this;
|
|
658
|
+
addSection(data: {
|
|
659
|
+
text?: string | string[];
|
|
660
|
+
button?: Partial<ButtonComponentData>;
|
|
661
|
+
thumbnail?: Partial<APIThumbnailComponent>;
|
|
662
|
+
}): this;
|
|
663
|
+
addActionRow(...components: ActionRowBuilder<MessageActionRowComponentBuilder>[]): this;
|
|
664
|
+
toJSON(): discord_js.APIContainerComponent;
|
|
665
|
+
send(handler: SendHandler, options?: DynaSendOptions): Promise<Message | null>;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
type SendableComponent = ContainerBuilder | BetterContainer | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
669
|
+
type RequiredDynaSendOptions = DynaSendOptions & ({
|
|
670
|
+
content: string;
|
|
671
|
+
} | {
|
|
672
|
+
embeds: DynaSendOptions["embeds"];
|
|
673
|
+
} | {
|
|
674
|
+
components: DynaSendOptions["components"];
|
|
675
|
+
} | {
|
|
676
|
+
files: BaseMessageOptions["files"];
|
|
677
|
+
} | {
|
|
678
|
+
stickers: StickerResolvable[];
|
|
679
|
+
} | {
|
|
680
|
+
poll: PollData;
|
|
681
|
+
} | {
|
|
682
|
+
forward: ForwardOptions;
|
|
683
|
+
});
|
|
684
|
+
interface DynaSendOptions {
|
|
685
|
+
/** The method used to send the message - auto-detected if not provided */
|
|
686
|
+
sendMethod?: SendMethod;
|
|
687
|
+
/** Text content to send in the message */
|
|
688
|
+
content?: string;
|
|
689
|
+
/** Embeds to send with the message */
|
|
690
|
+
embeds?: EmbedResolvable[];
|
|
691
|
+
/** Components to send with the message */
|
|
692
|
+
components?: SendableComponent[];
|
|
693
|
+
/** Attachments to send with the message */
|
|
694
|
+
files?: BaseMessageOptions["files"];
|
|
695
|
+
/** Stickers to send with the message */
|
|
696
|
+
stickers?: StickerResolvable[];
|
|
697
|
+
/** Send a poll */
|
|
698
|
+
poll?: PollData;
|
|
699
|
+
/** Interaction flags */
|
|
700
|
+
flags?: InteractionReplyOptions["flags"];
|
|
701
|
+
/** Return the message after replying to or editing an interaction */
|
|
702
|
+
withResponse?: boolean;
|
|
703
|
+
/** Mention types allowed for the message */
|
|
704
|
+
allowedMentions?: MessageMentionOptions;
|
|
705
|
+
/** The message to reply to */
|
|
706
|
+
reply?: ReplyOptions;
|
|
707
|
+
/** Forward a message */
|
|
708
|
+
forward?: ForwardOptions;
|
|
709
|
+
/** Send as a TTS message */
|
|
710
|
+
tts?: boolean;
|
|
711
|
+
/** Time in milliseconds before deleting the message */
|
|
712
|
+
deleteAfter?: number;
|
|
713
|
+
}
|
|
714
|
+
declare class DynaSend {
|
|
715
|
+
private static forceArray;
|
|
716
|
+
private static isInteractionCallback;
|
|
717
|
+
private static filterFlags;
|
|
718
|
+
private static detectSendMethod;
|
|
719
|
+
private static validateSendMethod;
|
|
720
|
+
private static createMessageData;
|
|
721
|
+
private static executeSend;
|
|
722
|
+
private static scheduleDelete;
|
|
723
|
+
static send(handler: SendHandler, options: RequiredDynaSendOptions): Promise<Message | null>;
|
|
724
|
+
}
|
|
725
|
+
declare function dynaSend(handler: SendHandler, options: RequiredDynaSendOptions): Promise<Message | null>;
|
|
726
|
+
|
|
727
|
+
interface BetterEmbedContext {
|
|
728
|
+
client?: Vimcord | Client | null;
|
|
729
|
+
interaction?: InteractionResolveable | null;
|
|
730
|
+
channel?: TextBasedChannel | null;
|
|
731
|
+
message?: Message | null;
|
|
732
|
+
user?: GuildMember | User | null;
|
|
733
|
+
}
|
|
734
|
+
interface BetterEmbedAuthor {
|
|
735
|
+
text: string;
|
|
736
|
+
icon?: string | boolean | null;
|
|
737
|
+
hyperlink?: string | null;
|
|
738
|
+
}
|
|
739
|
+
interface BetterEmbedTitle {
|
|
740
|
+
text: string;
|
|
741
|
+
hyperlink?: string | null;
|
|
742
|
+
}
|
|
743
|
+
interface BetterEmbedFooter {
|
|
744
|
+
text: string;
|
|
745
|
+
icon?: string | boolean | null;
|
|
746
|
+
}
|
|
747
|
+
interface BetterEmbedData {
|
|
748
|
+
context?: BetterEmbedContext | null;
|
|
749
|
+
author?: string | BetterEmbedAuthor | null;
|
|
750
|
+
title?: string | BetterEmbedTitle | null;
|
|
751
|
+
thumbnailUrl?: string | null;
|
|
752
|
+
description?: string | string[] | null;
|
|
753
|
+
imageUrl?: string | null;
|
|
754
|
+
footer?: string | BetterEmbedFooter | null;
|
|
755
|
+
fields?: APIEmbedField[];
|
|
756
|
+
color?: ColorResolvable | ColorResolvable[] | null;
|
|
757
|
+
timestamp?: number | boolean | Date | null;
|
|
758
|
+
acf?: boolean;
|
|
759
|
+
config?: VimcordToolsConfig;
|
|
760
|
+
}
|
|
761
|
+
declare class BetterEmbed {
|
|
762
|
+
private embed;
|
|
763
|
+
private data;
|
|
764
|
+
private config;
|
|
765
|
+
/** A powerful wrapper for `EmbedBuilder` that introduces useful features
|
|
766
|
+
*
|
|
767
|
+
* Auto-shorthand context formatting (_ACF_) is enabled by default
|
|
768
|
+
*
|
|
769
|
+
* All functions utilize _ACF_ unless `BetterEmbed.acf` is set to `false`
|
|
770
|
+
*
|
|
771
|
+
* ___Use a blackslash___ `\` ___to escape any context___
|
|
772
|
+
*
|
|
773
|
+
* \- - - Author Context - - -
|
|
774
|
+
* - __`$USER`__: _author's mention (@xsqu1znt)_
|
|
775
|
+
* - __`$USER_NAME`__: _author's username_
|
|
776
|
+
* - __`$DISPLAY_NAME`__: _author's display name (requires `GuildMember` context)_
|
|
777
|
+
* - __`$USER_AVATAR`__: _author's avatar_
|
|
778
|
+
*
|
|
779
|
+
* \- - - Client Context - - -
|
|
780
|
+
*
|
|
781
|
+
* - __`$BOT_AVATAR`__: _bot's avatar_
|
|
782
|
+
*
|
|
783
|
+
* \- - - Shorthand Context - - -
|
|
784
|
+
* - __`$YEAR`__: _YYYY_
|
|
785
|
+
* - __`$MONTH`__: _MM_
|
|
786
|
+
* - __`$DAY`__: _DD_
|
|
787
|
+
* - __`$year`__: _YY_
|
|
788
|
+
* - __`$month`__: _M or MM_
|
|
789
|
+
* - __`$day`__: _D or DD_ */
|
|
790
|
+
constructor(data?: BetterEmbedData);
|
|
791
|
+
private build;
|
|
792
|
+
private normalizeData;
|
|
793
|
+
private getContextUser;
|
|
794
|
+
private getContextClient;
|
|
795
|
+
private applyContextFormatting;
|
|
796
|
+
private configureEmbed;
|
|
797
|
+
setAuthor(author: string | BetterEmbedAuthor | null): this;
|
|
798
|
+
setTitle(title: string | BetterEmbedTitle | null): this;
|
|
799
|
+
setDescription(description: string | null): this;
|
|
800
|
+
setThumbnail(url: string | null): this;
|
|
801
|
+
setImage(url: string | null): this;
|
|
802
|
+
setFooter(footer: string | BetterEmbedFooter | null): this;
|
|
803
|
+
setColor(color: ColorResolvable | ColorResolvable[] | null): this;
|
|
804
|
+
setTimestamp(timestamp: number | boolean | Date | null): this;
|
|
805
|
+
addFields(fields: APIEmbedField[]): this;
|
|
806
|
+
setFields(fields: APIEmbedField[]): this;
|
|
807
|
+
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
808
|
+
clone(overrides?: Partial<BetterEmbedData>): BetterEmbed;
|
|
809
|
+
toJSON(): APIEmbed;
|
|
810
|
+
send(handler: SendHandler, options?: DynaSendOptions, overrides?: Partial<BetterEmbedData>): Promise<Message | null>;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
interface CommandErrorMessageConfig {
|
|
814
|
+
/** Use a custom embed */
|
|
815
|
+
embed?: (embed: BetterEmbed, error: Error, guild: Guild | null | undefined) => BetterEmbed;
|
|
816
|
+
/** @default config.staff.mainServer.inviteUrl */
|
|
817
|
+
inviteUrl?: string;
|
|
818
|
+
/** The support server invite button label @default "Support Server" */
|
|
819
|
+
inviteButtonLabel?: string;
|
|
820
|
+
/** The error details button label @default "Details" */
|
|
821
|
+
detailButtonLabel?: string;
|
|
822
|
+
/** @default 30_000 // 30 seconds */
|
|
823
|
+
detailButtonIdleTimeout?: number;
|
|
824
|
+
/** Should the message be ephemeral? */
|
|
825
|
+
ephemeral?: boolean;
|
|
826
|
+
/** Should the message be deleted after a certain amount of time? */
|
|
827
|
+
deleteAfter?: number;
|
|
828
|
+
}
|
|
829
|
+
interface VimcordFeatures {
|
|
830
|
+
/** Use global process error handlers @defaultValue `false` */
|
|
831
|
+
useGlobalErrorHandlers?: boolean;
|
|
832
|
+
/** Use our default prefix command handler @defaultValue `true` */
|
|
833
|
+
useDefaultPrefixCommandHandler?: boolean;
|
|
834
|
+
/** Use our default slash command handler @defaultValue `true` */
|
|
835
|
+
useDefaultSlashCommandHandler?: boolean;
|
|
836
|
+
/** Use our default context command handler @defaultValue `true` */
|
|
837
|
+
useDefaultContextCommandHandler?: boolean;
|
|
838
|
+
/** Reply to the user with an Uh-oh! embed when a command fails. If not using our default command handlers, you will have to implement this yourself using {@link sendCommandErrorEmbed}
|
|
839
|
+
* @example
|
|
840
|
+
* ```ts
|
|
841
|
+
* try {
|
|
842
|
+
* // Execute the command
|
|
843
|
+
* return command.executeCommand(client, message);
|
|
844
|
+
* } catch (err) {
|
|
845
|
+
* // Send the error embed, this already handles the feature configuration
|
|
846
|
+
* sendCommandErrorEmbed(client, err as Error, message.guild, message);
|
|
847
|
+
* // Re-throw the error so it can be handled by an error handler
|
|
848
|
+
* throw err;
|
|
849
|
+
* }
|
|
850
|
+
* ``` */
|
|
851
|
+
enableCommandErrorMessage?: boolean | CommandErrorMessageConfig;
|
|
852
|
+
/** Update the state of {@link globalVimcordToolsConfig.devMode} whenever {@link VimcordAppConfig.devMode} is updated in the client. This is mainly useful for {@link BetterEmbed} to switch between devMode and production colors during runtime without having to update the global config manually @defaultValue `false` */
|
|
853
|
+
hookToolsDevMode?: boolean;
|
|
854
|
+
/** Setup and configure `dotenv` @defaultValue `false` */
|
|
855
|
+
useEnv?: boolean | DotenvConfigOptions;
|
|
856
|
+
/** The maximum number of attempts to log into Discord @defaultValue `3` */
|
|
857
|
+
loginAttempts?: number;
|
|
858
|
+
/** Import modules from directories */
|
|
859
|
+
importModules?: {
|
|
860
|
+
events?: string | string[];
|
|
861
|
+
slashCommands?: string | string[];
|
|
862
|
+
prefixCommands?: string | string[];
|
|
863
|
+
contextCommands?: string | string[];
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
interface VimcordConfig {
|
|
867
|
+
app: VimcordAppConfig;
|
|
868
|
+
staff: VimcordStaffConfig;
|
|
869
|
+
slashCommands: VimcordSlashCommandConfig;
|
|
870
|
+
prefixCommands: VimcordPrefixCommandConfig;
|
|
871
|
+
contextCommands: VimcordContextCommandConfig;
|
|
872
|
+
}
|
|
873
|
+
declare const clientInstances: Vimcord[];
|
|
874
|
+
declare class Vimcord<Ready extends boolean = boolean> extends Client<Ready> {
|
|
875
|
+
readonly uuid: string;
|
|
876
|
+
readonly index: number;
|
|
877
|
+
readonly clientOptions: ClientOptions;
|
|
878
|
+
readonly features: VimcordFeatures;
|
|
879
|
+
readonly config: VimcordConfig;
|
|
880
|
+
status: VimcordStatusManager;
|
|
881
|
+
events: VimcordEventManager;
|
|
882
|
+
commands: VimcordCommandManager;
|
|
883
|
+
database?: VimcordDatabaseManager;
|
|
884
|
+
logger: Logger & {
|
|
885
|
+
clientBanner(client: Vimcord): void;
|
|
886
|
+
clientReady(clientTag: string, guildCount: number): void;
|
|
887
|
+
moduleLoaded(moduleName: string, count?: number, ignoredCount?: number): void;
|
|
888
|
+
commandExecuted(commandName: string, username: string, guildName?: string): void;
|
|
889
|
+
database(action: string, details?: string): void;
|
|
890
|
+
};
|
|
891
|
+
private clientStartingPromise;
|
|
892
|
+
constructor(options: ClientOptions, features?: VimcordFeatures, config?: PartialDeep<VimcordConfig>);
|
|
893
|
+
/** Returns the options, features, and config of this client */
|
|
894
|
+
toJSON(): {
|
|
895
|
+
options: ClientOptions;
|
|
896
|
+
features: VimcordFeatures;
|
|
897
|
+
config: VimcordConfig;
|
|
898
|
+
};
|
|
899
|
+
/** Make a clone of this client */
|
|
900
|
+
clone(): Vimcord<boolean>;
|
|
901
|
+
configureApp(options?: PartialDeep<VimcordAppConfig>): this;
|
|
902
|
+
configureStaff(options?: PartialDeep<VimcordStaffConfig>): this;
|
|
903
|
+
configureSlashCommands(options: PartialDeep<VimcordSlashCommandConfig>): this;
|
|
904
|
+
configurePrefixCommands(options: PartialDeep<VimcordPrefixCommandConfig>): this;
|
|
905
|
+
configureContextCommands(options: PartialDeep<VimcordContextCommandConfig>): this;
|
|
906
|
+
addEventModules(dir: string | string[], replaceAll?: boolean): Promise<this>;
|
|
907
|
+
addSlashCommandModules(dir: string | string[], replaceAll?: boolean): Promise<this>;
|
|
908
|
+
addPrefixCommandModules(dir: string | string[], replaceAll?: boolean): Promise<this>;
|
|
909
|
+
addContextCommandModules(dir: string | string[], replaceAll?: boolean): Promise<this>;
|
|
910
|
+
useDatabase(database: VimcordDatabaseManager): Promise<boolean>;
|
|
911
|
+
whenReady(): Promise<Vimcord<true>>;
|
|
912
|
+
build(): Promise<this>;
|
|
913
|
+
/** Automatically uses `process.env.TOKEN` or `process.env.TOKEN_DEV` if token isn't provided */
|
|
914
|
+
start(token?: string): Promise<string | null>;
|
|
915
|
+
start(preHook?: (client: Vimcord) => any): Promise<string | null>;
|
|
916
|
+
start(token?: string, preHook?: (client: Vimcord) => any): Promise<string | null>;
|
|
917
|
+
kill(): Promise<void>;
|
|
918
|
+
/** Shortcut for {@link fetchUser tools.fetchUser} */
|
|
919
|
+
fetchUser(id: string | undefined | null): Promise<User | null>;
|
|
920
|
+
/** Shortcut for {@link fetchGuild tools.fetchGuild} */
|
|
921
|
+
fetchGuild(id: string | undefined | null): Promise<Guild | null>;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
declare enum CommandType {
|
|
925
|
+
Slash = 0,
|
|
926
|
+
Prefix = 1,
|
|
927
|
+
Context = 2
|
|
928
|
+
}
|
|
929
|
+
declare enum MissingPermissionReason {
|
|
930
|
+
User = 0,
|
|
931
|
+
Bot = 1,
|
|
932
|
+
Role = 2,
|
|
933
|
+
UserBlacklisted = 3,
|
|
934
|
+
RoleBlacklisted = 4,
|
|
935
|
+
NotInGuild = 5,
|
|
936
|
+
NotGuildOwner = 6,
|
|
937
|
+
NotBotOwner = 7,
|
|
938
|
+
NotBotStaff = 8
|
|
939
|
+
}
|
|
940
|
+
declare enum RateLimitScope {
|
|
941
|
+
User = 0,
|
|
942
|
+
Guild = 1,
|
|
943
|
+
Channel = 2,
|
|
944
|
+
Global = 3
|
|
945
|
+
}
|
|
946
|
+
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
|
+
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 */
|
|
970
|
+
enabled?: boolean;
|
|
971
|
+
/** Custom conditions that must be met for this command to execute */
|
|
972
|
+
conditions?: Array<(...args: BaseCommandParameters<T>) => boolean>;
|
|
973
|
+
/** Command permission requirements */
|
|
974
|
+
permissions?: CommandPermissions;
|
|
975
|
+
/** Command metadata configuration */
|
|
976
|
+
metadata?: CommandMetadata;
|
|
977
|
+
/** Rate limiting options */
|
|
978
|
+
rateLimit?: CommandRateLimitOptions<(...args: BaseCommandParameters<T>) => any>;
|
|
979
|
+
}
|
|
980
|
+
interface BaseAppCommandConfig {
|
|
981
|
+
/** Command deployment configuration */
|
|
982
|
+
deployment?: AppCommandDeployment;
|
|
983
|
+
}
|
|
984
|
+
interface BaseCommandFunctionConfig<T extends CommandType> {
|
|
985
|
+
/** Before command execution */
|
|
986
|
+
beforeExecute?: (...args: BaseCommandParameters<T>) => any;
|
|
987
|
+
/** The main command function that will be executed */
|
|
988
|
+
execute?: (...args: BaseCommandParameters<T>) => any;
|
|
989
|
+
/** After successful execution */
|
|
990
|
+
afterExecute?: (result: any, ...args: BaseCommandParameters<T>) => any;
|
|
991
|
+
/** Executed when the rate limit is hit */
|
|
992
|
+
onRateLimit?: (...args: BaseCommandParameters<T>) => any;
|
|
993
|
+
/** Executed when the required permissions are not met */
|
|
994
|
+
onMissingPermissions?: (results: CommandPermissionResults, ...args: BaseCommandParameters<T>) => any;
|
|
995
|
+
/** Executed when the required conditions are not met */
|
|
996
|
+
onConditionsNotMet?: (...args: BaseCommandParameters<T>) => any;
|
|
997
|
+
/** Executed when this command is used when its disabled */
|
|
998
|
+
onUsedWhenDisabled?: (...args: BaseCommandParameters<T>) => any;
|
|
999
|
+
/** Custom error handler */
|
|
1000
|
+
onError?: (error: Error, ...args: BaseCommandParameters<T>) => any;
|
|
1001
|
+
}
|
|
1002
|
+
interface CommandInternalRateLimitData {
|
|
1003
|
+
/** Number of times executed */
|
|
1004
|
+
executions: number;
|
|
1005
|
+
/** Timestamp of latest execution */
|
|
1006
|
+
timestamp: number;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
declare class BaseCommandBuilder<T extends CommandType, CommandConfig extends BaseCommandOptions<T> & BaseCommandFunctionConfig<T> = BaseCommandOptions<T> & BaseCommandFunctionConfig<T>> implements BaseCommandOptions<T>, BaseCommandFunctionConfig<T> {
|
|
1010
|
+
readonly uuid: string;
|
|
1011
|
+
readonly commandType: T;
|
|
1012
|
+
client?: Vimcord;
|
|
1013
|
+
enabled: boolean;
|
|
1014
|
+
conditions?: Array<(...args: BaseCommandParameters<T>) => boolean>;
|
|
1015
|
+
permissions?: CommandPermissions;
|
|
1016
|
+
metadata?: CommandMetadata;
|
|
1017
|
+
rateLimit?: CommandRateLimitOptions<(...args: BaseCommandParameters<T>) => any>;
|
|
1018
|
+
beforeExecute?: (...args: BaseCommandParameters<T>) => any;
|
|
1019
|
+
execute?: (...args: BaseCommandParameters<T>) => any;
|
|
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);
|
|
1031
|
+
private validateBaseConfig;
|
|
1032
|
+
toConfig(): BaseCommandConfig<T>;
|
|
1033
|
+
setEnabled(enabled: boolean): this;
|
|
1034
|
+
addConditions(...conditions: Array<(...args: BaseCommandParameters<CommandType>) => boolean>): this;
|
|
1035
|
+
setConditions(conditions: Array<(...args: BaseCommandParameters<CommandType>) => boolean>): this;
|
|
1036
|
+
setPermissions(permissions: CommandPermissions): this;
|
|
1037
|
+
setMetadata(metadata: CommandMetadata): this;
|
|
1038
|
+
setRateLimit(options: CommandRateLimitOptions<(...args: BaseCommandParameters<CommandType>) => any>): this;
|
|
1039
|
+
setBeforeExecute(callback: (...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1040
|
+
setExecute(callback: (...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1041
|
+
setAfterExecute(callback: (result: any, ...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1042
|
+
setOnRateLimit(callback: (...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1043
|
+
setOnMissingPermissions(callback: (results: CommandPermissionResults, ...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1044
|
+
setOnConditionsNotMet(callback: (...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1045
|
+
setOnUsedWhenDisabled(callback: (...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1046
|
+
setOnError(callback: (error: Error, ...args: BaseCommandParameters<CommandType>) => any): this;
|
|
1047
|
+
getRateLimitInfo(user?: User, guild?: Guild, channel?: TextBasedChannel): {
|
|
1048
|
+
executions: number;
|
|
1049
|
+
timestamp: number;
|
|
1050
|
+
isLimited: boolean;
|
|
1051
|
+
} | null;
|
|
1052
|
+
isRateLimited(user?: User | null, guild?: Guild | null, channel?: TextBasedChannel | null, updateExecutions?: boolean): boolean;
|
|
1053
|
+
checkPermissions(client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1054
|
+
checkConditions(...args: BaseCommandParameters<T>): Promise<boolean>;
|
|
1055
|
+
_runPreflight(clientConfig: BaseCommandConfig<T>, command: CommandInteraction | string, ...args: BaseCommandParameters<T>): Promise<any>;
|
|
1056
|
+
_runCabinCheck(clientConfig: BaseCommandConfig<T>, ...args: BaseCommandParameters<T>): Promise<any>;
|
|
1057
|
+
_runFlyAndLand(clientConfig: BaseCommandConfig<T>, ...args: BaseCommandParameters<T>): Promise<any>;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
type ExtractReturn<T> = T extends (this: any, ...args: any) => infer R ? Awaited<R> : never;
|
|
1061
|
+
type LeanOrHydratedDocument<T, O extends QueryOptions<T>> = O["lean"] extends false ? HydratedDocument<T> : Require_id<T>;
|
|
1062
|
+
interface MongoSchemaEvents {
|
|
1063
|
+
initialized: [];
|
|
1064
|
+
ready: [boolean];
|
|
1065
|
+
error: [Error];
|
|
1066
|
+
}
|
|
1067
|
+
interface MongoSchemaOptions {
|
|
1068
|
+
connectionIndex?: number;
|
|
1069
|
+
}
|
|
1070
|
+
declare function createMongoSchema<Definition extends object>(collection: string, definition: SchemaDefinition<Definition>, options?: MongoSchemaOptions): MongoSchemaBuilder<Definition>;
|
|
1071
|
+
declare class MongoSchemaBuilder<Definition extends object> {
|
|
1072
|
+
schema: Schema<Definition>;
|
|
1073
|
+
model: Model<Definition>;
|
|
1074
|
+
database: MongoDatabase | null;
|
|
1075
|
+
connectionIndex: number;
|
|
1076
|
+
isReady: boolean;
|
|
1077
|
+
isInitializing: boolean;
|
|
1078
|
+
eventEmitter: EventEmitter<MongoSchemaEvents>;
|
|
1079
|
+
logger: Logger;
|
|
1080
|
+
constructor(collection: string, definition: SchemaDefinition<Definition>, options?: MongoSchemaOptions);
|
|
1081
|
+
private init;
|
|
1082
|
+
extend<Extra extends Record<string, (...args: any) => any>>(extras: Extra & ThisType<MongoSchemaBuilder<Definition>>): MongoSchemaBuilder<Definition> & Extra;
|
|
1083
|
+
on<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1084
|
+
once<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1085
|
+
off<K extends keyof MongoSchemaEvents>(event: K, listener: (...args: MongoSchemaEvents[K]) => void): this;
|
|
1086
|
+
execute<T extends (...args: any) => Promise<any>>(fn: T): Promise<ExtractReturn<T> | undefined>;
|
|
1087
|
+
createHexId(bytes: number, path: keyof Require_id<Definition>, maxRetries?: number): Promise<string | undefined>;
|
|
1088
|
+
count(filter?: RootFilterQuery<Definition>): Promise<number | undefined>;
|
|
1089
|
+
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 {
|
|
1091
|
+
__v?: infer U;
|
|
1092
|
+
} ? T : T & {
|
|
1093
|
+
__v: number;
|
|
1094
|
+
} : never : never)) | undefined>;
|
|
1095
|
+
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
|
+
__v?: infer U;
|
|
1097
|
+
} ? T : T & {
|
|
1098
|
+
__v: number;
|
|
1099
|
+
} : 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>;
|
|
1103
|
+
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
1104
|
+
fetchAll<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
1105
|
+
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?: Parameters<Model<Definition>["updateMany"]>[2]): Promise<mongoose.UpdateWriteOpResult | undefined>;
|
|
1107
|
+
aggregate<T extends any>(pipeline: PipelineStage[], options?: AggregateOptions): Promise<T[]>;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
type _TextInputComponentData = Partial<APITextInputComponent> & _LabelComponentData;
|
|
1111
|
+
type _StringSelectComponentData = Partial<APIStringSelectComponent> & _LabelComponentData;
|
|
1112
|
+
type _ChannelSelectComponentData = Partial<APIChannelSelectComponent> & _LabelComponentData;
|
|
1113
|
+
type _UserSelectComponentData = Partial<APIUserSelectComponent> & _LabelComponentData;
|
|
1114
|
+
type _RoleSelectComponentData = Partial<APIRoleSelectComponent> & _LabelComponentData;
|
|
1115
|
+
type _MentionableSelectComponentData = Partial<APIMentionableSelectComponent> & _LabelComponentData;
|
|
1116
|
+
type _FileUploadComponentData = Partial<APIFileUploadComponent> & _LabelComponentData;
|
|
1117
|
+
type BetterTextInputComponent = {
|
|
1118
|
+
textInput: _TextInputComponentData;
|
|
1119
|
+
};
|
|
1120
|
+
type BetterStringSelectComponent = {
|
|
1121
|
+
stringSelect: _StringSelectComponentData;
|
|
1122
|
+
};
|
|
1123
|
+
type BetterChannelSelectComponent = {
|
|
1124
|
+
channelSelect: _ChannelSelectComponentData;
|
|
1125
|
+
};
|
|
1126
|
+
type BetterUserSelectComponent = {
|
|
1127
|
+
userSelect: _UserSelectComponentData;
|
|
1128
|
+
};
|
|
1129
|
+
type BetterRoleSelectComponent = {
|
|
1130
|
+
roleSelect: _RoleSelectComponentData;
|
|
1131
|
+
};
|
|
1132
|
+
type BetterMentionableSelectComponent = {
|
|
1133
|
+
mentionableSelect: _MentionableSelectComponentData;
|
|
1134
|
+
};
|
|
1135
|
+
type BetterFileUploadSelectComponent = {
|
|
1136
|
+
fileUpload: _FileUploadComponentData;
|
|
1137
|
+
};
|
|
1138
|
+
type BetterModalComponent = BetterTextInputComponent | BetterStringSelectComponent | BetterChannelSelectComponent | BetterUserSelectComponent | BetterRoleSelectComponent | BetterMentionableSelectComponent | BetterFileUploadSelectComponent;
|
|
1139
|
+
interface _LabelComponentData {
|
|
1140
|
+
label: string;
|
|
1141
|
+
description?: string;
|
|
1142
|
+
}
|
|
1143
|
+
interface BetterModalOptions {
|
|
1144
|
+
/** The ID of the modal, if not provided will generate a time-based ID */
|
|
1145
|
+
id?: string;
|
|
1146
|
+
/** The title of the modal */
|
|
1147
|
+
title?: string;
|
|
1148
|
+
/** Max 5 components */
|
|
1149
|
+
components?: BetterModalComponent[];
|
|
1150
|
+
config?: VimcordToolsConfig;
|
|
1151
|
+
}
|
|
1152
|
+
interface ModalSubmitResult<T extends Record<string, any> = Record<string, any>> {
|
|
1153
|
+
/** Modal fields by custom_id */
|
|
1154
|
+
fields: T;
|
|
1155
|
+
/** Modal fields in the order components were added */
|
|
1156
|
+
values: any[];
|
|
1157
|
+
/** The modal submit interaction for replying */
|
|
1158
|
+
interaction: ModalSubmitInteraction;
|
|
1159
|
+
}
|
|
1160
|
+
declare class BetterModal {
|
|
1161
|
+
id: string;
|
|
1162
|
+
options: BetterModalOptions;
|
|
1163
|
+
private modal;
|
|
1164
|
+
private components;
|
|
1165
|
+
private config;
|
|
1166
|
+
constructor(options?: BetterModalOptions);
|
|
1167
|
+
private createModalId;
|
|
1168
|
+
private createComponentId;
|
|
1169
|
+
private validateComponentLength;
|
|
1170
|
+
toJSON(): APIModalInteractionResponseCallbackData;
|
|
1171
|
+
build(): ModalBuilder;
|
|
1172
|
+
setTitle(title: string): this;
|
|
1173
|
+
addComponents(...components: BetterModalComponent[]): this;
|
|
1174
|
+
setComponents(...components: BetterModalComponent[]): this;
|
|
1175
|
+
addTextInput(data: _TextInputComponentData): this;
|
|
1176
|
+
addStringSelect(data: _StringSelectComponentData): this;
|
|
1177
|
+
addChannelSelect(data: _ChannelSelectComponentData): this;
|
|
1178
|
+
addUserSelect(data: _UserSelectComponentData): this;
|
|
1179
|
+
addRoleSelect(data: _RoleSelectComponentData): this;
|
|
1180
|
+
addMentionableSelect(data: _MentionableSelectComponentData): this;
|
|
1181
|
+
addFileUpload(data: _FileUploadComponentData): this;
|
|
1182
|
+
/** Show the modal via interaction */
|
|
1183
|
+
show(interaction: Interaction): Promise<void>;
|
|
1184
|
+
/** Waits for the modal to be submitted and returns the component data
|
|
1185
|
+
* @param interaction The interaction used to show the modal
|
|
1186
|
+
* @param options Options */
|
|
1187
|
+
awaitSubmit<T extends Record<string, any> = Record<string, string>>(interaction: Interaction, options?: Omit<AwaitModalSubmitOptions<ModalSubmitInteraction>, "filter">): Promise<ModalSubmitResult<T> | null>;
|
|
1188
|
+
showAndAwait<T extends Record<string, any> = Record<string, string>>(interaction: Interaction, options?: Omit<AwaitModalSubmitOptions<ModalSubmitInteraction>, "filter">): Promise<ModalSubmitResult<T> | null>;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
type SinglePageResolvable = string | EmbedResolvable | ContainerBuilder | BetterContainer;
|
|
1192
|
+
type PageResolvable = SinglePageResolvable | EmbedResolvable[];
|
|
1193
|
+
type Chapter = PageResolvable[];
|
|
1194
|
+
interface PageIndex {
|
|
1195
|
+
chapter: number;
|
|
1196
|
+
nested: number;
|
|
1197
|
+
}
|
|
1198
|
+
interface ChapterData extends Omit<SelectMenuComponentOptionData, "value"> {
|
|
1199
|
+
value?: string;
|
|
1200
|
+
}
|
|
1201
|
+
interface PaginationEvent {
|
|
1202
|
+
beforeChapterChange: [chapterIndex: number];
|
|
1203
|
+
chapterChange: [option: StringSelectMenuOptionBuilder, page: PageResolvable, index: PageIndex];
|
|
1204
|
+
beforePageChange: [nestedIndex: number];
|
|
1205
|
+
pageChange: [page: PageResolvable, index: PageIndex];
|
|
1206
|
+
first: [page: PageResolvable, index: PageIndex];
|
|
1207
|
+
back: [page: PageResolvable, index: PageIndex];
|
|
1208
|
+
jump: [page: PageResolvable, index: PageIndex];
|
|
1209
|
+
next: [page: PageResolvable, index: PageIndex];
|
|
1210
|
+
last: [page: PageResolvable, index: PageIndex];
|
|
1211
|
+
collect: [interaction: StringSelectMenuInteraction | ButtonInteraction, page: PageResolvable, index: PageIndex];
|
|
1212
|
+
react: [reaction: MessageReaction, user: User, page: PageResolvable, index: PageIndex];
|
|
1213
|
+
timeout: [message: Message];
|
|
1214
|
+
}
|
|
1215
|
+
interface PaginatorOptions {
|
|
1216
|
+
/** @default {@link PaginationType.Short} */
|
|
1217
|
+
type?: PaginationType;
|
|
1218
|
+
participants?: UserResolvable$1[];
|
|
1219
|
+
/** Shorthand to create the Paginator with only 1 chapter */
|
|
1220
|
+
pages?: PageResolvable[];
|
|
1221
|
+
/** @default false */
|
|
1222
|
+
useReactions?: boolean;
|
|
1223
|
+
/** @default false */
|
|
1224
|
+
dynamic?: boolean;
|
|
1225
|
+
timeout?: number;
|
|
1226
|
+
/** @default {@link PaginationTimeoutType.ClearComponents} */
|
|
1227
|
+
onTimeout?: PaginationTimeoutType;
|
|
1228
|
+
config?: VimcordToolsConfig;
|
|
1229
|
+
}
|
|
1230
|
+
interface PaginatorData {
|
|
1231
|
+
message: Message | null;
|
|
1232
|
+
messageActionRows: ActionRowBuilder<StringSelectMenuBuilder | ButtonBuilder>[];
|
|
1233
|
+
messageSendOptions: DynaSendOptions | undefined;
|
|
1234
|
+
extraButtons: {
|
|
1235
|
+
index: number;
|
|
1236
|
+
component: ButtonBuilder;
|
|
1237
|
+
}[];
|
|
1238
|
+
page: {
|
|
1239
|
+
current: PageResolvable | null;
|
|
1240
|
+
index: PageIndex;
|
|
1241
|
+
};
|
|
1242
|
+
navigation: {
|
|
1243
|
+
reactions: {
|
|
1244
|
+
name: string;
|
|
1245
|
+
id: string;
|
|
1246
|
+
}[];
|
|
1247
|
+
isRequired: boolean;
|
|
1248
|
+
isLong: boolean;
|
|
1249
|
+
canJump: boolean;
|
|
1250
|
+
};
|
|
1251
|
+
collectors: {
|
|
1252
|
+
component: InteractionCollector<StringSelectMenuInteraction | ButtonInteraction> | null;
|
|
1253
|
+
reaction: ReactionCollector | null;
|
|
1254
|
+
};
|
|
1255
|
+
components: {
|
|
1256
|
+
chapterSelect: StringSelectMenuBuilder;
|
|
1257
|
+
navigation: Record<keyof VimcordToolsConfig["paginator"]["buttons"], ButtonBuilder>;
|
|
1258
|
+
actionRows: {
|
|
1259
|
+
chapterSelect: ActionRowBuilder<StringSelectMenuBuilder>;
|
|
1260
|
+
navigation: ActionRowBuilder<ButtonBuilder>;
|
|
1261
|
+
};
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
declare enum PaginationType {
|
|
1265
|
+
Short = 0,
|
|
1266
|
+
ShortJump = 1,
|
|
1267
|
+
Long = 2,
|
|
1268
|
+
LongJump = 3
|
|
1269
|
+
}
|
|
1270
|
+
declare enum PaginationTimeoutType {
|
|
1271
|
+
DisableComponents = 0,
|
|
1272
|
+
ClearComponents = 1,
|
|
1273
|
+
DeleteMessage = 2
|
|
1274
|
+
}
|
|
1275
|
+
declare class Paginator {
|
|
1276
|
+
chapters: {
|
|
1277
|
+
id: string;
|
|
1278
|
+
pages: Chapter;
|
|
1279
|
+
}[];
|
|
1280
|
+
private options;
|
|
1281
|
+
private config;
|
|
1282
|
+
private data;
|
|
1283
|
+
private events;
|
|
1284
|
+
eventEmitter: EventEmitter<PaginationEvent>;
|
|
1285
|
+
constructor(options?: PaginatorOptions);
|
|
1286
|
+
private build;
|
|
1287
|
+
private buildSendOptions;
|
|
1288
|
+
private handlePostTimeout;
|
|
1289
|
+
private nav_removeFromMessage;
|
|
1290
|
+
private nav_addReactions;
|
|
1291
|
+
private collect_components;
|
|
1292
|
+
private callEventStack;
|
|
1293
|
+
on<T extends keyof PaginationEvent>(event: T, listener: (...args: PaginationEvent[T]) => void, once?: boolean): this;
|
|
1294
|
+
/** Adds a chapter to the paginator.
|
|
1295
|
+
* @param pages The pages for this chapter.
|
|
1296
|
+
* Note: `[Embed1, Embed2]` = 2 Pages. `[[Embed1, Embed2]]` = 1 Page (Group of 2).
|
|
1297
|
+
* @param data Metadata for the chapter select menu. */
|
|
1298
|
+
addChapter(pages: PageResolvable | PageResolvable[], data: ChapterData): this;
|
|
1299
|
+
spliceChapters(index: number, deleteCount: number): this;
|
|
1300
|
+
hydrateChapter(index: number, pages: PageResolvable | PageResolvable[], set?: boolean): this;
|
|
1301
|
+
setPaginationType(type: PaginationType): this;
|
|
1302
|
+
insertButtonAt(index: number, component: ButtonBuilder): this;
|
|
1303
|
+
removeButtonAt(...index: number[]): this;
|
|
1304
|
+
setPage(chapterIndex?: number, nestedIndex?: number): Promise<void>;
|
|
1305
|
+
refresh(): Promise<Message | null>;
|
|
1306
|
+
send(handler: SendHandler, options?: DynaSendOptions): Promise<Message | null>;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
declare enum PromptResolveType {
|
|
1310
|
+
DisableComponents = 0,
|
|
1311
|
+
ClearComponents = 1,
|
|
1312
|
+
DeleteOnConfirm = 3,
|
|
1313
|
+
DeleteOnReject = 4
|
|
1314
|
+
}
|
|
1315
|
+
type ButtonHandler = (interaction: ButtonInteraction) => void | Promise<void>;
|
|
1316
|
+
interface CustomButton {
|
|
1317
|
+
builder: ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | Partial<APIButtonComponent>;
|
|
1318
|
+
handler?: ButtonHandler;
|
|
1319
|
+
/** Position index: 0 = before confirm, 1 = between confirm/reject, 2+ = after reject
|
|
1320
|
+
* @default 2 */
|
|
1321
|
+
index?: number;
|
|
1322
|
+
}
|
|
1323
|
+
interface PromptOptions {
|
|
1324
|
+
participants?: UserResolvable$1[];
|
|
1325
|
+
content?: string;
|
|
1326
|
+
embed?: EmbedResolvable;
|
|
1327
|
+
container?: ContainerBuilder | BetterContainer;
|
|
1328
|
+
buttons?: {
|
|
1329
|
+
confirm?: ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | Partial<APIButtonComponent>;
|
|
1330
|
+
reject?: ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | Partial<APIButtonComponent>;
|
|
1331
|
+
};
|
|
1332
|
+
customButtons?: Record<string, CustomButton>;
|
|
1333
|
+
/** @default [PromptResolveType.DeleteOnConfirm, PromptResolveType.DeleteOnReject] */
|
|
1334
|
+
onResolve?: PromptResolveType[];
|
|
1335
|
+
timeout?: number;
|
|
1336
|
+
config?: VimcordToolsConfig;
|
|
1337
|
+
}
|
|
1338
|
+
interface PromptResult {
|
|
1339
|
+
message: Message | null;
|
|
1340
|
+
confirmed: boolean | null;
|
|
1341
|
+
customId: string | null;
|
|
1342
|
+
timedOut: boolean;
|
|
1343
|
+
}
|
|
1344
|
+
declare class Prompt {
|
|
1345
|
+
readonly participants: UserResolvable$1[];
|
|
1346
|
+
readonly content?: string;
|
|
1347
|
+
readonly embed: EmbedResolvable;
|
|
1348
|
+
readonly container?: ContainerBuilder | BetterContainer;
|
|
1349
|
+
readonly buttons: {
|
|
1350
|
+
confirm: ButtonBuilder;
|
|
1351
|
+
reject: ButtonBuilder;
|
|
1352
|
+
};
|
|
1353
|
+
readonly customButtons: Map<string, {
|
|
1354
|
+
button: ButtonBuilder;
|
|
1355
|
+
handler?: ButtonHandler;
|
|
1356
|
+
index: number;
|
|
1357
|
+
}>;
|
|
1358
|
+
readonly onResolve: PromptResolveType[];
|
|
1359
|
+
readonly timeout: number;
|
|
1360
|
+
readonly config: VimcordToolsConfig;
|
|
1361
|
+
private message;
|
|
1362
|
+
constructor(options?: PromptOptions);
|
|
1363
|
+
private createDefaultForm;
|
|
1364
|
+
private createButtons;
|
|
1365
|
+
private createCustomButtons;
|
|
1366
|
+
private buildButton;
|
|
1367
|
+
private buildActionRow;
|
|
1368
|
+
private buildSendOptions;
|
|
1369
|
+
private isParticipant;
|
|
1370
|
+
private handleResolve;
|
|
1371
|
+
send(handler: SendHandler, options?: DynaSendOptions): Promise<Message | null>;
|
|
1372
|
+
awaitResponse(): Promise<PromptResult>;
|
|
1373
|
+
}
|
|
1374
|
+
/** Create and send a prompt, awaiting its response
|
|
1375
|
+
* @param handler - The send handler
|
|
1376
|
+
* @param options - Prompt options
|
|
1377
|
+
* @param sendOptions - Additional send options */
|
|
1378
|
+
declare function prompt(handler: SendHandler, options?: PromptOptions, sendOptions?: DynaSendOptions): Promise<PromptResult>;
|
|
1379
|
+
|
|
1380
|
+
type FetchedChannel<T> = T extends ChannelType.DM ? PartialGroupDMChannel | DMChannel | PartialDMChannel : T extends ChannelType.GuildText ? GuildBasedChannel & TextBasedChannel : T extends ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread ? AnyThreadChannel : T extends ChannelType.GuildVoice ? VoiceBasedChannel : T extends ChannelType.GuildCategory ? CategoryChannel : GuildBasedChannel;
|
|
1381
|
+
type FetchedMessageMention<T extends MentionType, InGuild extends boolean> = T extends "user" ? User : T extends "member" ? GuildMember : T extends "channel" ? InGuild extends true ? GuildBasedChannel : Channel : Role;
|
|
1382
|
+
type MentionType = "user" | "member" | "channel" | "role";
|
|
1383
|
+
interface GetMessageMentionOptions {
|
|
1384
|
+
cleanContent?: string;
|
|
1385
|
+
/** Return the ID instead of the object. */
|
|
1386
|
+
parse?: boolean;
|
|
1387
|
+
}
|
|
1388
|
+
/** Returns the string if it's populated, or "0" otherwise.
|
|
1389
|
+
*
|
|
1390
|
+
* Useful for fetching where the provided ID may or may not exist.
|
|
1391
|
+
* @param str The string to check. */
|
|
1392
|
+
declare function __zero(str?: string | null): string;
|
|
1393
|
+
/** Check if the given string is a mention or a snowflake.
|
|
1394
|
+
*
|
|
1395
|
+
* Looks for formats like `<@123456789>`, or a numeric string with at least 6 digits.
|
|
1396
|
+
* @param str The string to check. */
|
|
1397
|
+
declare function isMentionOrSnowflake(str: string | undefined): boolean;
|
|
1398
|
+
/** Remove mention syntax from a string.
|
|
1399
|
+
* @param str The string to clean. */
|
|
1400
|
+
declare function cleanMention(str: string | undefined): string | undefined;
|
|
1401
|
+
/** Get a mention or snowflake argument of a specified type from a message.
|
|
1402
|
+
* @param message - The message to parse.
|
|
1403
|
+
* @param content - The message's clean content to parse. Will be used if message.mentions isn't populated.
|
|
1404
|
+
* @param type - The type of mention.
|
|
1405
|
+
* @param index - The argument index in the content. Default is `0`
|
|
1406
|
+
* @param idOnly - Whether to return the ID instead of the fecthed object. */
|
|
1407
|
+
declare function getMessageMention<M extends Message, T extends MentionType>(message: M, content: string | undefined | null, type: T, index: number, idOnly: true): Promise<string | null>;
|
|
1408
|
+
declare function getMessageMention<M extends Message, T extends MentionType>(message: M, content: string | undefined | null, type: T, index?: number, idOnly?: false): Promise<FetchedMessageMention<T, M extends Message<true> ? true : false> | null>;
|
|
1409
|
+
/** Get the ID of the first mention of a specified type from a message or message content.
|
|
1410
|
+
* @param options Optional options that aren't really optional. */
|
|
1411
|
+
declare function getFirstMentionId(options: {
|
|
1412
|
+
message?: Message;
|
|
1413
|
+
content?: string;
|
|
1414
|
+
type: MentionType;
|
|
1415
|
+
}): string;
|
|
1416
|
+
/** Fetch a user from the client, checking the cache first.
|
|
1417
|
+
* @param client - The client to fetch the user from.
|
|
1418
|
+
* @param userId - The ID of the user to fetch. */
|
|
1419
|
+
declare function fetchUser(client: Client<true>, userId: string | undefined | null): Promise<User | null>;
|
|
1420
|
+
/** Fetch a guild from the client, checking the cache first.
|
|
1421
|
+
* @param client - The client to fetch the guild from.
|
|
1422
|
+
* @param guildId - The ID of the guild to fetch. */
|
|
1423
|
+
declare function fetchGuild(client: Client<true>, guildId: string | undefined | null): Promise<Guild | null>;
|
|
1424
|
+
/** Fetch a member from a guild, checking the cache first.
|
|
1425
|
+
* @param guild - The guild to fetch the member from.
|
|
1426
|
+
* @param memberId - The ID of the member to fetch. */
|
|
1427
|
+
declare function fetchMember(guild: Guild, memberId: string | undefined | null): Promise<GuildMember | null>;
|
|
1428
|
+
/** Fetch a channel from a guild, checking the cache first.
|
|
1429
|
+
*
|
|
1430
|
+
* ***NOTE:*** If the channel type does not match the provided type or the channel is null, null is returned.
|
|
1431
|
+
* @param guild - The guild to fetch the channel from.
|
|
1432
|
+
* @param channelId - The ID of the channel to fetch.
|
|
1433
|
+
* @param type - The type of channel to fetch. */
|
|
1434
|
+
declare function fetchChannel<T extends ChannelType>(guild: Guild, channelId: string | undefined | null, type?: T): Promise<FetchedChannel<T> | null>;
|
|
1435
|
+
/** Fetch a role from a guild, checking the cache first.
|
|
1436
|
+
* @param guild - The guild to fetch the role from.
|
|
1437
|
+
* @param roleId - The ID of the role to fetch. */
|
|
1438
|
+
declare function fetchRole(guild: Guild, roleId: string | undefined | null): Promise<Role | null>;
|
|
1439
|
+
/** Fetch a message from a channel, checking the cache first.
|
|
1440
|
+
* @param channel - The channel to fetch the message from.
|
|
1441
|
+
* @param messageId - The ID of the message to fetch. */
|
|
1442
|
+
declare function fetchMessage(channel: GuildTextBasedChannel | VoiceBasedChannel, messageId: string | undefined | null): Promise<Message | null>;
|
|
1443
|
+
|
|
1444
|
+
interface VimcordCLIOptions {
|
|
1445
|
+
prefix: string;
|
|
1446
|
+
}
|
|
1447
|
+
declare class VimcordCLI {
|
|
1448
|
+
rl: Interface;
|
|
1449
|
+
options: VimcordCLIOptions;
|
|
1450
|
+
commands: Map<string, {
|
|
1451
|
+
description: string;
|
|
1452
|
+
fn: (args: string[], content: string) => void;
|
|
1453
|
+
}>;
|
|
1454
|
+
logger: Logger;
|
|
1455
|
+
constructor(options: VimcordCLIOptions);
|
|
1456
|
+
private parseLine;
|
|
1457
|
+
getClientInstance(line: string): Vimcord<boolean> | undefined;
|
|
1458
|
+
addCommand(commandName: string, description: string, fn: (args: string[], content: string) => void): void;
|
|
1459
|
+
removeCommand(commandName: string): boolean;
|
|
1460
|
+
}
|
|
1461
|
+
declare const CLI: VimcordCLI;
|
|
1462
|
+
/** One-time function to be called during client creation */
|
|
1463
|
+
declare function initCLI(): void;
|
|
1464
|
+
|
|
1465
|
+
declare function retryExponentialBackoff<T>(fn: (attempt: number) => Promise<T>, maxRetries?: number, retryDelay?: number): Promise<T>;
|
|
1466
|
+
|
|
1467
|
+
type VimcordConfigOptions = PartialDeep<VimcordConfig>;
|
|
1468
|
+
declare function useClient(index?: number): Vimcord<boolean> | undefined;
|
|
1469
|
+
declare function useReadyClient(index?: number): Promise<Vimcord<true> | undefined>;
|
|
1470
|
+
/** Automatically bundles **🚀 {@link VimcordCLI}** with client creation */
|
|
1471
|
+
declare function createClient(options: ClientOptions, features?: VimcordFeatures, config?: VimcordConfigOptions): Vimcord<boolean>;
|
|
1472
|
+
declare function getClientInstances(): Vimcord<boolean>[];
|
|
1473
|
+
|
|
1474
|
+
declare function getProcessDir(): string;
|
|
1475
|
+
declare function importModulesFromDir<T extends any>(dir: string, fnPrefix?: string): Promise<{
|
|
1476
|
+
module: T;
|
|
1477
|
+
path: string;
|
|
1478
|
+
}[]>;
|
|
1479
|
+
declare function getCallerFileName(): string | undefined;
|
|
1480
|
+
|
|
1481
|
+
declare function formatThousands(num: number, sep?: string): string;
|
|
1482
|
+
|
|
1483
|
+
declare function pickRandom<T extends any[]>(arr: T, options?: {
|
|
1484
|
+
notEqualTo?: any;
|
|
1485
|
+
maxRerollAttempts?: number;
|
|
1486
|
+
clone?: boolean;
|
|
1487
|
+
}): T[number];
|
|
1488
|
+
|
|
1489
|
+
declare function sendCommandErrorEmbed(client: Vimcord, error: Error, guild: Guild | null | undefined, messageOrInteraction: Message | CommandInteraction): Promise<Message<boolean> | null>;
|
|
1490
|
+
|
|
1491
|
+
declare function validateCommandPermissions(permissions: CommandPermissions, client: Vimcord<true>, user: GuildMember | User, command: CommandInteraction | string): CommandPermissionResults;
|
|
1492
|
+
|
|
1493
|
+
export { type AnySlashCommandBuilder, type AppCommandDeployment, type BaseAppCommandConfig, BaseCommandBuilder, type BaseCommandConfig, type BaseCommandFunctionConfig, type BaseCommandOptions, type BaseCommandParameters, type BetterChannelSelectComponent, 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, type CommandErrorMessageConfig, type CommandInternalRateLimitData, type CommandMetadata, type CommandPermissionResults, type CommandPermissions, type CommandRateLimitOptions, CommandType, ContextCommandBuilder, 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, type LeanOrHydratedDocument, 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, Prompt, type PromptOptions, PromptResolveType, type PromptResult, RateLimitScope, type RequiredDynaSendOptions, type SendHandler, SendMethod, type SendableComponent, type SendableTextChannel, type SinglePageResolvable, SlashCommandBuilder, 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, 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, validateCommandPermissions };
|