xernerx 2.2.0 → 2.4.1

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/models/Client.js CHANGED
@@ -66,10 +66,10 @@ class Client extends Discord.Client {
66
66
  reply: options?.defer?.reply === undefined ? null : options?.defer?.reply,
67
67
  ephemeral: options?.defer?.ephemeral === undefined ? null : options?.defer?.ephemeral
68
68
  },
69
-
70
- language: options.language
71
69
  }
72
70
 
71
+ this.client.language = options.language;
72
+
73
73
  this.client.color = color({ client: this.client, options: options });
74
74
 
75
75
  this.client.config = config({ client: this.client, options: options });
@@ -181,6 +181,25 @@ function buttonPaginator(interaction, embeds, options = {}) {
181
181
  })();
182
182
  }
183
183
 
184
+ function uptime(interaction, timestamp) {
185
+ if (!timestamp) timestamp = interaction.client.uptime;
186
+ let totalSeconds = timestamp / 1000;
187
+ let years = Math.floor(totalSeconds / 31536000);
188
+ totalSeconds %= 31536000;
189
+ let days = Math.floor(totalSeconds / 86400);
190
+ totalSeconds %= 86400;
191
+ let hours = Math.floor(totalSeconds / 3600);
192
+ totalSeconds %= 3600;
193
+ let minutes = Math.floor(totalSeconds / 60);
194
+ let seconds = Math.floor(totalSeconds % 60);
195
+
196
+ if (years >= 1) return `${years}y ${days}d ${hours}h ${minutes}m`
197
+ else if (days >= 1) return `${days}d ${hours}h ${minutes}m`;
198
+ else if (hours >= 1) return `${hours}h ${minutes}m`;
199
+ else if (minutes >= 1) return `${minutes}m ${seconds}s`;
200
+ else return `${seconds}s`;
201
+ }
202
+
184
203
  class Util {
185
204
  async messageUtil(message, type) {
186
205
  setTimeout(() => {
@@ -197,6 +216,8 @@ class Util {
197
216
 
198
217
  message.util.commandName = (command) => commandName(message, command);
199
218
 
219
+ message.util.uptime = (timestamp) => uptime(message, timestamp);
220
+
200
221
  if (type == "create") {
201
222
  message.client.messages[message.id] = null;
202
223
 
@@ -276,6 +297,8 @@ class Util {
276
297
  interaction.util.buttonPaginator = (embeds, options) => buttonPaginator(interaction, embeds, options);
277
298
 
278
299
  interaction.util.commandName = (command) => commandName(interaction, command);
300
+
301
+ interaction.util.uptime = (timestamp) => uptime(interaction, timestamp);
279
302
  }
280
303
  }
281
304
 
@@ -6,7 +6,8 @@ class LanguageHandler {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
 
9
- i.init(this.client.settings.language)
9
+
10
+ i.init(this.client.language)
10
11
 
11
12
  this.client.languages = []
12
13
  }
@@ -19,7 +20,7 @@ class LanguageHandler {
19
20
  for (const file of languages) {
20
21
  const language = require(`${require("path").resolve(path)}/${file}`);
21
22
 
22
- i.addResourceBundle(file.replace('.json', ""), this.ns, language, deep, overwrite)
23
+ i.addResourceBundle(file.replace('.json', ""), this.client.language.ns, language, deep, overwrite);
23
24
 
24
25
  this.client.languages.push(file.replace('.json', ""));
25
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "2.2.0",
3
+ "version": "2.4.1",
4
4
  "description": "A bot framework for discord.js. [BETA]",
5
5
  "main": "main.js",
6
6
  "scripts": {