xernerx 3.2.2 → 3.2.6

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.
@@ -8,6 +8,7 @@ export declare class Handler {
8
8
  #private;
9
9
  client: XernerxClient;
10
10
  commands: object[];
11
+ readyTimestamp: number;
11
12
  constructor(client: XernerxClient);
12
13
  /**
13
14
  * @description - The loader for the message commands.
@@ -10,9 +10,11 @@ import { Style } from 'dumfunctions';
10
10
  export class Handler {
11
11
  client;
12
12
  commands;
13
+ readyTimestamp;
13
14
  constructor(client) {
14
15
  this.client = client;
15
16
  this.commands = [];
17
+ this.readyTimestamp = Number(Date.now());
16
18
  }
17
19
  /**
18
20
  * @description - The loader for the message commands.
@@ -29,6 +31,7 @@ export class Handler {
29
31
  clientPermissions: s.array(s.bigint).default([]),
30
32
  handleEdits: s.boolean.default(false),
31
33
  handleDeletes: s.boolean.default(false),
34
+ handleTyping: s.boolean.default(false),
32
35
  logging: s.boolean.default(false),
33
36
  })
34
37
  .parse(options);
@@ -37,7 +40,7 @@ export class Handler {
37
40
  this.#load(options.directory, file, CommandType.MessageCommand);
38
41
  loaded.push(file.replace(".js", ""));
39
42
  }
40
- if (this.client.handlerOptions.message.logging)
43
+ if (this.client.handlerOptions.message?.logging)
41
44
  console.info(Style.log(`Xernerx | Loaded ${loaded.length} message commands: ${loaded.join(", ")}.`, { color: Style.TextColor.Cyan }));
42
45
  }
43
46
  /**
@@ -66,7 +69,7 @@ export class Handler {
66
69
  this.#load(options.directory, file, CommandType.SlashCommand);
67
70
  loaded.push(file.replace(".js", ""));
68
71
  }
69
- if (this.client.handlerOptions.slash.logging)
72
+ if (this.client.handlerOptions.slash?.logging)
70
73
  console.info(Style.log(`Xernerx | Loaded ${loaded.length} slash commands: ${loaded.join(", ")}.`, { color: Style.TextColor.Cyan }));
71
74
  }
72
75
  /**
@@ -95,7 +98,7 @@ export class Handler {
95
98
  this.#load(options.directory, file, CommandType.ContextCommand);
96
99
  loaded.push(file.replace(".js", ""));
97
100
  }
98
- if (this.client.handlerOptions.context.logging)
101
+ if (this.client.handlerOptions.context?.logging)
99
102
  console.info(Style.log(`Xernerx | Loaded ${loaded.length} context commands: ${loaded.join(", ")}.`, { color: Style.TextColor.Cyan }));
100
103
  }
101
104
  /**
@@ -10,6 +10,7 @@ export interface MessageCommandOptions {
10
10
  clientPermissions?: bigint[];
11
11
  handleEdits?: boolean;
12
12
  handleDeletes?: boolean;
13
+ handleTyping?: boolean;
13
14
  util?: boolean;
14
15
  logging?: boolean;
15
16
  }
package/dist/main.js CHANGED
@@ -8,7 +8,8 @@ import { ContextCommand } from "./build/ContextCommand.js";
8
8
  import { SlashCommand } from "./build/SlashCommand.js";
9
9
  import { CommandType, EventEmitterType, ContextCommandType } from "./types/Types.js";
10
10
  import { InhibitorType } from "./types/InhibitorTypes.js";
11
- const version = "3.1.4";
11
+ import pkg from "../package.js";
12
+ const version = pkg.version;
12
13
  export default {
13
14
  // Imported methods
14
15
  Discord,
@@ -13,6 +13,8 @@ export class MessageCommandEvents {
13
13
  this.client.on("messageCreate", async (message) => {
14
14
  if (!message.author.bot) {
15
15
  let command = undefined, px = undefined;
16
+ if (this.client.handlerOptions.message?.handleTyping)
17
+ message.channel.sendTyping();
16
18
  message.author.isOwner = this.client.util.isOwner(message.author.id);
17
19
  message.util = new MessageCommandUtil(this.client, message);
18
20
  const commands = this.client.commands.message;
@@ -89,6 +91,8 @@ export class MessageCommandEvents {
89
91
  message = message; // could just do this
90
92
  if (!message.author?.bot) {
91
93
  let command = undefined, px = undefined;
94
+ if (this.client.handlerOptions.message?.handleTyping)
95
+ message.channel.sendTyping();
92
96
  if (message.author)
93
97
  message.author.isOwner = this.client.util.isOwner(message.author.id);
94
98
  message.util = new MessageCommandUtil(this.client, message);
@@ -165,6 +169,8 @@ export class MessageCommandEvents {
165
169
  this.client.on("messageDelete", async (message) => {
166
170
  if (this.client.cache.messages.has(message.id) &&
167
171
  this.client.handlerOptions.message?.handleDeletes) {
172
+ if (this.client.handlerOptions.message?.handleTyping)
173
+ message.channel.sendTyping();
168
174
  try {
169
175
  const msg = this.client.cache.messages.get(message.id);
170
176
  const response = await message.channel.messages.fetch(msg?.response);
@@ -8,19 +8,11 @@ export default class Extensions {
8
8
  const exts = [];
9
9
  extensions.map(extension => {
10
10
  try {
11
- try {
12
- this.client.extensions[extension.name] = new extension(this.client, logging);
13
- }
14
- catch {
15
- extension = extension.default;
16
- this.client.extensions[extension.name] = new extension(this.client, logging);
17
- }
18
- finally {
19
- exts.push(extension?.name || extension?.default?.name);
20
- }
11
+ this.client.extensions[extension.name] = extension;
12
+ exts.push(extension.name);
21
13
  }
22
14
  catch (error) {
23
- console.error(Style.log(`Xernerx | An error occurred loading the extension ${extension?.name || extension?.default?.name}, error:<${error}>`, { color: Style.BackgroundColor.Red }));
15
+ console.error(Style.log(`Xernerx | An error occurred trying to load ${extension.name}, error: <${error}>`, { color: Style.BackgroundColor.Red }));
24
16
  }
25
17
  });
26
18
  if (logging)
package/package.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default pkg;
package/package.js ADDED
@@ -0,0 +1,3 @@
1
+ import pkg from "./package.json" assert {type: 'json'};
2
+
3
+ export default pkg;
package/package.json CHANGED
@@ -1,22 +1,31 @@
1
1
  {
2
- "type": "module",
3
2
  "name": "xernerx",
4
- "version": "3.2.2",
5
- "description": "A bot framework for discord.js. [BETA]",
3
+ "version": "3.2.6",
4
+ "type": "module",
5
+ "description": "A bot framework for discord.js.",
6
6
  "main": "dist/main.js",
7
+ "keywords": [
8
+ "discord.js",
9
+ "discord",
10
+ "framework"
11
+ ],
12
+ "author": "Dummi",
13
+ "license": "MIT",
14
+ "homepage": "https://thedummi.github.io/xernerx/home.html",
15
+ "packageManager": "npm@8.5.5",
7
16
  "scripts": {
8
- "test": "echo Setup a bot then start the bot."
17
+ "checks": "npm i && npm fund && npm audit fix --force && npm link && tsc -w",
18
+ "patch": "git add . && git commit -m \"Version Patch\" && npm version patch && npm publish && git push",
19
+ "minor": "git add . && git commit -m \"Version Upgrade\" && npm version minor && npm publish && git push",
20
+ "major": "git add . && git commit -m \"Version Rewrite\" && npm version major && npm publish && git push"
9
21
  },
10
22
  "repository": {
11
23
  "type": "git",
12
24
  "url": "git+https://github.com/TheDummi/xernerx.git"
13
25
  },
14
- "author": "Dummi",
15
- "license": "MIT",
16
26
  "bugs": {
17
27
  "url": "https://github.com/TheDummi/xernerx/issues"
18
28
  },
19
- "homepage": "https://github.com/TheDummi/xernerx#readme",
20
29
  "dependencies": {
21
30
  "@sapphire/shapeshift": "^3.7.1",
22
31
  "@top-gg/sdk": "^3.1.3",
@@ -25,8 +34,8 @@
25
34
  "express": "^4.18.2",
26
35
  "topgg-autoposter": "^2.0.1"
27
36
  },
28
- "packageManager": "npm@8.5.5",
29
37
  "devDependencies": {
30
- "@types/express": "^4.17.15"
38
+ "@types/express": "^4.17.15",
39
+ "typescript": "^4.9.4"
31
40
  }
32
41
  }