commandkit 0.1.11-dev.20250314022547 → 0.1.11-dev.20250328083250
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.d.ts +173 -166
- package/dist/index.js +1087 -1192
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { RESTPostAPIApplicationCommandsJSONBody, Client, Interaction, CacheType, PermissionsString, ChatInputCommandInteraction, ContextMenuCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, ClientEvents, Awaitable, ButtonBuilder, ButtonInteraction, Events, ModalBuilder, ModalSubmitInteraction, ActionRowBuilder, TextInputBuilder, ButtonStyle, ComponentEmojiResolvable, TextInputStyle, LocalizationMap, Locale, Message as Message$1, ApplicationCommandOptionType, GuildMember, Attachment, User, Role, CommandInteractionOption,
|
|
2
|
+
import { RESTPostAPIApplicationCommandsJSONBody, Client, Interaction, CacheType, PermissionsString, ChatInputCommandInteraction, ContextMenuCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, ClientEvents, Awaitable, ButtonBuilder, ButtonInteraction, Events, ModalBuilder, ModalSubmitInteraction, ActionRowBuilder, TextInputBuilder, ButtonStyle, ComponentEmojiResolvable, TextInputStyle, LocalizationMap, Locale, Message as Message$1, ApplicationCommandOptionType, GuildMember, Attachment, User, Role, CommandInteractionOption, SlashCommandBuilder, ContextMenuCommandBuilder, PartialMessage } from 'discord.js';
|
|
3
3
|
import EventEmitter from 'node:events';
|
|
4
4
|
import { Channel } from 'diagnostics_channel';
|
|
5
5
|
import * as commander from 'commander';
|
|
@@ -582,11 +582,15 @@ interface ApiTranslatableCommandOptions extends TranslatableCommandOptions {
|
|
|
582
582
|
name_localizations?: LocalizationMap;
|
|
583
583
|
description_localizations?: LocalizationMap;
|
|
584
584
|
}
|
|
585
|
+
interface CommandLocalizationTypeData {
|
|
586
|
+
[key: string]: Record<string, string | null>;
|
|
587
|
+
}
|
|
588
|
+
type TranslatableCommandName = string & {};
|
|
585
589
|
interface Translation {
|
|
586
590
|
command: TranslatableCommand;
|
|
587
|
-
translations:
|
|
591
|
+
translations: Record<string, string>;
|
|
588
592
|
}
|
|
589
|
-
type TranslatableArguments = Record<string, string>;
|
|
593
|
+
type TranslatableArguments<T extends TranslatableCommandName> = T extends TranslatableCommandName ? CommandLocalizationTypeData[T] extends Record<string, infer ArgType> ? ArgType extends null ? never : Record<string, string> : Record<string, string> : Record<string, string>;
|
|
590
594
|
|
|
591
595
|
interface LocalizationTranslationRequest {
|
|
592
596
|
locale: Locale;
|
|
@@ -612,15 +616,15 @@ interface LocalizationConfig {
|
|
|
612
616
|
*/
|
|
613
617
|
target: string;
|
|
614
618
|
}
|
|
615
|
-
type Translator = (
|
|
616
|
-
declare class Localization {
|
|
619
|
+
type Translator<T extends TranslatableCommandName> = <K extends keyof CommandLocalizationTypeData[T] & string>(key: K, args?: CommandLocalizationTypeData[T][K] extends null ? never : CommandLocalizationTypeData[T][K] extends string ? Record<CommandLocalizationTypeData[T][K], string> : Record<string, string>) => Promise<TranslationResult>;
|
|
620
|
+
declare class Localization<T extends TranslatableCommandName = string> {
|
|
617
621
|
private readonly commandkit;
|
|
618
622
|
private readonly config;
|
|
619
623
|
/**
|
|
620
624
|
* Translates the given translatable object.
|
|
621
625
|
* @param translatable The translatable object to translate.
|
|
622
626
|
*/
|
|
623
|
-
readonly t: Translator
|
|
627
|
+
readonly t: Translator<T>;
|
|
624
628
|
/**
|
|
625
629
|
* Creates a new localization instance.
|
|
626
630
|
* @param commandkit The command kit instance.
|
|
@@ -917,7 +921,7 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
|
|
|
917
921
|
* Forwards the context to another command. The target handler will be the same as current handler.
|
|
918
922
|
* @param command The command to forward to.
|
|
919
923
|
*/
|
|
920
|
-
forwardCommand(command:
|
|
924
|
+
forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
|
|
921
925
|
/**
|
|
922
926
|
* The execution mode of the command.
|
|
923
927
|
*/
|
|
@@ -972,8 +976,9 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
|
|
|
972
976
|
/**
|
|
973
977
|
* Returns the i18n api for this command.
|
|
974
978
|
* @param locale The locale to use for the i18n api.
|
|
979
|
+
* @template T The command name for type-safe translations. Will provide autocomplete from available translations.
|
|
975
980
|
*/
|
|
976
|
-
locale(locale?: Locale): Localization
|
|
981
|
+
locale<T extends TranslatableCommandName | (string & {}) = string>(locale?: Locale): Localization<T extends TranslatableCommandName ? T : string>;
|
|
977
982
|
/**
|
|
978
983
|
* Creates a clone of this context
|
|
979
984
|
*/
|
|
@@ -1026,141 +1031,6 @@ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutio
|
|
|
1026
1031
|
setCommandRunner(fn: RunCommand): void;
|
|
1027
1032
|
}
|
|
1028
1033
|
|
|
1029
|
-
interface ParsedCommand {
|
|
1030
|
-
id: string;
|
|
1031
|
-
name: string;
|
|
1032
|
-
path: string;
|
|
1033
|
-
relativePath: string;
|
|
1034
|
-
category: string | null;
|
|
1035
|
-
subcommands: ParsedSubCommand[];
|
|
1036
|
-
middlewareIds: string[];
|
|
1037
|
-
}
|
|
1038
|
-
interface ParsedMiddleware {
|
|
1039
|
-
id: string;
|
|
1040
|
-
path: string;
|
|
1041
|
-
relativePath: string;
|
|
1042
|
-
}
|
|
1043
|
-
interface ParsedSubCommand {
|
|
1044
|
-
name: string;
|
|
1045
|
-
group: string | null;
|
|
1046
|
-
path: string;
|
|
1047
|
-
relativePath: string;
|
|
1048
|
-
command: string;
|
|
1049
|
-
}
|
|
1050
|
-
interface CommandsRouterOptions {
|
|
1051
|
-
entrypoint: string;
|
|
1052
|
-
}
|
|
1053
|
-
interface CommandsRouterData {
|
|
1054
|
-
commands: Collection<string, ParsedCommand>;
|
|
1055
|
-
middlewares: Collection<string, ParsedMiddleware>;
|
|
1056
|
-
}
|
|
1057
|
-
interface CommandsRouterRawData {
|
|
1058
|
-
commands: Record<string, ParsedCommand>;
|
|
1059
|
-
middlewares: Record<string, ParsedMiddleware>;
|
|
1060
|
-
}
|
|
1061
|
-
declare class CommandsRouter {
|
|
1062
|
-
private readonly options;
|
|
1063
|
-
private commands;
|
|
1064
|
-
private middlewares;
|
|
1065
|
-
constructor(options: CommandsRouterOptions);
|
|
1066
|
-
fromData(data: CommandsRouterRawData): void;
|
|
1067
|
-
isValidPath(): boolean;
|
|
1068
|
-
getData(): CommandsRouterData;
|
|
1069
|
-
toJSON(): CommandsRouterRawData;
|
|
1070
|
-
clear(): void;
|
|
1071
|
-
reload(): Promise<CommandsRouterRawData>;
|
|
1072
|
-
scan(): Promise<CommandsRouterRawData>;
|
|
1073
|
-
private traverse;
|
|
1074
|
-
private applyBindings;
|
|
1075
|
-
private distanceFromRoot;
|
|
1076
|
-
private parseGroup;
|
|
1077
|
-
private parseCategory;
|
|
1078
|
-
private parseFileName;
|
|
1079
|
-
private toRelativePath;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Configuration options for the EventsRouter
|
|
1084
|
-
* @interface EventsRouterOptions
|
|
1085
|
-
*/
|
|
1086
|
-
interface EventsRouterOptions {
|
|
1087
|
-
/** Root directory path where event handlers are located */
|
|
1088
|
-
entrypoint: string;
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Represents a parsed event with its handlers
|
|
1092
|
-
* @interface ParsedEvent
|
|
1093
|
-
*/
|
|
1094
|
-
interface ParsedEvent {
|
|
1095
|
-
/** Name of the event derived from directory name */
|
|
1096
|
-
event: string;
|
|
1097
|
-
/** Absolute path to the event directory */
|
|
1098
|
-
path: string;
|
|
1099
|
-
/** Array of file paths to event listener handlers */
|
|
1100
|
-
listeners: string[];
|
|
1101
|
-
/** Namespace of the event */
|
|
1102
|
-
namespace: string | null;
|
|
1103
|
-
}
|
|
1104
|
-
/** Map of event names to their parsed metadata */
|
|
1105
|
-
type EventsTree = Record<string, ParsedEvent>;
|
|
1106
|
-
/**
|
|
1107
|
-
* Router for discovering and managing event handler files in a directory structure.
|
|
1108
|
-
* Events are represented by directories, and handlers are files within those directories.
|
|
1109
|
-
*/
|
|
1110
|
-
declare class EventsRouter {
|
|
1111
|
-
private options;
|
|
1112
|
-
/** Internal storage of parsed events */
|
|
1113
|
-
private events;
|
|
1114
|
-
/**
|
|
1115
|
-
* Creates a new EventsRouter instance
|
|
1116
|
-
* @param options - Configuration options for the router
|
|
1117
|
-
* @throws Error if entrypoint is not provided
|
|
1118
|
-
*/
|
|
1119
|
-
constructor(options: EventsRouterOptions);
|
|
1120
|
-
/**
|
|
1121
|
-
* Find a parsed event by its name
|
|
1122
|
-
* @param event - Name of the event to find
|
|
1123
|
-
* @returns Parsed event metadata or null if not found
|
|
1124
|
-
*/
|
|
1125
|
-
match(event: string): ParsedEvent | null;
|
|
1126
|
-
/**
|
|
1127
|
-
* Get the entrypoint directory path
|
|
1128
|
-
* @returns Entrypoint directory path
|
|
1129
|
-
*/
|
|
1130
|
-
get entrypoint(): string;
|
|
1131
|
-
/**
|
|
1132
|
-
* Checks if the entrypoint path is valid
|
|
1133
|
-
*/
|
|
1134
|
-
isValidPath(): boolean;
|
|
1135
|
-
/**
|
|
1136
|
-
* Clear all parsed events
|
|
1137
|
-
*/
|
|
1138
|
-
clear(): void;
|
|
1139
|
-
/**
|
|
1140
|
-
* Reload and re-scan the entrypoint directory for events
|
|
1141
|
-
* @returns Promise resolving to the updated events tree
|
|
1142
|
-
*/
|
|
1143
|
-
reload(): Promise<EventsTree>;
|
|
1144
|
-
/**
|
|
1145
|
-
* Scan the entrypoint directory for events and their handlers
|
|
1146
|
-
* @returns Promise resolving to the events tree
|
|
1147
|
-
*/
|
|
1148
|
-
scan(): Promise<EventsTree>;
|
|
1149
|
-
/**
|
|
1150
|
-
* Convert the internal events map to a plain object
|
|
1151
|
-
* @returns Events tree as a plain object
|
|
1152
|
-
*/
|
|
1153
|
-
toJSON(): EventsTree;
|
|
1154
|
-
/**
|
|
1155
|
-
* Recursively scan a directory for event handlers
|
|
1156
|
-
* @param event - Name of the event
|
|
1157
|
-
* @param path - Path to the event directory
|
|
1158
|
-
* @param listeners - Array to collect listener file paths
|
|
1159
|
-
* @returns Promise resolving to the parsed event metadata
|
|
1160
|
-
*/
|
|
1161
|
-
private scanEvent;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
1034
|
declare class CommandRegistrar {
|
|
1165
1035
|
readonly commandkit: CommandKit;
|
|
1166
1036
|
private api;
|
|
@@ -1173,10 +1043,6 @@ declare class CommandRegistrar {
|
|
|
1173
1043
|
* Gets the commands data.
|
|
1174
1044
|
*/
|
|
1175
1045
|
getCommandsData(): CommandData[];
|
|
1176
|
-
/**
|
|
1177
|
-
* Process and merge subcommands into the parent command's options
|
|
1178
|
-
*/
|
|
1179
|
-
private processSubcommands;
|
|
1180
1046
|
/**
|
|
1181
1047
|
* Registers loaded commands.
|
|
1182
1048
|
*/
|
|
@@ -1319,6 +1185,156 @@ declare function revalidate<T = unknown>(tag: string, ...args: any[]): Promise<T
|
|
|
1319
1185
|
*/
|
|
1320
1186
|
declare function isCachedFunction(fn: GenericFunction): boolean;
|
|
1321
1187
|
|
|
1188
|
+
interface Command {
|
|
1189
|
+
id: string;
|
|
1190
|
+
name: string;
|
|
1191
|
+
path: string;
|
|
1192
|
+
relativePath: string;
|
|
1193
|
+
parentPath: string;
|
|
1194
|
+
middlewares: Array<string>;
|
|
1195
|
+
category: string | null;
|
|
1196
|
+
}
|
|
1197
|
+
interface Middleware {
|
|
1198
|
+
id: string;
|
|
1199
|
+
name: string;
|
|
1200
|
+
path: string;
|
|
1201
|
+
relativePath: string;
|
|
1202
|
+
parentPath: string;
|
|
1203
|
+
}
|
|
1204
|
+
interface ParsedCommandData {
|
|
1205
|
+
commands: Record<string, Command>;
|
|
1206
|
+
middlewares: Record<string, Middleware>;
|
|
1207
|
+
}
|
|
1208
|
+
interface CommandsRouterOptions {
|
|
1209
|
+
entrypoint: string;
|
|
1210
|
+
}
|
|
1211
|
+
declare class CommandsRouter {
|
|
1212
|
+
private readonly options;
|
|
1213
|
+
private commands;
|
|
1214
|
+
private middlewares;
|
|
1215
|
+
constructor(options: CommandsRouterOptions);
|
|
1216
|
+
populate(data: ParsedCommandData): void;
|
|
1217
|
+
isValidPath(): boolean;
|
|
1218
|
+
private isCommand;
|
|
1219
|
+
private isMiddleware;
|
|
1220
|
+
private isCategory;
|
|
1221
|
+
clear(): void;
|
|
1222
|
+
scan(): Promise<{
|
|
1223
|
+
commands: {
|
|
1224
|
+
[k: string]: Command;
|
|
1225
|
+
};
|
|
1226
|
+
middlewares: {
|
|
1227
|
+
[k: string]: Middleware;
|
|
1228
|
+
};
|
|
1229
|
+
}>;
|
|
1230
|
+
getData(): {
|
|
1231
|
+
commands: Map<string, Command>;
|
|
1232
|
+
middlewares: Map<string, Middleware>;
|
|
1233
|
+
};
|
|
1234
|
+
toJSON(): {
|
|
1235
|
+
commands: {
|
|
1236
|
+
[k: string]: Command;
|
|
1237
|
+
};
|
|
1238
|
+
middlewares: {
|
|
1239
|
+
[k: string]: Middleware;
|
|
1240
|
+
};
|
|
1241
|
+
};
|
|
1242
|
+
private traverse;
|
|
1243
|
+
private handle;
|
|
1244
|
+
private applyMiddlewares;
|
|
1245
|
+
private replaceEntrypoint;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Configuration options for the EventsRouter
|
|
1250
|
+
* @interface EventsRouterOptions
|
|
1251
|
+
*/
|
|
1252
|
+
interface EventsRouterOptions {
|
|
1253
|
+
/** Root directory path where event handlers are located */
|
|
1254
|
+
entrypoint: string;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Represents a parsed event with its handlers
|
|
1258
|
+
* @interface ParsedEvent
|
|
1259
|
+
*/
|
|
1260
|
+
interface ParsedEvent {
|
|
1261
|
+
/** Name of the event derived from directory name */
|
|
1262
|
+
event: string;
|
|
1263
|
+
/** Absolute path to the event directory */
|
|
1264
|
+
path: string;
|
|
1265
|
+
/** Array of file paths to event listener handlers */
|
|
1266
|
+
listeners: string[];
|
|
1267
|
+
/** Namespace of the event */
|
|
1268
|
+
namespace: string | null;
|
|
1269
|
+
}
|
|
1270
|
+
/** Map of event names to their parsed metadata */
|
|
1271
|
+
type EventsTree = Record<string, ParsedEvent>;
|
|
1272
|
+
/**
|
|
1273
|
+
* Router for discovering and managing event handler files in a directory structure.
|
|
1274
|
+
* Events are represented by directories, and handlers are files within those directories.
|
|
1275
|
+
*/
|
|
1276
|
+
declare class EventsRouter {
|
|
1277
|
+
private options;
|
|
1278
|
+
/** Internal storage of parsed events */
|
|
1279
|
+
private events;
|
|
1280
|
+
/**
|
|
1281
|
+
* Creates a new EventsRouter instance
|
|
1282
|
+
* @param options - Configuration options for the router
|
|
1283
|
+
* @throws Error if entrypoint is not provided
|
|
1284
|
+
*/
|
|
1285
|
+
constructor(options: EventsRouterOptions);
|
|
1286
|
+
/**
|
|
1287
|
+
* Find a parsed event by its name
|
|
1288
|
+
* @param event - Name of the event to find
|
|
1289
|
+
* @returns Parsed event metadata or null if not found
|
|
1290
|
+
*/
|
|
1291
|
+
match(event: string): ParsedEvent | null;
|
|
1292
|
+
/**
|
|
1293
|
+
* Get the entrypoint directory path
|
|
1294
|
+
* @returns Entrypoint directory path
|
|
1295
|
+
*/
|
|
1296
|
+
get entrypoint(): string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Checks if the entrypoint path is valid
|
|
1299
|
+
*/
|
|
1300
|
+
isValidPath(): boolean;
|
|
1301
|
+
/**
|
|
1302
|
+
* Clear all parsed events
|
|
1303
|
+
*/
|
|
1304
|
+
clear(): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Reload and re-scan the entrypoint directory for events
|
|
1307
|
+
* @returns Promise resolving to the updated events tree
|
|
1308
|
+
*/
|
|
1309
|
+
reload(): Promise<EventsTree>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Scan the entrypoint directory for events and their handlers
|
|
1312
|
+
* @returns Promise resolving to the events tree
|
|
1313
|
+
*/
|
|
1314
|
+
scan(): Promise<EventsTree>;
|
|
1315
|
+
/**
|
|
1316
|
+
* Convert the internal events map to a plain object
|
|
1317
|
+
* @returns Events tree as a plain object
|
|
1318
|
+
*/
|
|
1319
|
+
toJSON(): EventsTree;
|
|
1320
|
+
/**
|
|
1321
|
+
* Recursively scan a directory for event handlers
|
|
1322
|
+
* @param event - Name of the event
|
|
1323
|
+
* @param path - Path to the event directory
|
|
1324
|
+
* @param listeners - Array to collect listener file paths
|
|
1325
|
+
* @returns Promise resolving to the parsed event metadata
|
|
1326
|
+
*/
|
|
1327
|
+
private scanEvent;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
declare class AppCommandRunner {
|
|
1331
|
+
#private;
|
|
1332
|
+
private handler;
|
|
1333
|
+
constructor(handler: AppCommandHandler);
|
|
1334
|
+
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message$1): Promise<void>;
|
|
1335
|
+
getExecutionMode(source: Interaction | Message$1): CommandExecutionMode;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1322
1338
|
type RunCommand = <T extends AsyncFunction>(fn: T) => T;
|
|
1323
1339
|
interface AppCommand {
|
|
1324
1340
|
command: SlashCommandBuilder | Record<string, any>;
|
|
@@ -1333,31 +1349,25 @@ interface AppCommandMiddleware {
|
|
|
1333
1349
|
afterExecute: (ctx: Context) => Awaitable<unknown>;
|
|
1334
1350
|
}
|
|
1335
1351
|
interface LoadedCommand {
|
|
1336
|
-
command:
|
|
1352
|
+
command: Command;
|
|
1337
1353
|
data: AppCommand;
|
|
1338
|
-
subcommands?: ParsedSubCommand[];
|
|
1339
1354
|
guilds?: string[];
|
|
1340
1355
|
}
|
|
1356
|
+
type CommandTypeData = string;
|
|
1357
|
+
type ResolvableCommand = CommandTypeData | (string & {});
|
|
1341
1358
|
interface LoadedMiddleware {
|
|
1342
|
-
middleware:
|
|
1359
|
+
middleware: Middleware;
|
|
1343
1360
|
data: AppCommandMiddleware;
|
|
1344
1361
|
}
|
|
1345
1362
|
interface PreparedAppCommandExecution {
|
|
1346
1363
|
command: LoadedCommand;
|
|
1347
|
-
subcommand?: LoadedSubCommand | null;
|
|
1348
1364
|
middlewares: LoadedMiddleware[];
|
|
1349
1365
|
messageCommandParser?: MessageCommandParser;
|
|
1350
1366
|
}
|
|
1351
|
-
interface LoadedSubCommand {
|
|
1352
|
-
subcommand: ParsedSubCommand;
|
|
1353
|
-
data: AppCommand;
|
|
1354
|
-
}
|
|
1355
1367
|
type CommandBuilderLike = SlashCommandBuilder | ContextMenuCommandBuilder | Record<string, any>;
|
|
1356
1368
|
declare class AppCommandHandler {
|
|
1357
|
-
#private;
|
|
1358
1369
|
readonly commandkit: CommandKit;
|
|
1359
1370
|
private loadedCommands;
|
|
1360
|
-
private loadedSubCommands;
|
|
1361
1371
|
private loadedMiddlewares;
|
|
1362
1372
|
private commandNameToId;
|
|
1363
1373
|
private subcommandPathToId;
|
|
@@ -1365,22 +1375,16 @@ declare class AppCommandHandler {
|
|
|
1365
1375
|
private onInteraction;
|
|
1366
1376
|
private onMessageCreate;
|
|
1367
1377
|
private onMessageUpdate;
|
|
1378
|
+
readonly commandRunner: AppCommandRunner;
|
|
1368
1379
|
constructor(commandkit: CommandKit);
|
|
1369
1380
|
getCommandsArray(): LoadedCommand[];
|
|
1370
|
-
/**
|
|
1371
|
-
* Get subcommand data by command ID and subcommand name
|
|
1372
|
-
*/
|
|
1373
|
-
getSubcommandData(commandId: string, subcommandName: string): any;
|
|
1374
1381
|
registerCommandHandler(): void;
|
|
1375
|
-
getExecutionMode(source: Interaction | Message$1): CommandExecutionMode;
|
|
1376
|
-
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message$1): Promise<void>;
|
|
1377
1382
|
prepareCommandRun(source: Interaction | Message$1): Promise<PreparedAppCommandExecution | null>;
|
|
1378
1383
|
reloadCommands(): Promise<void>;
|
|
1379
1384
|
loadCommands(): Promise<void>;
|
|
1380
1385
|
private loadMiddleware;
|
|
1381
1386
|
private loadCommand;
|
|
1382
|
-
|
|
1383
|
-
applyLocalizations(command: CommandBuilderLike, subcommand?: ParsedSubCommand): Promise<CommandBuilderLike>;
|
|
1387
|
+
applyLocalizations(command: CommandBuilderLike): Promise<CommandBuilderLike>;
|
|
1384
1388
|
}
|
|
1385
1389
|
|
|
1386
1390
|
type ListenerFunction = GenericFunction | AsyncFunction;
|
|
@@ -1524,6 +1528,7 @@ declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> e
|
|
|
1524
1528
|
*/
|
|
1525
1529
|
onBuildEnd(): Promise<void>;
|
|
1526
1530
|
}
|
|
1531
|
+
declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
|
|
1527
1532
|
|
|
1528
1533
|
declare class CompilerPluginRuntime {
|
|
1529
1534
|
private readonly plugins;
|
|
@@ -1543,6 +1548,7 @@ declare class CompilerPluginRuntime {
|
|
|
1543
1548
|
setup: (build: Setup) => Promise<void>;
|
|
1544
1549
|
};
|
|
1545
1550
|
}
|
|
1551
|
+
declare function fromEsbuildPlugin(plugin: any): typeof CompilerPlugin;
|
|
1546
1552
|
|
|
1547
1553
|
type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
|
|
1548
1554
|
|
|
@@ -1643,6 +1649,7 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
|
|
|
1643
1649
|
*/
|
|
1644
1650
|
executeCommand(ctx: CommandKitPluginRuntime, source: Interaction | Message$1, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
|
|
1645
1651
|
}
|
|
1652
|
+
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
1646
1653
|
|
|
1647
1654
|
declare class CommandKitPluginRuntime extends EventTarget {
|
|
1648
1655
|
readonly commandkit: CommandKit;
|
|
@@ -1927,4 +1934,4 @@ declare const version: string;
|
|
|
1927
1934
|
*/
|
|
1928
1935
|
declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
|
|
1929
1936
|
|
|
1930
|
-
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, type ApiTranslatableCommandOptions, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type
|
|
1937
|
+
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, type ApiTranslatableCommandOptions, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, type Command, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandLocalizationTypeData, type CommandObject, type CommandOptions, type CommandProps, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, Localization, type LocalizationConfig, type LocalizationStrategy, type LocalizationTranslationRequest, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, type ResolvableCommand, type ResolveKind, type ResolveResult, type RunCommand, RuntimePlugin, type Setup, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TransformedResult, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandName, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, type UserContextMenuCommandProps, type ValidationProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, commandkit, createElement, createLogger, CommandKit as default, defineConfig, dmOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isRuntimePlugin, makeContextAwareFunction, redirect, rethrow, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };
|