diskernel 0.1.24 → 0.1.25

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAMpC,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAWjD,qBAAa,IAAK,SAAQ,IAAI;IAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAiC;IAEtD,WAAkB,MAAM,IAAI,MAAM,GAAG,SAAS,CAM7C;WAEmB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;WAsD5B,IAAI,IAAI,IAAI;CAS3B"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAMpC,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAWjD,qBAAa,IAAK,SAAQ,IAAI;IAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAiC;IAEtD,WAAkB,MAAM,IAAI,MAAM,GAAG,SAAS,CAM7C;WAEmB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;WAoD5B,IAAI,IAAI,IAAI;CAS3B"}
@@ -43,18 +43,18 @@ export class Core extends core {
43
43
  Logger.error("❌ Failed to login to Discord.");
44
44
  ErrorHandler.fatal("Failed to login to Discord", e);
45
45
  });
46
- this.client.once("clientReady", () => {
46
+ this.client.once("clientReady", async () => {
47
47
  Logger.info(`✅ Logged in as ${Core.client.user?.tag}`);
48
+ Logger.info("▶ Initializing commands...");
49
+ await Command.initialize();
50
+ Logger.info("✅ Commands initialized successfully.");
51
+ Logger.info("▶ Initializing events...");
52
+ if (!this.client) {
53
+ throw new DiskernelError("Discord client is not initialized before events.");
54
+ }
55
+ await Event.initalize(this.client);
56
+ Logger.info("✅ Events initialized successfully.");
48
57
  });
49
- Logger.info("▶ Initializing commands...");
50
- await Command.initialize();
51
- Logger.info("✅ Commands initialized successfully.");
52
- Logger.info("▶ Initializing events...");
53
- if (!this.client) {
54
- throw new DiskernelError("Discord client is not initialized before events.");
55
- }
56
- await Event.initalize(this.client);
57
- Logger.info("✅ Events initialized successfully.");
58
58
  }
59
59
  static stop() {
60
60
  Logger.info("▶ Stopping Bot...");
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/core/command.ts"],"names":[],"mappings":"AAqBA,OAAO,EAML,OAAO,IAAI,OAAO,EAGnB,MAAM,mBAAmB,CAAC;AAI3B,qBAAa,OAAQ,SAAQ,OAAO;IAClC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAC5C,OAAO,CAAC,MAAM,CAAC,OAAO,CAGlB;IACJ,OAAO,CAAC,MAAM,CAAC,WAAW,CAIjB;IACT,OAAO,CAAC,MAAM,CAAC,QAAQ,CAGnB;WAEgB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;mBAmC1B,kBAAkB;IA0GvC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAyDlC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC,OAAO,CAAC,MAAM,CAAC,aAAa;mBA8EP,mBAAmB;mBAqBnB,gBAAgB;IA0CrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAkC/B,OAAO,CAAC,MAAM,CAAC,sBAAsB;IA6BrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBA6BV,oBAAoB;mBA6BpB,qBAAqB;mBA2BrB,eAAe;mBA6Bf,cAAc;CA4HpC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/core/command.ts"],"names":[],"mappings":"AAqBA,OAAO,EAML,OAAO,IAAI,OAAO,EAGnB,MAAM,mBAAmB,CAAC;AAI3B,qBAAa,OAAQ,SAAQ,OAAO;IAClC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAC5C,OAAO,CAAC,MAAM,CAAC,OAAO,CAGlB;IACJ,OAAO,CAAC,MAAM,CAAC,WAAW,CAIjB;IACT,OAAO,CAAC,MAAM,CAAC,QAAQ,CAGnB;WAEgB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;mBA0C1B,kBAAkB;IA0GvC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAyDlC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC,OAAO,CAAC,MAAM,CAAC,aAAa;mBA8EP,mBAAmB;mBAqBnB,gBAAgB;IA6CrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAkC/B,OAAO,CAAC,MAAM,CAAC,sBAAsB;IA6BrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBA6BV,oBAAoB;mBA6BpB,qBAAqB;mBA2BrB,eAAe;mBA6Bf,cAAc;CA4HpC"}
@@ -18,7 +18,14 @@ export class Command extends command {
18
18
  this.subCommands = [];
19
19
  this.cooldown = new Map();
20
20
  this.client = Core.Client;
21
- await this.registerCommands();
21
+ if (this.client?.isReady()) {
22
+ await this.registerCommands();
23
+ }
24
+ else {
25
+ this.client?.once("ready", async () => {
26
+ await this.registerCommands();
27
+ });
28
+ }
22
29
  this.client?.on("interactionCreate", (interaction) => {
23
30
  if (interaction.isChatInputCommand() ||
24
31
  interaction.isContextMenuCommand() ||
@@ -276,11 +283,12 @@ export class Command extends command {
276
283
  })();
277
284
  if (!commands)
278
285
  return false;
279
- const guilds = this.client.guilds.cache.values();
286
+ const guilds = Array.from(this.client.guilds.cache.values());
287
+ Logger.debug(`Current guild cache size: ${this.client.guilds.cache.size}`);
280
288
  for (const guild of guilds) {
281
289
  await this.registerWithGuildID(guild.id, commands.guild);
282
- if (guilds.toArray().length < 10) {
283
- setTimeout(() => { }, 1000);
290
+ if (guilds.length > 10) {
291
+ await new Promise((resolve) => setTimeout(resolve, 1000));
284
292
  }
285
293
  }
286
294
  if (commands.global.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diskernel",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],