apexify.js 1.2.8 → 2.1.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.
@@ -44,10 +44,10 @@ var prefixRegister_1 = require("./prefixRegister");
44
44
  var slashResponder_1 = require("./slashResponder");
45
45
  var prefixResponder_1 = require("./prefixResponder");
46
46
  var riffy_1 = require("riffy");
47
- var mongoDB_1 = require("../../database/MongoDB.js");
47
+ var mongoDB_1 = require("../../database/MongoDB");
48
48
  var start_1 = require("../discord-build/commands-(prefix)/music/functions/start");
49
49
  var end_1 = require("../discord-build/commands-(prefix)/music/functions/end");
50
- var buttons_1 = require("../discord-build/commands-(prefix)/music/functions/buttons.js");
50
+ var buttons_1 = require("../discord-build/commands-(prefix)/music/functions/buttons");
51
51
  var axios_1 = require("axios");
52
52
  var fs_1 = require("fs");
53
53
  var express_1 = require("express");
@@ -78,15 +78,15 @@ function typeSentence(sentence, speed) {
78
78
  });
79
79
  }
80
80
  function starter(client, options) {
81
- var _a, _b, _c, _d;
81
+ var _a, _b, _c, _d, _e, _f;
82
82
  if (options === void 0) { options = {}; }
83
83
  return __awaiter(this, void 0, void 0, function () {
84
- var logChannels_1, port_1, hostname_1, app, nodes, searchPlateForm, restVersion, error_1;
84
+ var logChannels_1, port_1, hostname_1, app, nodes, searchPlateForm, restVersion, error_1, webhookClient_1;
85
85
  var _this = this;
86
- return __generator(this, function (_e) {
87
- switch (_e.label) {
86
+ return __generator(this, function (_g) {
87
+ switch (_g.label) {
88
88
  case 0:
89
- _e.trys.push([0, 3, , 4]);
89
+ _g.trys.push([0, 3, , 4]);
90
90
  if (!client) {
91
91
  throw new Error('\x1b[31mMissing client parameter. Please provide a valid Discord client.\x1b[0m');
92
92
  }
@@ -94,15 +94,15 @@ function starter(client, options) {
94
94
  return [4 /*yield*/, client.login(options.token)
95
95
  .then(function () {
96
96
  var _a;
97
- typeSentence("\u001B[32mBot ".concat((_a = client.user) === null || _a === void 0 ? void 0 : _a.tag, " is online! \u001B[0m"), 20);
97
+ typeSentence("\u001B[32mBot ".concat((_a = client.user) === null || _a === void 0 ? void 0 : _a.tag, " is online! \u001B[0m"), 50);
98
98
  })
99
99
  .catch(function (error) {
100
100
  typeSentence('\x1b[31mError: Invalid token provided. Please provide a valid bot token.\x1b[0m', 50);
101
101
  process.exit(1);
102
102
  })];
103
103
  case 1:
104
- _e.sent();
105
- _e.label = 2;
104
+ _g.sent();
105
+ _g.label = 2;
106
106
  case 2:
107
107
  logChannels_1 = {
108
108
  slash: ((_a = options.slashCommandPath) === null || _a === void 0 ? void 0 : _a.logsId) || null,
@@ -184,14 +184,14 @@ function starter(client, options) {
184
184
  if (!options.botAvatar) return [3 /*break*/, 18];
185
185
  avatarData = void 0;
186
186
  if (!options.botAvatar.startsWith('http')) return [3 /*break*/, 14];
187
- return [4 /*yield*/, axios_1.get(options.botAvatar, {
187
+ return [4 /*yield*/, axios_1.default.get(options.botAvatar, {
188
188
  responseType: 'arraybuffer',
189
189
  })];
190
190
  case 13:
191
191
  response = _e.sent();
192
192
  avatarData = Buffer.from(response.data, 'binary');
193
193
  return [3 /*break*/, 16];
194
- case 14: return [4 /*yield*/, fs_1.promises.readFile(options.botAvatar)];
194
+ case 14: return [4 /*yield*/, fs_1.default.promises.readFile(options.botAvatar)];
195
195
  case 15:
196
196
  avatarData = _e.sent();
197
197
  _e.label = 16;
@@ -241,7 +241,7 @@ function starter(client, options) {
241
241
  if (options.webView) {
242
242
  port_1 = options.webView.port || 3000;
243
243
  hostname_1 = options.webView.hostname || 'localhost';
244
- app = (0, express_1)();
244
+ app = (0, express_1.default)();
245
245
  if (options.webView.middleware) {
246
246
  options.webView.middleware(app);
247
247
  }
@@ -287,7 +287,7 @@ function starter(client, options) {
287
287
  client.riffy.on('trackStart', function (player, track) { return __awaiter(_this, void 0, void 0, function () {
288
288
  return __generator(this, function (_a) {
289
289
  switch (_a.label) {
290
- case 0: return [4 /*yield*/, (0, start_1)(client, player, track)];
290
+ case 0: return [4 /*yield*/, (0, start_1.default)(client, player, track)];
291
291
  case 1:
292
292
  _a.sent();
293
293
  return [2 /*return*/];
@@ -297,7 +297,7 @@ function starter(client, options) {
297
297
  client.riffy.on('queueEnd', function (player) { return __awaiter(_this, void 0, void 0, function () {
298
298
  return __generator(this, function (_a) {
299
299
  switch (_a.label) {
300
- case 0: return [4 /*yield*/, (0, end_1)(client, player)];
300
+ case 0: return [4 /*yield*/, (0, end_1.default)(client, player)];
301
301
  case 1:
302
302
  _a.sent();
303
303
  return [2 /*return*/];
@@ -307,7 +307,7 @@ function starter(client, options) {
307
307
  client.on('interactionCreate', function (interaction) { return __awaiter(_this, void 0, void 0, function () {
308
308
  return __generator(this, function (_a) {
309
309
  if (interaction.isButton()) {
310
- (0, buttons_1)(interaction);
310
+ (0, buttons_1.default)(interaction);
311
311
  }
312
312
  return [2 /*return*/];
313
313
  });
@@ -323,10 +323,79 @@ function starter(client, options) {
323
323
  }
324
324
  return [3 /*break*/, 4];
325
325
  case 3:
326
- error_1 = _e.sent();
327
- typeSentence("Error in starter function: ".concat(error_1.message), 50);
326
+ error_1 = _g.sent();
327
+ typeSentence("Error in start function: ".concat(error_1.message), 50);
328
328
  return [3 /*break*/, 4];
329
- case 4: return [2 /*return*/];
329
+ case 4:
330
+ if ((_e = options.antiCrash) === null || _e === void 0 ? void 0 : _e.enabled) {
331
+ process.on('uncaughtException', function (error, origin) { return __awaiter(_this, void 0, void 0, function () {
332
+ var fileNameMatch, fileName, embed, error_4;
333
+ var _a, _b, _c, _d, _e;
334
+ return __generator(this, function (_f) {
335
+ switch (_f.label) {
336
+ case 0:
337
+ fileNameMatch = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.match(/at .* \((.*):\d+:\d+\)/);
338
+ fileName = fileNameMatch ? fileNameMatch[1] : 'Unknown File';
339
+ console.error('Uncaught exception:', error, 'origin:', origin);
340
+ if (!((_b = options.antiCrash) === null || _b === void 0 ? void 0 : _b.webhookURL)) return [3 /*break*/, 4];
341
+ if (!((_c = options.antiCrash) === null || _c === void 0 ? void 0 : _c.webhookURL)) return [3 /*break*/, 4];
342
+ _f.label = 1;
343
+ case 1:
344
+ _f.trys.push([1, 3, , 4]);
345
+ webhookClient_1 = new discord_js_1.WebhookClient({ url: (_d = options.antiCrash) === null || _d === void 0 ? void 0 : _d.webhookURL });
346
+ embed = new discord_js_1.EmbedBuilder()
347
+ .setTitle('Uncaught Exception Monitor')
348
+ .setDescription("**File:** `".concat(fileName, "`\n**Error:** `").concat(error.message, "`\n**Stack Trace:** ```").concat(error.stack, "```"))
349
+ .setColor('Red')
350
+ .setTimestamp();
351
+ return [4 /*yield*/, webhookClient_1.send({ content: "<@".concat((_e = options.antiCrash) === null || _e === void 0 ? void 0 : _e.userToMention, ">"), embeds: [embed] })];
352
+ case 2:
353
+ _f.sent();
354
+ return [3 /*break*/, 4];
355
+ case 3:
356
+ error_4 = _f.sent();
357
+ console.error(error_4.message);
358
+ return [3 /*break*/, 4];
359
+ case 4: return [2 /*return*/];
360
+ }
361
+ });
362
+ }); });
363
+ process.on('uncaughtExceptionMonitor', function (err, origin) { return __awaiter(_this, void 0, void 0, function () {
364
+ var fileNameMatch, fileName, embed, error_5;
365
+ var _a, _b, _c, _d;
366
+ return __generator(this, function (_e) {
367
+ switch (_e.label) {
368
+ case 0:
369
+ console.error('Uncaught exception monitored:', err, 'origin:', origin);
370
+ fileNameMatch = (_a = err.stack) === null || _a === void 0 ? void 0 : _a.match(/at .* \((.*):\d+:\d+\)/);
371
+ fileName = fileNameMatch ? fileNameMatch[1] : 'Unknown File';
372
+ if (!((_b = options.antiCrash) === null || _b === void 0 ? void 0 : _b.webhookURL)) return [3 /*break*/, 4];
373
+ _e.label = 1;
374
+ case 1:
375
+ _e.trys.push([1, 3, , 4]);
376
+ webhookClient_1 = new discord_js_1.WebhookClient({ url: (_c = options.antiCrash) === null || _c === void 0 ? void 0 : _c.webhookURL });
377
+ embed = new discord_js_1.EmbedBuilder()
378
+ .setTitle('Uncaught Exception Monitor')
379
+ .setDescription("**File:** `".concat(fileName, "`\n**Error:** `").concat(err.message, "`\n**Stack Trace:** ```").concat(err.stack, "```"))
380
+ .setColor('Red')
381
+ .setTimestamp();
382
+ return [4 /*yield*/, webhookClient_1.send({ content: "<@".concat((_d = options.antiCrash) === null || _d === void 0 ? void 0 : _d.userToMention, ">"), embeds: [embed] })];
383
+ case 2:
384
+ _e.sent();
385
+ return [3 /*break*/, 4];
386
+ case 3:
387
+ error_5 = _e.sent();
388
+ console.error(error_5.message);
389
+ return [3 /*break*/, 4];
390
+ case 4: return [2 /*return*/];
391
+ }
392
+ });
393
+ }); });
394
+ if ((_f = options.antiCrash) === null || _f === void 0 ? void 0 : _f.autoFix) {
395
+ throw new Error("Please disable autoFix. The current code is not functioning correctly, but it will be addressed soon. Enabling autoFix will automatically resolve anticrash errors in future updates.");
396
+ }
397
+ }
398
+ return [2 /*return*/];
330
399
  }
331
400
  });
332
401
  });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.typeWriter
18
+ var utils_1 = require("./discord/type-writer");
19
+ Object.defineProperty(exports, "typeWriter", { enumerable: true, get: function () { return utils_1.typeWriter; } });
package/lib/utils.js CHANGED
@@ -66,7 +66,7 @@ Object.defineProperty(exports, "resumeCommand", { enumerable: true, get: functio
66
66
  Object.defineProperty(exports, "previousCommand", { enumerable: true, get: function () { return utils_1.previousCommand; } });
67
67
  var starter_1 = require("./discord/events/starter");
68
68
  Object.defineProperty(exports, "starter", { enumerable: true, get: function () { return starter_1.starter; } });
69
- var utils_2 = require("./general-functions/discord/type-writer");
69
+ var utils_2 = require("./general-functions/utils");
70
70
  Object.defineProperty(exports, "typeWriter", { enumerable: true, get: function () { return utils_2.typeWriter; } });
71
71
  var utils_4 = require("./database/utils");
72
72
  Object.defineProperty(exports, "save", { enumerable: true, get: function () { return utils_4.save; } });
package/package.json CHANGED
@@ -1,12 +1,52 @@
1
1
  {
2
2
  "name": "apexify.js",
3
- "version": "1.2.8",
4
- "description": "",
3
+ "version": "2.1.0",
4
+ "description": "Ai with Canvas and Database library. Supports typescript and javascript",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "keywords": [
10
+ "JSON",
11
+ "SQL",
12
+ "CSV",
13
+ "XLSX",
14
+ "database",
15
+ "lightweight",
16
+ "database",
17
+ "data",
18
+ "storage",
19
+ "data",
20
+ "management",
21
+ "NoSQL",
22
+ "JSON",
23
+ "files",
24
+ "database",
25
+ "package",
26
+ "Node.js",
27
+ "data",
28
+ "persistence",
29
+ "data",
30
+ "manipulation",
31
+ "CRUD",
32
+ "operations",
33
+ "document-oriented",
34
+ "data",
35
+ "handling",
36
+ "key-value",
37
+ "store",
38
+ "schema",
39
+ "database",
40
+ "solution",
41
+ "data",
42
+ "modeling",
43
+ "JSON",
44
+ "storage",
45
+ "data",
46
+ "querying",
47
+ "jsonverse",
48
+ "jsonverse",
49
+ "db.",
10
50
  "discord.js",
11
51
  "discord",
12
52
  "pdf reader",
@@ -88,15 +128,16 @@
88
128
  "open-ai"
89
129
  ],
90
130
  "author": "zenith-79",
91
- "license": "ISC",
131
+ "license": "MIT",
92
132
  "dependencies": {
93
133
  "@iamtraction/google-translate": "^2.0.1",
94
134
  "@napi-rs/canvas": "^0.1.51",
95
135
  "@types/node": "^18.0.6",
96
- "api": "^6.1.1",
136
+ "api": "^2.6.0",
137
+ "archiver": "^7.0.0",
97
138
  "ascii-table": "^0.0.9",
98
139
  "axios": "^1.6.7",
99
- "crypto-browserify": "^3.12.0",
140
+ "crypto": "^1.0.1",
100
141
  "express": "^4.18.3",
101
142
  "form-data": "^4.0.0",
102
143
  "gifencoder": "^2.0.1",
@@ -104,6 +145,7 @@
104
145
  "jimp": "^0.22.12",
105
146
  "mongodb": "^6.4.0",
106
147
  "pdf-parse": "^1.1.1",
148
+ "phin": "^3.7.0",
107
149
  "riffy": "^1.0.3",
108
150
  "sharp": "^0.33.2",
109
151
  "stream": "^0.0.2",