seedcord 0.2.0 → 0.3.0

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
@@ -270,6 +270,14 @@ var CustomError = class extends Error {
270
270
  get emit() {
271
271
  return this._emit;
272
272
  }
273
+ /**
274
+ * Sets whether this error should be emitted to logs
275
+ *
276
+ * @see {@link emit}
277
+ */
278
+ set emit(value) {
279
+ this._emit = value;
280
+ }
273
281
  };
274
282
 
275
283
  // src/bot/decorators/CommandRegisterable.ts
@@ -296,7 +304,7 @@ var CommandRegistry = class {
296
304
  logger = new services.Logger("Commands");
297
305
  isInitialised = false;
298
306
  globalCommands = [];
299
- guildCommands = /* @__PURE__ */ new Map();
307
+ guildCommands = new discord_js.Collection();
300
308
  constructor(core) {
301
309
  this.core = core;
302
310
  }
@@ -459,7 +467,7 @@ var EventController = class {
459
467
  core;
460
468
  logger = new services.Logger("Events");
461
469
  isInitialized = false;
462
- eventMap = /* @__PURE__ */ new Map();
470
+ eventMap = new discord_js.Collection();
463
471
  constructor(core) {
464
472
  this.core = core;
465
473
  }
@@ -635,7 +643,6 @@ var DatabaseError = class extends CustomError {
635
643
  __name(this, "DatabaseError");
636
644
  }
637
645
  uuid;
638
- _emit = true;
639
646
  /**
640
647
  * Creates a new DatabaseError.
641
648
  *
@@ -644,6 +651,7 @@ var DatabaseError = class extends CustomError {
644
651
  */
645
652
  constructor(message, uuid) {
646
653
  super(message), this.uuid = uuid;
654
+ this.emit = true;
647
655
  this.name = "DatabaseError";
648
656
  this.response.setTitle("Database Error").setDescription(`An error occurred while interacting with the database.
649
657
  ### UUID: \`${this.uuid}\``);
@@ -687,7 +695,9 @@ var ErrorHandlingUtils = class {
687
695
  response: error.response
688
696
  };
689
697
  }
690
- this.logger.error(uuid, error);
698
+ const showStack = core.config.bot.errorStack;
699
+ if (showStack) this.logger.error(uuid, error);
700
+ else this.logger.error(`${uuid} | ${error.message}`);
691
701
  core.effects.emit("unknownException", {
692
702
  uuid,
693
703
  error,
@@ -798,24 +808,25 @@ var InteractionController = class {
798
808
  core;
799
809
  logger = new services.Logger("Interactions");
800
810
  isInitialized = false;
801
- slashMap = /* @__PURE__ */ new Map();
802
- buttonMap = /* @__PURE__ */ new Map();
803
- modalMap = /* @__PURE__ */ new Map();
804
- stringSelectMap = /* @__PURE__ */ new Map();
805
- userSelectMap = /* @__PURE__ */ new Map();
806
- roleSelectMap = /* @__PURE__ */ new Map();
807
- channelSelectMap = /* @__PURE__ */ new Map();
808
- mentionableSelectMap = /* @__PURE__ */ new Map();
809
- messageContextMenuMap = /* @__PURE__ */ new Map();
810
- userContextMenuMap = /* @__PURE__ */ new Map();
811
- autocompleteMap = /* @__PURE__ */ new Map();
812
- keysToIgnore = /* @__PURE__ */ new Set([
813
- "confirm!confirmable",
814
- "cancel!confirmable"
815
- ]);
811
+ slashMap = new discord_js.Collection();
812
+ buttonMap = new discord_js.Collection();
813
+ modalMap = new discord_js.Collection();
814
+ stringSelectMap = new discord_js.Collection();
815
+ userSelectMap = new discord_js.Collection();
816
+ roleSelectMap = new discord_js.Collection();
817
+ channelSelectMap = new discord_js.Collection();
818
+ mentionableSelectMap = new discord_js.Collection();
819
+ messageContextMenuMap = new discord_js.Collection();
820
+ userContextMenuMap = new discord_js.Collection();
821
+ autocompleteMap = new discord_js.Collection();
822
+ keysToIgnore = /* @__PURE__ */ new Set();
816
823
  middlewares = [];
817
824
  constructor(core) {
818
825
  this.core = core;
826
+ const ignoredKeysFromConfig = this.core.config.bot.interactions.ignoreCustomIds;
827
+ if (ignoredKeysFromConfig) {
828
+ for (const ignoredKey of ignoredKeysFromConfig) this.keysToIgnore.add(ignoredKey);
829
+ }
819
830
  }
820
831
  async init() {
821
832
  if (this.isInitialized) return;
@@ -1234,6 +1245,7 @@ _ts_decorate4([
1234
1245
  envapt.Envapt("UNKNOWN_EXCEPTION_WEBHOOK_URL", {
1235
1246
  converter(raw, _fallback) {
1236
1247
  if (!raw) throw new Error("Missing UNKNOWN_EXCEPTION_WEBHOOK_URL");
1248
+ if (!URL.canParse(String(raw))) throw new Error("Invalid UNKNOWN_EXCEPTION_WEBHOOK_URL");
1237
1249
  return raw;
1238
1250
  }
1239
1251
  }),
@@ -1327,7 +1339,7 @@ var EffectsRegistry = class extends Plugin {
1327
1339
  core;
1328
1340
  logger = new services.Logger("Effects");
1329
1341
  isInitialized = false;
1330
- effectsMap = /* @__PURE__ */ new Map();
1342
+ effectsMap = new discord_js.Collection();
1331
1343
  emitter = new EffectsEmitter();
1332
1344
  constructor(core) {
1333
1345
  super(core), this.core = core;