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.js CHANGED
@@ -759,7 +759,11 @@ var SlashCommandBuilder = class extends BaseCommandBuilder {
759
759
  if (subCommand) {
760
760
  const handler = this.routes.get(subCommand.toLowerCase());
761
761
  if (handler) return await handler(client, interaction);
762
- if (config.onUnknownRouteHandler) return await config.onUnknownRouteHandler(client, interaction);
762
+ if (config.onUnknownRouteHandler) {
763
+ return await config.onUnknownRouteHandler(client, interaction);
764
+ } else {
765
+ return await interaction.reply({ content: `Unknown subcommand: ${subCommand}`, flags: "Ephemeral" });
766
+ }
763
767
  }
764
768
  return await originalExecute?.(client, interaction);
765
769
  }
@@ -824,7 +828,7 @@ import dotEnv from "dotenv";
824
828
 
825
829
  // src/configs/tools.config.ts
826
830
  import _5 from "lodash";
827
- var globalVimcordToolsConfig = {
831
+ var globalToolsConfig = {
828
832
  devMode: false,
829
833
  embedColor: [],
830
834
  embedColorDev: [],
@@ -860,10 +864,10 @@ var globalVimcordToolsConfig = {
860
864
  }
861
865
  };
862
866
  function defineGlobalToolsConfig(options) {
863
- Object.assign(globalVimcordToolsConfig, _5.merge(globalVimcordToolsConfig, options));
867
+ Object.assign(globalToolsConfig, _5.merge(globalToolsConfig, options));
864
868
  }
865
869
  function createToolsConfig(options) {
866
- return _5.merge(globalVimcordToolsConfig, options);
870
+ return _5.merge(globalToolsConfig, options);
867
871
  }
868
872
 
869
873
  // src/configs/app.config.ts
@@ -881,7 +885,7 @@ var defaultConfig = {
881
885
  event: "event"
882
886
  }
883
887
  };
884
- function createVimcordAppConfig(options = {}) {
888
+ function createAppConfig(options = {}) {
885
889
  return _6.merge(defaultConfig, options);
886
890
  }
887
891
 
@@ -904,7 +908,7 @@ var defaultConfig2 = {
904
908
  channels: {}
905
909
  }
906
910
  };
