vimcord 1.0.35 → 1.0.36

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 CHANGED
@@ -71,15 +71,15 @@ __export(index_exports, {
71
71
  VimcordCLI: () => VimcordCLI,
72
72
  __zero: () => __zero,
73
73
  cleanMention: () => cleanMention,
74
+ createAppConfig: () => createAppConfig,
74
75
  createClient: () => createClient,
76
+ createContextCommandConfig: () => createContextCommandConfig,
75
77
  createMongoPlugin: () => createMongoPlugin,
76
78
  createMongoSchema: () => createMongoSchema,
79
+ createPrefixCommandConfig: () => createPrefixCommandConfig,
80
+ createSlashCommandConfig: () => createSlashCommandConfig,
81
+ createStaffConfig: () => createStaffConfig,
77
82
  createToolsConfig: () => createToolsConfig,
78
- createVimcordAppConfig: () => createVimcordAppConfig,
79
- createVimcordContextCommandConfig: () => createVimcordContextCommandConfig,
80
- createVimcordPrefixCommandConfig: () => createVimcordPrefixCommandConfig,
81
- createVimcordSlashCommandConfig: () => createVimcordSlashCommandConfig,
82
- createVimcordStaffConfig: () => createVimcordStaffConfig,
83
83
  createVimcordStatusConfig: () => createVimcordStatusConfig,
84
84
  defineGlobalToolsConfig: () => defineGlobalToolsConfig,
85
85
  dynaSend: () => dynaSend,
@@ -93,7 +93,7 @@ __export(index_exports, {
93
93
  getFirstMentionId: () => getFirstMentionId,
94
94
  getMessageMention: () => getMessageMention,
95
95
  getProcessDir: () => getProcessDir,
96
- globalVimcordToolsConfig: () => globalVimcordToolsConfig,
96
+ globalToolsConfig: () => globalToolsConfig,
97
97
  importModulesFromDir: () => importModulesFromDir,
98
98
  initCLI: () => initCLI,
99
99
  isMentionOrSnowflake: () => isMentionOrSnowflake,
@@ -860,7 +860,11 @@ var SlashCommandBuilder = class extends BaseCommandBuilder {
860
860
  if (subCommand) {
861
861
  const handler = this.routes.get(subCommand.toLowerCase());
862
862
  if (handler) return await handler(client, interaction);
863
- if (config.onUnknownRouteHandler) return await config.onUnknownRouteHandler(client, interaction);
863
+ if (config.onUnknownRouteHandler) {
864
+ return await config.onUnknownRouteHandler(client, interaction);
865
+ } else {
866
+ return await interaction.reply({ content: `Unknown subcommand: ${subCommand}`, flags: "Ephemeral" });
867
+ }
864
868
  }
865
869
  return await originalExecute?.(client, interaction);
866
870
  }
@@ -925,7 +929,7 @@ var import_dotenv = __toESM(require("dotenv"));
925
929
 
926
930
  // src/configs/tools.config.ts
927
931
  var import_lodash5 = __toESM(require("lodash"));
928
- var globalVimcordToolsConfig = {
932
+ var globalToolsConfig = {
929
933
  devMode: false,
930
934
  embedColor: [],
931
935
  embedColorDev: [],
@@ -961,10 +965,10 @@ var globalVimcordToolsConfig = {
961
965
  }
962
966
  };
963
967
  function defineGlobalToolsConfig(options) {
964
- Object.assign(globalVimcordToolsConfig, import_lodash5.default.merge(globalVimcordToolsConfig, options));
968
+ Object.assign(globalToolsConfig, import_lodash5.default.merge(globalToolsConfig, options));
965
969
  }
966
970
  function createToolsConfig(options) {
967
- return import_lodash5.default.merge(globalVimcordToolsConfig, options);
971
+ return import_lodash5.default.merge(globalToolsConfig, options);
968
972
  }
969
973
 
970
974
  // src/configs/app.config.ts
@@ -982,7 +986,7 @@ var defaultConfig = {
982
986
  event: "event"
983
987
  }
984
988
  };
985
- function createVimcordAppConfig(options = {}) {
989
+ function createAppConfig(options = {}) {
986
990
  return import_lodash6.default.merge(defaultConfig, options);
987
991
  }
988
992
 
@@ -1005,7 +1009,7 @@ var defaultConfig2 = {
1005
1009
  channels: {}
1006
1010
  }
1007
1011
  };
1008
- function createVimcordStaffConfig(options = {}) {
1012
+ function createStaffConfig(options = {}) {
1009
1013
  return import_lodash7.default.merge(defaultConfig2, options);
1010
1014
  }
1011
1015
 
@@ -1014,7 +1018,7 @@ var import_lodash8 = __toESM(require("lodash"));
1014
1018
  var defaultConfig3 = {
1015
1019
  logExecution: true
1016
1020
  };
1017
- function createVimcordSlashCommandConfig(options = {}) {
1021
+ function createSlashCommandConfig(options = {}) {
1018
1022
  return import_lodash8.default.merge(defaultConfig3, options);
1019
1023
  }
1020
1024
 
@@ -1027,7 +1031,7 @@ var defaultConfig4 = {
1027
1031
  allowCaseInsensitiveCommandNames: true,
1028
1032
  logExecution: true
1029
1033
  };
1030
- function createVimcordPrefixCommandConfig(options = {}) {
1034
+ function createPrefixCommandConfig(options = {}) {
1031
1035
  return import_lodash9.default.merge(defaultConfig4, options);
1032
1036
  }
1033
1037
 
@@ -1037,7 +1041,7 @@ var defaultConfig5 = {
1037
1041
  enabled: true,
1038
1042
  logExecution: true
1039
1043
  };
1040
- function createVimcordContextCommandConfig(options = {}) {
1044
+ function createContextCommandConfig(options = {}) {
1041
1045
  return import_lodash10.default.merge(defaultConfig5, options);
1042
1046
  }
1043
1047
 
@@ -1255,7 +1259,7 @@ var BetterEmbed = class _BetterEmbed {
1255
1259
  * - __`$month`__: _M or MM_
1256
1260
  * - __`$day`__: _D or DD_ */
1257
1261
  constructor(data = {}) {
1258
- this.config = data.config || globalVimcordToolsConfig;
1262
+ this.config = data.config ? createToolsConfig(data.config) : globalToolsConfig;
1259
1263
  this.data = {
1260
1264
  context: data.context || null,
1261
1265
  author: data.author || null,
@@ -2222,12 +2226,17 @@ var CommandManager = class {
2222
2226
  console.log("[CommandManager] No commands to register globally");
2223
2227
  return;
2224
2228
  }
2225
- console.log(`[CommandManager] Registering (${commands.length}) commands globally...`);
2229
+ console.log(
2230
+ `[CommandManager] Registering (${commands.length}) ${commands.length === 1 ? "command" : "commands"} globally...`
2231
+ );
2226
2232
  try {
2227
2233
  await client.rest.put(import_discord9.Routes.applicationCommands(client.user.id), { body: commands });
2228
- console.log(`[CommandManager] \u2714 Registered app commands globally`);
2234
+ console.log(`[CommandManager] \u2714 Registered app ${commands.length === 1 ? "command" : "commands"} globally`);
2229
2235
  } catch (err) {
2230
- console.error(`[CommandManager] \u2716 Failed to register app commands globally`, err);
2236
+ console.error(
2237
+ `[CommandManager] \u2716 Failed to register app ${commands.length === 1 ? "command" : "commands"} globally`,
2238
+ err
2239
+ );
2231
2240
  }
2232
2241
  }
2233
2242
  async unregisterGlobal() {
@@ -2255,15 +2264,22 @@ var CommandManager = class {
2255
2264
  return;
2256
2265
  }
2257
2266
  const guildIds = options.guilds || client.guilds.cache.map((g) => g.id);
2258
- console.log(`[CommandManager] Registering (${commands.length}) commands for ${guildIds.length} guilds...`);
2267
+ console.log(
2268
+ `[CommandManager] Registering (${commands.length}) ${commands.length === 1 ? "command" : "commands"} for ${guildIds.length} guilds...`
2269
+ );
2259
2270
  await Promise.all(
2260
2271
  guildIds.map(
2261
2272
  (guildId) => client.rest.put(import_discord9.Routes.applicationGuildCommands(client.user.id, guildId), { body: commands }).then(() => {
2262
2273
  const gName = client.guilds.cache.get(guildId)?.name || "n/a";
2263
- console.log(`[CommandManager] \u2714 Set app commands in guild: ${guildId} (${gName})`);
2274
+ console.log(
2275
+ `[CommandManager] \u2714 Set app ${commands.length === 1 ? "command" : "commands"} in guild: ${guildId} (${gName})`
2276
+ );
2264
2277
  }).catch((err) => {
2265
2278
  const gName = client.guilds.cache.get(guildId)?.name || "n/a";
2266
- console.log(`[CommandManager] \u2716 Failed to set app commands in guild: ${guildId} (${gName})`, err);
2279
+ console.log(
2280
+ `[CommandManager] \u2716 Failed to set app ${commands.length === 1 ? "command" : "commands"} in guild: ${guildId} (${gName})`,
2281
+ err
2282
+ );
2267
2283
  })
2268
2284
  )
2269
2285
  );
@@ -2376,7 +2392,7 @@ var EventManager = class {
2376
2392
  };
2377
2393
 
2378
2394
  // package.json
2379
- var version = "1.0.35";
2395
+ var version = "1.0.36";
2380
2396
 
2381
2397
  // src/client.ts
2382
2398
  var import_node_crypto3 = require("crypto");
@@ -2664,16 +2680,6 @@ var Vimcord = class _Vimcord extends import_discord11.Client {
2664
2680
  super(options);
2665
2681
  this.clientOptions = options;
2666
2682
  this.features = features;
2667
- this.config = {
2668
- app: createVimcordAppConfig(config.app),
2669
- staff: createVimcordStaffConfig(config.staff),
2670
- slashCommands: createVimcordSlashCommandConfig(config.slashCommands),
2671
- prefixCommands: createVimcordPrefixCommandConfig(config.prefixCommands),
2672
- contextCommands: createVimcordContextCommandConfig(config.contextCommands)
2673
- };
2674
- this.status = new StatusManager(this);
2675
- this.events = new EventManager(this);
2676
- this.commands = new CommandManager(this);
2677
2683
  if (this.features.useEnv) {
2678
2684
  if (typeof this.features.useEnv === "object") {
2679
2685
  import_dotenv.default.config({ quiet: true, ...this.features.useEnv });
@@ -2688,6 +2694,16 @@ var Vimcord = class _Vimcord extends import_discord11.Client {
2688
2694
  this.on("error", (err) => this.logger.error("Client Error", err));
2689
2695
  this.on("shardError", (err) => this.logger.error("Client Shard Error", err));
2690
2696
  }
2697
+ this.config = {
2698
+ app: createAppConfig(config.app),
2699
+ staff: createStaffConfig(config.staff),
2700
+ slashCommands: createSlashCommandConfig(config.slashCommands),
2701
+ prefixCommands: createPrefixCommandConfig(config.prefixCommands),
2702
+ contextCommands: createContextCommandConfig(config.contextCommands)
2703
+ };
2704
+ this.status = new StatusManager(this);
2705
+ this.events = new EventManager(this);
2706
+ this.commands = new CommandManager(this);
2691
2707
  this.logger.clientBanner(this);
2692
2708
  this.once("clientReady", (client) => {
2693
2709
  this.logger.clientReady(client.user.tag, client.guilds.cache.size);
@@ -2709,26 +2725,26 @@ var Vimcord = class _Vimcord extends import_discord11.Client {
2709
2725
  return new _Vimcord(options, features, config);
2710
2726
  }
2711
2727
  configureApp(options = {}) {
2712
- this.config.app = createVimcordAppConfig(options);
2728
+ this.config.app = createAppConfig(options);
2713
2729
  if (this.features.hookToolsDevMode) {
2714
- globalVimcordToolsConfig.devMode = this.config.app.devMode;
2730
+ globalToolsConfig.devMode = this.config.app.devMode;
2715
2731
  }
2716
2732
  return this;
2717
2733
  }
2718
2734
  configureStaff(options = {}) {
2719
- this.config.staff = createVimcordStaffConfig(options);
2735
+ this.config.staff = createStaffConfig(options);
2720
2736
  return this;
2721
2737
  }
2722
2738
  configureSlashCommands(options = {}) {
2723
- this.config.slashCommands = createVimcordSlashCommandConfig(options);
2739
+ this.config.slashCommands = createSlashCommandConfig(options);
2724
2740
  return this;
2725
2741
  }
2726
2742
  configurePrefixCommands(options = {}) {
2727
- this.config.prefixCommands = createVimcordPrefixCommandConfig(options);
2743
+ this.config.prefixCommands = createPrefixCommandConfig(options);
2728
2744
  return this;
2729
2745
  }
2730
2746
  configureContextCommands(options = {}) {
2731
- this.config.contextCommands = createVimcordContextCommandConfig(options);
2747
+ this.config.contextCommands = createContextCommandConfig(options);
2732
2748
  return this;
2733
2749
  }
2734
2750
  async importEventModules(dir, replaceAll) {
@@ -3139,6 +3155,12 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
3139
3155
  return result?.length ? result : [];
3140
3156
  });
3141
3157
  }
3158
+ async bulkWrite(ops, options) {
3159
+ return await this.execute(async (model) => model.bulkWrite(ops, options));
3160
+ }
3161
+ async bulkSave(docs, options) {
3162
+ return await this.execute(async (model) => model.bulkSave(docs, options));
3163
+ }
3142
3164
  };
3143
3165
 
3144
3166
  // src/tools/BetterCollector.ts
@@ -3310,8 +3332,8 @@ var BetterCollector = class _BetterCollector {
3310
3332
  handleListenerError(err) {
3311
3333
  console.error("[BetterCollector] Listener Error:", err);
3312
3334
  }
3313
- constructor(message, options) {
3314
- this.config = options?.config || globalVimcordToolsConfig;
3335
+ constructor(message, options = {}) {
3336
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
3315
3337
  this.message = message || void 0;
3316
3338
  this.options = options;
3317
3339
  this.build();
@@ -3357,7 +3379,7 @@ var BetterContainer = class {
3357
3379
  data;
3358
3380
  config;
3359
3381
  constructor(data = {}) {
3360
- this.config = data.config || globalVimcordToolsConfig;
3382
+ this.config = data.config ? createToolsConfig(data.config) : globalToolsConfig;
3361
3383
  this.data = {
3362
3384
  color: data.color ?? (this.config.devMode ? this.config.embedColorDev : this.config.embedColor),
3363
3385
  ...data
@@ -3365,7 +3387,7 @@ var BetterContainer = class {
3365
3387
  this.build();
3366
3388
  }
3367
3389
  configure() {
3368
- if (this.data.color) {
3390
+ if (this.data.color !== void 0) {
3369
3391
  try {
3370
3392
  const color = Array.isArray(this.data.color) ? this.data.color[Math.floor(Math.random() * this.data.color.length)] ?? null : this.data.color;
3371
3393
  if (color) {
@@ -3381,6 +3403,14 @@ var BetterContainer = class {
3381
3403
  build() {
3382
3404
  this.configure();
3383
3405
  }
3406
+ setColor(color) {
3407
+ this.data.color = color;
3408
+ return this;
3409
+ }
3410
+ clearColor() {
3411
+ this.data.color = null;
3412
+ return this;
3413
+ }
3384
3414
  addSeparator(options) {
3385
3415
  this.container.addSeparatorComponents((sb) => {
3386
3416
  if (options?.divider !== void 0) sb.setDivider(options.divider);
@@ -3458,7 +3488,7 @@ var BetterModal = class {
3458
3488
  this.id = options.id || this.createModalId();
3459
3489
  this.options = options;
3460
3490
  this.modal = new import_discord13.ModalBuilder().setCustomId(this.id);
3461
- this.config = options.config || globalVimcordToolsConfig;
3491
+ this.config = options.config || globalToolsConfig;
3462
3492
  if (options.title) {
3463
3493
  this.setTitle(options.title);
3464
3494
  }
@@ -3638,7 +3668,8 @@ var BetterModal = class {
3638
3668
  values,
3639
3669
  interaction: modalSubmit,
3640
3670
  reply: (options2) => dynaSend(modalSubmit, options2),
3641
- deferUpdate: async (options2) => await modalSubmit.deferUpdate(options2)
3671
+ deferUpdate: async (options2) => await modalSubmit.deferUpdate(options2),
3672
+ followUp: async (options2) => await modalSubmit.followUp(options2)
3642
3673
  };
3643
3674
  } catch (error) {
3644
3675
  return null;
@@ -3703,7 +3734,7 @@ var Paginator = class {
3703
3734
  events;
3704
3735
  eventEmitter = new import_node_events3.default();
3705
3736
  constructor(options = {}) {
3706
- this.config = options.config || globalVimcordToolsConfig;
3737
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
3707
3738
  this.options = {
3708
3739
  type: options.type ?? 0 /* Short */,
3709
3740
  participants: options.participants ?? [],
@@ -4131,7 +4162,7 @@ var Prompt = class {
4131
4162
  config;
4132
4163
  message = null;
4133
4164
  constructor(options = {}) {
4134
- this.config = options.config ?? globalVimcordToolsConfig;
4165
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
4135
4166
  this.participants = options.participants ?? [];
4136
4167
  this.timeout = options.timeout ?? this.config.timeouts.prompt;
4137
4168
  this.content = options.content;
@@ -4354,15 +4385,15 @@ async function prompt(handler, options, sendOptions) {
4354
4385
  VimcordCLI,
4355
4386
  __zero,
4356
4387
  cleanMention,
4388
+ createAppConfig,
4357
4389
  createClient,
4390
+ createContextCommandConfig,
4358
4391
  createMongoPlugin,
4359
4392
  createMongoSchema,
4393
+ createPrefixCommandConfig,
4394
+ createSlashCommandConfig,
4395
+ createStaffConfig,
4360
4396
  createToolsConfig,
4361
- createVimcordAppConfig,
4362
- createVimcordContextCommandConfig,
4363
- createVimcordPrefixCommandConfig,
4364
- createVimcordSlashCommandConfig,
4365
- createVimcordStaffConfig,
4366
4397
  createVimcordStatusConfig,
4367
4398
  defineGlobalToolsConfig,
4368
4399
  dynaSend,
@@ -4376,7 +4407,7 @@ async function prompt(handler, options, sendOptions) {
4376
4407
  getFirstMentionId,
4377
4408
  getMessageMention,
4378
4409
  getProcessDir,
4379
- globalVimcordToolsConfig,
4410
+ globalToolsConfig,
4380
4411
  importModulesFromDir,
4381
4412
  initCLI,
4382
4413
  isMentionOrSnowflake,