vimcord 1.0.21 → 1.0.23

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.mts CHANGED
@@ -35,6 +35,10 @@ interface CommandPermissions {
35
35
  interface CommandMetadata {
36
36
  /** Command category for categorizing commands */
37
37
  category?: string;
38
+ /** Command category emoji
39
+ * @remarks I recommend mapping your own category emojis separately instead of using this
40
+ */
41
+ categoryEmoji?: string;
38
42
  /** Command tags for categorizing commands */
39
43
  tags?: string[];
40
44
  /** Command usage examples */
@@ -304,7 +308,8 @@ interface PrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
304
308
  description?: string;
305
309
  }
306
310
  declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
307
- constructor(config: PrefixCommandConfig);
311
+ options: PrefixCommandConfig;
312
+ constructor(options: PrefixCommandConfig);
308
313
  /**
309
314
  * Specialized execution logic for Prefix Commands.
310
315
  */
@@ -350,7 +355,7 @@ interface SlashCommandConfig extends BaseCommandConfig<CommandType.Slash>, BaseA
350
355
  }
351
356
  declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash, SlashCommandConfig> {
352
357
  builder: AnySlashCommandBuilder;
353
- private readonly routes;
358
+ readonly routes: Map<string, (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any>;
354
359
  constructor(config: SlashCommandConfig);
355
360
  private handleExecution;
356
361
  private validateBuilder;
@@ -377,14 +382,22 @@ declare abstract class VimcordAppCommandManager<T extends CommandType.Slash | Co
377
382
  constructor(client: Vimcord, typeName: string);
378
383
  get(name: string): VimcordCommandBuilderByType<T> | undefined;
379
384
  /**
380
- * Filters and returns commands based on deployment options
385
+ * Filters and returns commands based on deployment options alphabetically
381
386
  */
382
387
  getAll(options?: {
383
388
  names?: string[];
384
389
  fuzzyNames?: string[];
385
390
  globalOnly?: boolean;
386
391
  ignoreDeploymentOptions?: boolean;
387
- }): Map<string, VimcordCommandBuilderByType<T>>;
392
+ }): VimcordCommandBuilderByType<T>[];
393
+ /**
394
+ * Groups commands by category alphabetically
395
+ */
396
+ sortByCategory(): {
397
+ name: string;
398
+ emoji: string | undefined;
399
+ commands: VimcordCommandBuilderByType<T>[];
400
+ }[];
388
401
  registerGlobal(options?: {
389
402
  commands?: string[];
390
403
  fuzzyCommands?: string[];
@@ -412,6 +425,14 @@ declare class VimcordPrefixCommandManager {
412
425
  commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
413
426
  constructor(client: Vimcord);
414
427
  resolve(trigger: string): PrefixCommandBuilder | undefined;
428
+ /**
429
+ * Groups commands by category alphabetically
430
+ */
431
+ sortByCategory(): {
432
+ name: string;
433
+ emoji: string | undefined;
434
+ commands: VimcordCommandBuilderByType<CommandType.Prefix>[];
435
+ }[];
415
436
  importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
416
437
  }
417
438
  declare class VimcordCommandManager {
@@ -1019,7 +1040,7 @@ declare abstract class BaseCommandBuilder<T extends CommandType, O extends BaseC
1019
1040
  readonly uuid: string;
1020
1041
  readonly commandType: T;
1021
1042
  /** Local command configuration and hooks */
1022
- protected options: O;
1043
+ readonly options: O;
1023
1044
  /** Internal state for rate limiting across different scopes */
1024
1045
  private readonly rlStores;
1025
1046
  /** * Mapping of CommandTypes to their respective config keys in the Vimcord client
package/dist/index.d.ts CHANGED
@@ -35,6 +35,10 @@ interface CommandPermissions {
35
35
  interface CommandMetadata {
36
36
  /** Command category for categorizing commands */
37
37
  category?: string;
38
+ /** Command category emoji
39
+ * @remarks I recommend mapping your own category emojis separately instead of using this
40
+ */
41
+ categoryEmoji?: string;
38
42
  /** Command tags for categorizing commands */
39
43
  tags?: string[];
40
44
  /** Command usage examples */
@@ -304,7 +308,8 @@ interface PrefixCommandConfig extends BaseCommandConfig<CommandType.Prefix> {
304
308
  description?: string;
305
309
  }
306
310
  declare class PrefixCommandBuilder extends BaseCommandBuilder<CommandType.Prefix, PrefixCommandConfig> {
307
- constructor(config: PrefixCommandConfig);
311
+ options: PrefixCommandConfig;
312
+ constructor(options: PrefixCommandConfig);
308
313
  /**
309
314
  * Specialized execution logic for Prefix Commands.
310
315
  */
@@ -350,7 +355,7 @@ interface SlashCommandConfig extends BaseCommandConfig<CommandType.Slash>, BaseA
350
355
  }
351
356
  declare class SlashCommandBuilder extends BaseCommandBuilder<CommandType.Slash, SlashCommandConfig> {
352
357
  builder: AnySlashCommandBuilder;
353
- private readonly routes;
358
+ readonly routes: Map<string, (client: Vimcord<true>, interaction: ChatInputCommandInteraction) => any>;
354
359
  constructor(config: SlashCommandConfig);
355
360
  private handleExecution;
356
361
  private validateBuilder;
@@ -377,14 +382,22 @@ declare abstract class VimcordAppCommandManager<T extends CommandType.Slash | Co
377
382
  constructor(client: Vimcord, typeName: string);
378
383
  get(name: string): VimcordCommandBuilderByType<T> | undefined;
379
384
  /**
380
- * Filters and returns commands based on deployment options
385
+ * Filters and returns commands based on deployment options alphabetically
381
386
  */
382
387
  getAll(options?: {
383
388
  names?: string[];
384
389
  fuzzyNames?: string[];
385
390
  globalOnly?: boolean;
386
391
  ignoreDeploymentOptions?: boolean;
387
- }): Map<string, VimcordCommandBuilderByType<T>>;
392
+ }): VimcordCommandBuilderByType<T>[];
393
+ /**
394
+ * Groups commands by category alphabetically
395
+ */
396
+ sortByCategory(): {
397
+ name: string;
398
+ emoji: string | undefined;
399
+ commands: VimcordCommandBuilderByType<T>[];
400
+ }[];
388
401
  registerGlobal(options?: {
389
402
  commands?: string[];
390
403
  fuzzyCommands?: string[];
@@ -412,6 +425,14 @@ declare class VimcordPrefixCommandManager {
412
425
  commands: Map<string, VimcordCommandBuilderByType<CommandType.Prefix>>;
413
426
  constructor(client: Vimcord);
414
427
  resolve(trigger: string): PrefixCommandBuilder | undefined;
428
+ /**
429
+ * Groups commands by category alphabetically
430
+ */
431
+ sortByCategory(): {
432
+ name: string;
433
+ emoji: string | undefined;
434
+ commands: VimcordCommandBuilderByType<CommandType.Prefix>[];
435
+ }[];
415
436
  importFrom(dir: string | string[], replaceAll?: boolean): Promise<Map<string, PrefixCommandBuilder>>;
416
437
  }
417
438
  declare class VimcordCommandManager {
@@ -1019,7 +1040,7 @@ declare abstract class BaseCommandBuilder<T extends CommandType, O extends BaseC
1019
1040
  readonly uuid: string;
1020
1041
  readonly commandType: T;
1021
1042
  /** Local command configuration and hooks */
1022
- protected options: O;
1043
+ readonly options: O;
1023
1044
  /** Internal state for rate limiting across different scopes */
1024
1045
  private readonly rlStores;
1025
1046
  /** * Mapping of CommandTypes to their respective config keys in the Vimcord client
package/dist/index.js CHANGED
@@ -663,8 +663,9 @@ var EventBuilder = class _EventBuilder {
663
663
 
664
664
  // src/builders/prefixCommand.builder.ts
665
665
  var PrefixCommandBuilder = class extends BaseCommandBuilder {
666
- constructor(config) {
667
- super(1 /* Prefix */, config);
666
+ constructor(options) {
667
+ super(1 /* Prefix */, options);
668
+ this.options = options;
668
669
  const originalExecute = this.options.execute;
669
670
  this.options.execute = async (client, message) => {
670
671
  return await this.handleExecution(client, message, originalExecute);
@@ -1374,7 +1375,7 @@ var VimcordAppCommandManager = class {
1374
1375
  return this.commands.get(name);
1375
1376
  }
1376
1377
  /**
1377
- * Filters and returns commands based on deployment options
1378
+ * Filters and returns commands based on deployment options alphabetically
1378
1379
  */
1379
1380
  getAll(options) {
1380
1381
  const matchedCommands = /* @__PURE__ */ new Map();
@@ -1396,7 +1397,31 @@ var VimcordAppCommandManager = class {
1396
1397
  if (options?.globalOnly && deployment.global === false) continue;
1397
1398
  matchedCommands.set(name, cmd);
1398
1399
  }
1399
- return matchedCommands;
1400
+ return Array.from(matchedCommands.values()).sort((a, b) => a.builder.name.localeCompare(b.builder.name));
1401
+ }
1402
+ /**
1403
+ * Groups commands by category alphabetically
1404
+ */
1405
+ sortByCategory() {
1406
+ const categories = /* @__PURE__ */ new Map();
1407
+ for (const cmd of this.commands.values()) {
1408
+ const metadata = cmd.options.metadata;
1409
+ if (!metadata?.category) continue;
1410
+ let entry = categories.get(metadata.category);
1411
+ if (!entry) {
1412
+ entry = {
1413
+ name: metadata.category,
1414
+ emoji: metadata.categoryEmoji,
1415
+ commands: []
1416
+ };
1417
+ categories.set(metadata.category, entry);
1418
+ }
1419
+ entry.commands.push(cmd);
1420
+ }
1421
+ return Array.from(categories.values()).sort((a, b) => a.name.localeCompare(b.name)).map((cat) => {
1422
+ cat.commands.sort((a, b) => a.builder.name.localeCompare(b.builder.name));
1423
+ return cat;
1424
+ });
1400
1425
  }
1401
1426
  async registerGlobal(options) {
1402
1427
  const client = await this.client.whenReady();
@@ -1518,6 +1543,30 @@ var VimcordPrefixCommandManager = class {
1518
1543
  );
1519
1544
  });
1520
1545
  }
1546
+ /**
1547
+ * Groups commands by category alphabetically
1548
+ */
1549
+ sortByCategory() {
1550
+ const categories = /* @__PURE__ */ new Map();
1551
+ for (const cmd of this.commands.values()) {
1552
+ const metadata = cmd.options.metadata;
1553
+ if (!metadata?.category) continue;
1554
+ let entry = categories.get(metadata.category);
1555
+ if (!entry) {
1556
+ entry = {
1557
+ name: metadata.category,
1558
+ emoji: metadata.categoryEmoji,
1559
+ commands: []
1560
+ };
1561
+ categories.set(metadata.category, entry);
1562
+ }
1563
+ entry.commands.push(cmd);
1564
+ }
1565
+ return Array.from(categories.values()).sort((a, b) => a.name.localeCompare(b.name)).map((cat) => {
1566
+ cat.commands.sort((a, b) => a.options.name.localeCompare(b.options.name));
1567
+ return cat;
1568
+ });
1569
+ }
1521
1570
  async importFrom(dir, replaceAll = false) {
1522
1571
  if (replaceAll) this.commands.clear();
1523
1572
  const dirs = Array.isArray(dir) ? dir : [dir];
@@ -2175,7 +2224,7 @@ async function retryExponentialBackoff(fn, maxRetries = 3, retryDelay = 1e3) {
2175
2224
  }
2176
2225
 
2177
2226
  // package.json
2178
- var version = "1.0.1";
2227
+ var version = "1.0.23";
2179
2228
 
2180
2229
  // src/client.ts
2181
2230
  import { randomUUID as randomUUID3 } from "crypto";