907
- function createVimcordStaffConfig(options = {}) {
911
+ function createStaffConfig(options = {}) {
908
912
  return _7.merge(defaultConfig2, options);
909
913
  }
910
914
 
@@ -913,7 +917,7 @@ import _8 from "lodash";
913
917
  var defaultConfig3 = {
914
918
  logExecution: true
915
919
  };
916
- function createVimcordSlashCommandConfig(options = {}) {
920
+ function createSlashCommandConfig(options = {}) {
917
921
  return _8.merge(defaultConfig3, options);
918
922
  }
919
923
 
@@ -926,7 +930,7 @@ var defaultConfig4 = {
926
930
  allowCaseInsensitiveCommandNames: true,
927
931
  logExecution: true
928
932
  };
929
- function createVimcordPrefixCommandConfig(options = {}) {
933
+ function createPrefixCommandConfig(options = {}) {
930
934
  return _9.merge(defaultConfig4, options);
931
935
  }
932
936
 
@@ -936,7 +940,7 @@ var defaultConfig5 = {
936
940
  enabled: true,
937
941
  logExecution: true
938
942
  };
939
- function createVimcordContextCommandConfig(options = {}) {
943
+ function createContextCommandConfig(options = {}) {
940
944
  return _10.merge(defaultConfig5, options);
941
945
  }
942
946
 
@@ -1172,7 +1176,7 @@ var BetterEmbed = class _BetterEmbed {
1172
1176
  * - __`$month`__: _M or MM_
1173
1177
  * - __`$day`__: _D or DD_ */
1174
1178
  constructor(data = {}) {
1175
- this.config = data.config || globalVimcordToolsConfig;
1179
+ this.config = data.config ? createToolsConfig(data.config) : globalToolsConfig;
1176
1180
  this.data = {
1177
1181
  context: data.context || null,
1178
1182
  author: data.author || null,
@@ -2139,12 +2143,17 @@ var CommandManager = class {
2139
2143
  console.log("[CommandManager] No commands to register globally");
2140
2144
  return;
2141
2145
  }
2142
- console.log(`[CommandManager] Registering (${commands.length}) commands globally...`);
2146
+ console.log(
2147
+ `[CommandManager] Registering (${commands.length}) ${commands.length === 1 ? "command" : "commands"} globally...`
2148
+ );
2143
2149
  try {
2144
2150
  await client.rest.put(Routes.applicationCommands(client.user.id), { body: commands });
2145
- console.log(`[CommandManager] \u2714 Registered app commands globally`);
2151
+ console.log(`[CommandManager] \u2714 Registered app ${commands.length === 1 ? "command" : "commands"} globally`);
2146
2152
  } catch (err) {
2147
- console.error(`[CommandManager] \u2716 Failed to register app commands globally`, err);
2153
+ console.error(
2154
+ `[CommandManager] \u2716 Failed to register app ${commands.length === 1 ? "command" : "commands"} globally`,
2155
+ err
2156
+ );
2148
2157
  }
2149
2158
  }
2150
2159
  async unregisterGlobal() {
@@ -2172,15 +2181,22 @@ var CommandManager = class {
2172
2181
  return;
2173
2182
  }
2174
2183
  const guildIds = options.guilds || client.guilds.cache.map((g) => g.id);
2175
- console.log(`[CommandManager] Registering (${commands.length}) commands for ${guildIds.length} guilds...`);
2184
+ console.log(
2185
+ `[CommandManager] Registering (${commands.length}) ${commands.length === 1 ? "command" : "commands"} for ${guildIds.length} guilds...`
2186
+ );
2176
2187
  await Promise.all(
2177
2188
  guildIds.map(
2178
2189
  (guildId) => client.rest.put(Routes.applicationGuildCommands(client.user.id, guildId), { body: commands }).then(() => {
2179
2190
  const gName = client.guilds.cache.get(guildId)?.name || "n/a";
2180
- console.log(`[CommandManager] \u2714 Set app commands in guild: ${guildId} (${gName})`);
2191
+ console.log(
2192
+ `[CommandManager] \u2714 Set app ${commands.length === 1 ? "command" : "commands"} in guild: ${guildId} (${gName})`
2193
+ );
2181
2194
  }).catch((err) => {
2182
2195
  const gName = client.guilds.cache.get(guildId)?.name || "n/a";
2183
- console.log(`[CommandManager] \u2716 Failed to set app commands in guild: ${guildId} (${gName})`, err);
2196
+ console.log(
2197
+ `[CommandManager] \u2716 Failed to set app ${commands.length === 1 ? "command" : "commands"} in guild: ${guildId} (${gName})`,
2198
+ err
2199
+ );
2184
2200
  })
2185
2201
  )
2186
2202
  );
@@ -2293,7 +2309,7 @@ var EventManager = class {
2293
2309
  };
2294
2310
 
2295
2311
  // package.json
2296
- var version = "1.0.35";
2312
+ var version = "1.0.36";
2297
2313
 
2298
2314
  // src/client.ts
2299
2315
  import { randomUUID as randomUUID3 } from "crypto";
@@ -2581,16 +2597,6 @@ var Vimcord = class _Vimcord extends Client2 {
2581
2597
  super(options);
2582
2598
  this.clientOptions = options;
2583
2599
  this.features = features;
2584
- this.config = {
2585
- app: createVimcordAppConfig(config.app),
2586
- staff: createVimcordStaffConfig(config.staff),
2587
- slashCommands: createVimcordSlashCommandConfig(config.slashCommands),
2588
- prefixCommands: createVimcordPrefixCommandConfig(config.prefixCommands),
2589
- contextCommands: createVimcordContextCommandConfig(config.contextCommands)
2590
- };
2591
- this.status = new StatusManager(this);
2592
- this.events = new EventManager(this);
2593
- this.commands = new CommandManager(this);
2594
2600
  if (this.features.useEnv) {
2595
2601
  if (typeof this.features.useEnv === "object") {
2596
2602
  dotEnv.config({ quiet: true, ...this.features.useEnv });
@@ -2605,6 +2611,16 @@ var Vimcord = class _Vimcord extends Client2 {
2605
2611
  this.on("error", (err) => this.logger.error("Client Error", err));
2606
2612
  this.on("shardError", (err) => this.logger.error("Client Shard Error", err));
2607
2613
  }
2614
+ this.config = {
2615
+ app: createAppConfig(config.app),
2616
+ staff: createStaffConfig(config.staff),
2617
+ slashCommands: createSlashCommandConfig(config.slashCommands),
2618
+ prefixCommands: createPrefixCommandConfig(config.prefixCommands),
2619
+ contextCommands: createContextCommandConfig(config.contextCommands)
2620
+ };
2621
+ this.status = new StatusManager(this);
2622
+ this.events = new EventManager(this);
2623
+ this.commands = new CommandManager(this);
2608
2624
  this.logger.clientBanner(this);
2609
2625
  this.once("clientReady", (client) => {
2610
2626
  this.logger.clientReady(client.user.tag, client.guilds.cache.size);
@@ -2626,26 +2642,26 @@ var Vimcord = class _Vimcord extends Client2 {
2626
2642
  return new _Vimcord(options, features, config);
2627
2643
  }
2628
2644
  configureApp(options = {}) {
2629
- this.config.app = createVimcordAppConfig(options);
2645
+ this.config.app = createAppConfig(options);
2630
2646
  if (this.features.hookToolsDevMode) {
2631
- globalVimcordToolsConfig.devMode = this.config.app.devMode;
2647
+ globalToolsConfig.devMode = this.config.app.devMode;
2632
2648
  }
2633
2649
  return this;
2634
2650
  }
2635
2651
  configureStaff(options = {}) {
2636
- this.config.staff = createVimcordStaffConfig(options);
2652
+ this.config.staff = createStaffConfig(options);
2637
2653
  return this;
2638
2654
  }
2639
2655
  configureSlashCommands(options = {}) {
2640
- this.config.slashCommands = createVimcordSlashCommandConfig(options);
2656
+ this.config.slashCommands = createSlashCommandConfig(options);
2641
2657
  return this;
2642
2658
  }
2643
2659
  configurePrefixCommands(options = {}) {
2644
- this.config.prefixCommands = createVimcordPrefixCommandConfig(options);
2660
+ this.config.prefixCommands = createPrefixCommandConfig(options);
2645
2661
  return this;
2646
2662
  }
2647
2663
  configureContextCommands(options = {}) {
2648
- this.config.contextCommands = createVimcordContextCommandConfig(options);
2664
+ this.config.contextCommands = createContextCommandConfig(options);
2649
2665
  return this;
2650
2666
  }
2651
2667
  async importEventModules(dir, replaceAll) {
@@ -3058,6 +3074,12 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
3058
3074
  return result?.length ? result : [];
3059
3075
  });
3060
3076
  }
3077
+ async bulkWrite(ops, options) {
3078
+ return await this.execute(async (model) => model.bulkWrite(ops, options));
3079
+ }
3080
+ async bulkSave(docs, options) {
3081
+ return await this.execute(async (model) => model.bulkSave(docs, options));
3082
+ }
3061
3083
  };
3062
3084
 
3063
3085
  // src/tools/BetterCollector.ts
@@ -3229,8 +3251,8 @@ var BetterCollector = class _BetterCollector {
3229
3251
  handleListenerError(err) {
3230
3252
  console.error("[BetterCollector] Listener Error:", err);
3231
3253
  }
3232
- constructor(message, options) {
3233
- this.config = options?.config || globalVimcordToolsConfig;
3254
+ constructor(message, options = {}) {
3255
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
3234
3256
  this.message = message || void 0;
3235
3257
  this.options = options;
3236
3258
  this.build();
@@ -3280,7 +3302,7 @@ var BetterContainer = class {
3280
3302
  data;
3281
3303
  config;
3282
3304
  constructor(data = {}) {
3283
- this.config = data.config || globalVimcordToolsConfig;
3305
+ this.config = data.config ? createToolsConfig(data.config) : globalToolsConfig;
3284
3306
  this.data = {
3285
3307
  color: data.color ?? (this.config.devMode ? this.config.embedColorDev : this.config.embedColor),
3286
3308
  ...data
@@ -3288,7 +3310,7 @@ var BetterContainer = class {
3288
3310
  this.build();
3289
3311
  }
3290
3312
  configure() {
3291
- if (this.data.color) {
3313
+ if (this.data.color !== void 0) {
3292
3314
  try {
3293
3315
  const color = Array.isArray(this.data.color) ? this.data.color[Math.floor(Math.random() * this.data.color.length)] ?? null : this.data.color;
3294
3316
  if (color) {
@@ -3304,6 +3326,14 @@ var BetterContainer = class {
3304
3326
  build() {
3305
3327
  this.configure();
3306
3328
  }
3329
+ setColor(color) {
3330
+ this.data.color = color;
3331
+ return this;
3332
+ }
3333
+ clearColor() {
3334
+ this.data.color = null;
3335
+ return this;
3336
+ }
3307
3337
  addSeparator(options) {
3308
3338
  this.container.addSeparatorComponents((sb) => {
3309
3339
  if (options?.divider !== void 0) sb.setDivider(options.divider);
@@ -3392,7 +3422,7 @@ var BetterModal = class {
3392
3422
  this.id = options.id || this.createModalId();
3393
3423
  this.options = options;
3394
3424
  this.modal = new ModalBuilder().setCustomId(this.id);
3395
- this.config = options.config || globalVimcordToolsConfig;
3425
+ this.config = options.config || globalToolsConfig;
3396
3426
  if (options.title) {
3397
3427
  this.setTitle(options.title);
3398
3428
  }
@@ -3572,7 +3602,8 @@ var BetterModal = class {
3572
3602
  values,
3573
3603
  interaction: modalSubmit,
3574
3604
  reply: (options2) => dynaSend(modalSubmit, options2),
3575
- deferUpdate: async (options2) => await modalSubmit.deferUpdate(options2)
3605
+ deferUpdate: async (options2) => await modalSubmit.deferUpdate(options2),
3606
+ followUp: async (options2) => await modalSubmit.followUp(options2)
3576
3607
  };
3577
3608
  } catch (error) {
3578
3609
  return null;
@@ -3646,7 +3677,7 @@ var Paginator = class {
3646
3677
  events;
3647
3678
  eventEmitter = new EventEmitter3();
3648
3679
  constructor(options = {}) {
3649
- this.config = options.config || globalVimcordToolsConfig;
3680
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
3650
3681
  this.options = {
3651
3682
  type: options.type ?? 0 /* Short */,
3652
3683
  participants: options.participants ?? [],
@@ -4079,7 +4110,7 @@ var Prompt = class {
4079
4110
  config;
4080
4111
  message = null;
4081
4112
  constructor(options = {}) {
4082
- this.config = options.config ?? globalVimcordToolsConfig;
4113
+ this.config = options.config ? createToolsConfig(options.config) : globalToolsConfig;
4083
4114
  this.participants = options.participants ?? [];
4084
4115
  this.timeout = options.timeout ?? this.config.timeouts.prompt;
4085
4116
  this.content = options.content;
@@ -4301,15 +4332,15 @@ export {
4301
4332
  VimcordCLI,
4302
4333
  __zero,
4303
4334
  cleanMention,
4335
+ createAppConfig,
4304
4336
  createClient,
4337
+ createContextCommandConfig,
4305
4338
  createMongoPlugin,
4306
4339
  createMongoSchema,
4340
+ createPrefixCommandConfig,
4341
+ createSlashCommandConfig,
4342
+ createStaffConfig,
4307
4343
  createToolsConfig,
4308
- createVimcordAppConfig,
4309
- createVimcordContextCommandConfig,
4310
- createVimcordPrefixCommandConfig,
4311
- createVimcordSlashCommandConfig,
4312
- createVimcordStaffConfig,
4313
4344
  createVimcordStatusConfig,
4314
4345
  defineGlobalToolsConfig,
4315
4346
  dynaSend,
@@ -4323,7 +4354,7 @@ export {
4323
4354
  getFirstMentionId,
4324
4355
  getMessageMention,
4325
4356
  getProcessDir,
4326
- globalVimcordToolsConfig,
4357
+ globalToolsConfig,
4327
4358
  importModulesFromDir,
4328
4359
  initCLI,
4329
4360
  isMentionOrSnowflake,