vimcord 1.0.54 → 1.0.56

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
@@ -316,6 +316,8 @@ var BaseCommandBuilder = class {
316
316
  async run(client, ...args) {
317
317
  const config = this.resolveConfig(client);
318
318
  const ctx = this.extractContext(args);
319
+ let canceled = false;
320
+ const cancel = () => canceled = true;
319
321
  try {
320
322
  if (!config.enabled) {
321
323
  return await config.onUsedWhenDisabled?.(...args);
@@ -330,7 +332,10 @@ var BaseCommandBuilder = class {
330
332
  if (!await this.checkConditions(config, ...args)) {
331
333
  return await config.onConditionsNotMet?.(...args);
332
334
  }
333
- await config.beforeExecute?.(...args);
335
+ if (config.beforeExecute) {
336
+ await config.beforeExecute?.({ cancel }, ...args);
337
+ if (canceled) return;
338
+ }
334
339
  if (config.logExecution !== false) {
335
340
  const cmdName = this.options.name || this.builder?.name || "Unknown";
336
341
  const location = ctx.guild ? `${ctx.guild.name} (${ctx.guild.id})` : "Direct Messages";
@@ -780,6 +785,8 @@ var EventBuilder = class _EventBuilder {
780
785
  return results.every(Boolean);
781
786
  }
782
787
  async executeEvent(...args) {
788
+ let canceled = false;
789
+ const cancel = () => canceled = true;
783
790
  try {
784
791
  if (!this.enabled) {
785
792
  return;
@@ -795,7 +802,8 @@ var EventBuilder = class _EventBuilder {
795
802
  return;
796
803
  }
797
804
  if (this.beforeExecute) {
798
- await this.beforeExecute(...args);
805
+ await this.beforeExecute({ cancel }, ...args);
806
+ if (canceled) return;
799
807
  }
800
808
  const result = await this.execute?.(...args);
801
809
  if (this.afterExecute) {
@@ -1787,7 +1795,7 @@ var VimcordErrorHandler = class {
1787
1795
  var import_chalk2 = __toESM(require("chalk"));
1788
1796
 
1789
1797
  // package.json
1790
- var version = "1.0.54";
1798
+ var version = "1.0.55";
1791
1799
 
1792
1800
  // src/client/vimcord.logger.ts
1793
1801
  var clientLoggerFactory = (client) => new Logger({ prefixEmoji: "\u26A1", prefix: `vimcord (i${client.clientId})` }).extend({