trivious 1.3.12 → 1.3.14
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/{esm/index.js → index.cjs} +166 -122
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +124 -162
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/index.js.map +0 -1
|
@@ -1,18 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
11
32
|
|
|
12
33
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
|
|
13
34
|
var require_package = __commonJS({
|
|
14
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(
|
|
15
|
-
|
|
35
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports2, module2) {
|
|
36
|
+
module2.exports = {
|
|
16
37
|
name: "dotenv",
|
|
17
38
|
version: "17.2.3",
|
|
18
39
|
description: "Loads environment variables from .env file",
|
|
@@ -79,12 +100,12 @@ var require_package = __commonJS({
|
|
|
79
100
|
|
|
80
101
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
|
|
81
102
|
var require_main = __commonJS({
|
|
82
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(
|
|
103
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
83
104
|
"use strict";
|
|
84
|
-
var fs6 =
|
|
85
|
-
var path2 =
|
|
86
|
-
var os =
|
|
87
|
-
var crypto =
|
|
105
|
+
var fs6 = require("fs");
|
|
106
|
+
var path2 = require("path");
|
|
107
|
+
var os = require("os");
|
|
108
|
+
var crypto = require("crypto");
|
|
88
109
|
var packageJson = require_package();
|
|
89
110
|
var version = packageJson.version;
|
|
90
111
|
var TIPS = [
|
|
@@ -396,20 +417,20 @@ var require_main = __commonJS({
|
|
|
396
417
|
parse,
|
|
397
418
|
populate
|
|
398
419
|
};
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
420
|
+
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
421
|
+
module2.exports._configVault = DotenvModule._configVault;
|
|
422
|
+
module2.exports._parseVault = DotenvModule._parseVault;
|
|
423
|
+
module2.exports.config = DotenvModule.config;
|
|
424
|
+
module2.exports.decrypt = DotenvModule.decrypt;
|
|
425
|
+
module2.exports.parse = DotenvModule.parse;
|
|
426
|
+
module2.exports.populate = DotenvModule.populate;
|
|
427
|
+
module2.exports = DotenvModule;
|
|
407
428
|
}
|
|
408
429
|
});
|
|
409
430
|
|
|
410
431
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js
|
|
411
432
|
var require_env_options = __commonJS({
|
|
412
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js"(
|
|
433
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js"(exports2, module2) {
|
|
413
434
|
"use strict";
|
|
414
435
|
var options = {};
|
|
415
436
|
if (process.env.DOTENV_CONFIG_ENCODING != null) {
|
|
@@ -430,16 +451,16 @@ var require_env_options = __commonJS({
|
|
|
430
451
|
if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
|
|
431
452
|
options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
|
|
432
453
|
}
|
|
433
|
-
|
|
454
|
+
module2.exports = options;
|
|
434
455
|
}
|
|
435
456
|
});
|
|
436
457
|
|
|
437
458
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js
|
|
438
459
|
var require_cli_options = __commonJS({
|
|
439
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js"(
|
|
460
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js"(exports2, module2) {
|
|
440
461
|
"use strict";
|
|
441
462
|
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
442
|
-
|
|
463
|
+
module2.exports = function optionMatcher(args) {
|
|
443
464
|
const options = args.reduce(function(acc, cur) {
|
|
444
465
|
const matches = cur.match(re);
|
|
445
466
|
if (matches) {
|
|
@@ -455,6 +476,31 @@ var require_cli_options = __commonJS({
|
|
|
455
476
|
}
|
|
456
477
|
});
|
|
457
478
|
|
|
479
|
+
// src/index.ts
|
|
480
|
+
var index_exports = {};
|
|
481
|
+
__export(index_exports, {
|
|
482
|
+
BaseRegistry: () => BaseRegistry,
|
|
483
|
+
ClientEvents: () => import_discord10.ClientEvents,
|
|
484
|
+
Collection: () => import_discord10.Collection,
|
|
485
|
+
Command: () => Command,
|
|
486
|
+
CommandBuilder: () => CommandBuilder,
|
|
487
|
+
CommandRegistry: () => CommandRegistry,
|
|
488
|
+
Component: () => Component,
|
|
489
|
+
ComponentBuilder: () => ComponentBuilder,
|
|
490
|
+
ComponentRegistry: () => ComponentRegistry,
|
|
491
|
+
ComponentType: () => ComponentType,
|
|
492
|
+
ContextMenuBuilder: () => ContextMenuBuilder,
|
|
493
|
+
ContextMenuCommand: () => ContextMenuCommand,
|
|
494
|
+
PermissionLevel: () => PermissionLevel,
|
|
495
|
+
SlashCommand: () => SlashCommand,
|
|
496
|
+
Subcommand: () => Subcommand,
|
|
497
|
+
SubcommandBuilder: () => SubcommandBuilder,
|
|
498
|
+
TriviousClient: () => TriviousClient,
|
|
499
|
+
deconstructCustomId: () => deconstructCustomId,
|
|
500
|
+
getPermissionLevel: () => getPermissionLevel
|
|
501
|
+
});
|
|
502
|
+
module.exports = __toCommonJS(index_exports);
|
|
503
|
+
|
|
458
504
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/config.js
|
|
459
505
|
(function() {
|
|
460
506
|
require_main().config(
|
|
@@ -467,16 +513,15 @@ var require_cli_options = __commonJS({
|
|
|
467
513
|
})();
|
|
468
514
|
|
|
469
515
|
// src/index.ts
|
|
470
|
-
|
|
516
|
+
var import_node_util = require("util");
|
|
471
517
|
|
|
472
518
|
// src/core/client/trivious.client.ts
|
|
473
|
-
|
|
519
|
+
var import_discord6 = require("discord.js");
|
|
474
520
|
|
|
475
521
|
// src/shared/utility/functions.ts
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
import { dirname } from "path";
|
|
522
|
+
var import_fs = require("fs");
|
|
523
|
+
var import_node_path = require("path");
|
|
524
|
+
var import_path2 = require("path");
|
|
480
525
|
|
|
481
526
|
// src/shared/typings/permissions.ts
|
|
482
527
|
var PermissionLevel = /* @__PURE__ */ ((PermissionLevel2) => {
|
|
@@ -495,16 +540,21 @@ var getPermissionLevel = (client, member) => {
|
|
|
495
540
|
return rolePermissions[highestRole.name] ?? 0 /* USER */;
|
|
496
541
|
};
|
|
497
542
|
|
|
543
|
+
// src/shared/utility/paths.ts
|
|
544
|
+
var import_url = require("url");
|
|
545
|
+
var import_path = require("path");
|
|
546
|
+
var import_meta = {};
|
|
547
|
+
var __filename = typeof _filename === "string" ? _filename : (0, import_url.fileURLToPath)(import_meta.url);
|
|
548
|
+
var __dirname = typeof _dirname === "string" ? _dirname : (0, import_path.dirname)(__filename);
|
|
549
|
+
|
|
498
550
|
// src/shared/utility/functions.ts
|
|
499
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
500
|
-
var __dirname = dirname(__filename);
|
|
501
551
|
var getPackageRoot = () => {
|
|
502
552
|
let dir = __dirname;
|
|
503
|
-
while (dir !== dirname(dir)) {
|
|
504
|
-
if (existsSync(join(dir, "package.json")) || existsSync(join(dir, "node_modules"))) {
|
|
553
|
+
while (dir !== (0, import_path2.dirname)(dir)) {
|
|
554
|
+
if ((0, import_fs.existsSync)((0, import_node_path.join)(dir, "package.json")) || (0, import_fs.existsSync)((0, import_node_path.join)(dir, "node_modules"))) {
|
|
505
555
|
return dir;
|
|
506
556
|
}
|
|
507
|
-
dir = dirname(dir);
|
|
557
|
+
dir = (0, import_path2.dirname)(dir);
|
|
508
558
|
}
|
|
509
559
|
return __dirname;
|
|
510
560
|
};
|
|
@@ -515,34 +565,34 @@ function getCorePath(options) {
|
|
|
515
565
|
return resolveUserPath(userPath);
|
|
516
566
|
}
|
|
517
567
|
const builtInCandidates = [
|
|
518
|
-
join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
519
|
-
join(FRAMEWORK_PACKAGE_ROOT, "dist", coreDirectory)
|
|
568
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
569
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "dist", coreDirectory)
|
|
520
570
|
];
|
|
521
571
|
for (const candidate of builtInCandidates) {
|
|
522
|
-
if (existsSync(candidate)) {
|
|
572
|
+
if ((0, import_fs.existsSync)(candidate)) {
|
|
523
573
|
return candidate;
|
|
524
574
|
}
|
|
525
575
|
}
|
|
526
|
-
return join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
576
|
+
return (0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
527
577
|
}
|
|
528
578
|
function resolveUserPath(relativePath) {
|
|
529
579
|
const candidates = [
|
|
530
|
-
join(process.cwd(), relativePath),
|
|
531
|
-
join(process.cwd(), "lib", relativePath),
|
|
532
|
-
join(process.cwd(), "dist", relativePath),
|
|
533
|
-
join(FRAMEWORK_PACKAGE_ROOT, relativePath),
|
|
534
|
-
join(FRAMEWORK_PACKAGE_ROOT, "lib", relativePath),
|
|
535
|
-
join(FRAMEWORK_PACKAGE_ROOT, "dist", relativePath)
|
|
580
|
+
(0, import_node_path.join)(process.cwd(), relativePath),
|
|
581
|
+
(0, import_node_path.join)(process.cwd(), "lib", relativePath),
|
|
582
|
+
(0, import_node_path.join)(process.cwd(), "dist", relativePath),
|
|
583
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, relativePath),
|
|
584
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", relativePath),
|
|
585
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "dist", relativePath)
|
|
536
586
|
];
|
|
537
587
|
for (const candidate of candidates) {
|
|
538
|
-
const full = resolve(candidate);
|
|
539
|
-
if (existsSync(full)) return full;
|
|
588
|
+
const full = (0, import_node_path.resolve)(candidate);
|
|
589
|
+
if ((0, import_fs.existsSync)(full)) return full;
|
|
540
590
|
}
|
|
541
|
-
return join(process.cwd(), relativePath);
|
|
591
|
+
return (0, import_node_path.join)(process.cwd(), relativePath);
|
|
542
592
|
}
|
|
543
593
|
async function exists(path2) {
|
|
544
594
|
try {
|
|
545
|
-
await
|
|
595
|
+
await import_fs.promises.access(path2);
|
|
546
596
|
return true;
|
|
547
597
|
} catch {
|
|
548
598
|
return false;
|
|
@@ -562,10 +612,10 @@ function hasPermission(client, options) {
|
|
|
562
612
|
}
|
|
563
613
|
|
|
564
614
|
// src/core/registry/command.registry.ts
|
|
565
|
-
|
|
615
|
+
var import_discord = require("discord.js");
|
|
566
616
|
|
|
567
617
|
// src/shared/typings/registry.ts
|
|
568
|
-
|
|
618
|
+
var import_url2 = require("url");
|
|
569
619
|
var BaseRegistry = class {
|
|
570
620
|
/**
|
|
571
621
|
* Get all of loaded T
|
|
@@ -586,7 +636,7 @@ var BaseRegistry = class {
|
|
|
586
636
|
*/
|
|
587
637
|
async importFile(filePath) {
|
|
588
638
|
try {
|
|
589
|
-
const { default: file } = await import(pathToFileURL(filePath).href);
|
|
639
|
+
const { default: file } = await import((0, import_url2.pathToFileURL)(filePath).href);
|
|
590
640
|
const imports = file.default ?? file;
|
|
591
641
|
if (!imports) return null;
|
|
592
642
|
if (typeof imports === "function" && imports.prototype) {
|
|
@@ -615,8 +665,8 @@ var BaseRegistry = class {
|
|
|
615
665
|
async clearCache(filePath) {
|
|
616
666
|
if (process.env.NODE_ENV === "production") return;
|
|
617
667
|
try {
|
|
618
|
-
const resvoled =
|
|
619
|
-
delete
|
|
668
|
+
const resvoled = require.resolve(filePath);
|
|
669
|
+
delete require.cache[resvoled];
|
|
620
670
|
} catch {
|
|
621
671
|
}
|
|
622
672
|
}
|
|
@@ -640,10 +690,10 @@ var deconstructCustomId = (customId) => {
|
|
|
640
690
|
};
|
|
641
691
|
|
|
642
692
|
// src/core/registry/command.registry.ts
|
|
643
|
-
|
|
644
|
-
|
|
693
|
+
var import_fs2 = require("fs");
|
|
694
|
+
var import_node_path2 = require("path");
|
|
645
695
|
var CommandRegistry = class extends BaseRegistry {
|
|
646
|
-
items = new Collection();
|
|
696
|
+
items = new import_discord.Collection();
|
|
647
697
|
/**
|
|
648
698
|
* Load all commands and their subcommands
|
|
649
699
|
*
|
|
@@ -655,12 +705,12 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
655
705
|
if (!await exists(directory)) {
|
|
656
706
|
return this;
|
|
657
707
|
}
|
|
658
|
-
const entries = await
|
|
708
|
+
const entries = await import_fs2.promises.readdir(directory, { withFileTypes: true });
|
|
659
709
|
for (const entry of entries) {
|
|
660
|
-
const fullPath =
|
|
710
|
+
const fullPath = (0, import_node_path2.join)(directory, entry.name);
|
|
661
711
|
if (!entry.isDirectory()) continue;
|
|
662
|
-
const indexFile =
|
|
663
|
-
const indexJs =
|
|
712
|
+
const indexFile = (0, import_node_path2.join)(fullPath, "index.ts");
|
|
713
|
+
const indexJs = (0, import_node_path2.join)(fullPath, "index.js");
|
|
664
714
|
let commandFile = "";
|
|
665
715
|
if (await exists(indexFile)) commandFile = indexFile;
|
|
666
716
|
else if (await exists(indexJs)) commandFile = indexJs;
|
|
@@ -669,13 +719,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
669
719
|
if (!command) continue;
|
|
670
720
|
if (!command.metadata.active) continue;
|
|
671
721
|
if (command.isSlashCommand()) {
|
|
672
|
-
const subcommandFiles = (await
|
|
722
|
+
const subcommandFiles = (await import_fs2.promises.readdir(fullPath)).filter(
|
|
673
723
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
674
724
|
);
|
|
675
725
|
for (const file of subcommandFiles) {
|
|
676
|
-
const subcommand = await this.importFile(
|
|
726
|
+
const subcommand = await this.importFile((0, import_node_path2.join)(fullPath, file));
|
|
677
727
|
if (!subcommand) continue;
|
|
678
|
-
if (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))
|
|
728
|
+
if (!subcommand.data.name || !(subcommand.data instanceof import_discord.SlashCommandSubcommandBuilder))
|
|
679
729
|
continue;
|
|
680
730
|
command.data.addSubcommand(subcommand.data);
|
|
681
731
|
command.metadata.subcommands.set(subcommand.data.name, subcommand);
|
|
@@ -688,11 +738,11 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
688
738
|
};
|
|
689
739
|
|
|
690
740
|
// src/core/registry/component.registry.ts
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
741
|
+
var import_discord2 = require("discord.js");
|
|
742
|
+
var import_fs3 = require("fs");
|
|
743
|
+
var import_node_path3 = require("path");
|
|
694
744
|
var ComponentRegistry = class extends BaseRegistry {
|
|
695
|
-
items = new
|
|
745
|
+
items = new import_discord2.Collection();
|
|
696
746
|
/**
|
|
697
747
|
* Load all components.
|
|
698
748
|
*
|
|
@@ -704,15 +754,15 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
704
754
|
if (!await exists(directory)) {
|
|
705
755
|
return this;
|
|
706
756
|
}
|
|
707
|
-
const entries = await
|
|
757
|
+
const entries = await import_fs3.promises.readdir(directory, { withFileTypes: true });
|
|
708
758
|
for (const entry of entries) {
|
|
709
|
-
const fullPath =
|
|
759
|
+
const fullPath = (0, import_node_path3.join)(directory, entry.name);
|
|
710
760
|
if (!entry.isDirectory()) continue;
|
|
711
|
-
const componentFiles = (await
|
|
761
|
+
const componentFiles = (await import_fs3.promises.readdir(fullPath)).filter(
|
|
712
762
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
713
763
|
);
|
|
714
764
|
for (const file of componentFiles) {
|
|
715
|
-
const component = await this.importFile(
|
|
765
|
+
const component = await this.importFile((0, import_node_path3.join)(fullPath, file));
|
|
716
766
|
if (!component) continue;
|
|
717
767
|
const { data } = deconstructCustomId(component.metadata.customId);
|
|
718
768
|
this.items.set(data, component);
|
|
@@ -723,12 +773,12 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
723
773
|
};
|
|
724
774
|
|
|
725
775
|
// src/core/registry/event.registry.ts
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
776
|
+
var import_discord4 = require("discord.js");
|
|
777
|
+
var import_fs4 = require("fs");
|
|
778
|
+
var import_node_path4 = require("path");
|
|
729
779
|
|
|
730
780
|
// src/core/events/interactionCreate.ts
|
|
731
|
-
|
|
781
|
+
var import_discord3 = require("discord.js");
|
|
732
782
|
var interactionCreate_default = {
|
|
733
783
|
name: "interactionCreate",
|
|
734
784
|
execute: async (client, interaction) => {
|
|
@@ -758,9 +808,9 @@ var interactionCreate_default = {
|
|
|
758
808
|
}
|
|
759
809
|
} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {
|
|
760
810
|
const { componentType, tags, data } = deconstructCustomId(interaction.customId);
|
|
761
|
-
if (componentType === "button" /* Button */ && !(interaction instanceof ButtonInteraction))
|
|
811
|
+
if (componentType === "button" /* Button */ && !(interaction instanceof import_discord3.ButtonInteraction))
|
|
762
812
|
return;
|
|
763
|
-
if (componentType === "modal" /* Modal */ && !(interaction instanceof ModalSubmitInteraction))
|
|
813
|
+
if (componentType === "modal" /* Modal */ && !(interaction instanceof import_discord3.ModalSubmitInteraction))
|
|
764
814
|
return;
|
|
765
815
|
if (tags.includes("awaited")) return;
|
|
766
816
|
const registeredComponents = client.registries.components.get();
|
|
@@ -787,7 +837,7 @@ var interactionCreate_default = {
|
|
|
787
837
|
|
|
788
838
|
// src/core/registry/event.registry.ts
|
|
789
839
|
var EventRegistry = class extends BaseRegistry {
|
|
790
|
-
items = new
|
|
840
|
+
items = new import_discord4.Collection();
|
|
791
841
|
/**
|
|
792
842
|
* Load all events.
|
|
793
843
|
*
|
|
@@ -797,9 +847,9 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
797
847
|
*/
|
|
798
848
|
async load(directory = getCorePath({ coreDirectory: "events" })) {
|
|
799
849
|
if (!await exists(directory)) return this;
|
|
800
|
-
const entries = await
|
|
850
|
+
const entries = await import_fs4.promises.readdir(directory, { withFileTypes: true });
|
|
801
851
|
for (const entry of entries) {
|
|
802
|
-
const fullPath =
|
|
852
|
+
const fullPath = (0, import_node_path4.join)(directory, entry.name);
|
|
803
853
|
if (entry.isDirectory()) {
|
|
804
854
|
await this.load(fullPath);
|
|
805
855
|
continue;
|
|
@@ -829,11 +879,11 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
829
879
|
};
|
|
830
880
|
|
|
831
881
|
// src/core/registry/module.registry.ts
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
882
|
+
var import_discord5 = require("discord.js");
|
|
883
|
+
var import_fs5 = require("fs");
|
|
884
|
+
var import_node_path5 = require("path");
|
|
835
885
|
var ModuleRegistry = class extends BaseRegistry {
|
|
836
|
-
items = new
|
|
886
|
+
items = new import_discord5.Collection();
|
|
837
887
|
/**
|
|
838
888
|
* Load all modules.
|
|
839
889
|
*
|
|
@@ -845,15 +895,15 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
845
895
|
if (!await exists(directory)) {
|
|
846
896
|
return this;
|
|
847
897
|
}
|
|
848
|
-
const entries = await
|
|
898
|
+
const entries = await import_fs5.promises.readdir(directory, { withFileTypes: true });
|
|
849
899
|
for (const entry of entries) {
|
|
850
|
-
const fullPath =
|
|
900
|
+
const fullPath = (0, import_node_path5.join)(directory, entry.name);
|
|
851
901
|
if (!entry.isDirectory()) continue;
|
|
852
|
-
const moduleFiles = (await
|
|
902
|
+
const moduleFiles = (await import_fs5.promises.readdir(fullPath)).filter(
|
|
853
903
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
854
904
|
);
|
|
855
905
|
for (const file of moduleFiles) {
|
|
856
|
-
const moduleEvent = await this.importFile(
|
|
906
|
+
const moduleEvent = await this.importFile((0, import_node_path5.join)(fullPath, file));
|
|
857
907
|
if (!moduleEvent || !moduleEvent.events) continue;
|
|
858
908
|
this.items.set(moduleEvent.name, moduleEvent);
|
|
859
909
|
}
|
|
@@ -879,7 +929,7 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
879
929
|
};
|
|
880
930
|
|
|
881
931
|
// src/core/registry/index.ts
|
|
882
|
-
|
|
932
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
883
933
|
var registries = () => ({
|
|
884
934
|
commands: new CommandRegistry(),
|
|
885
935
|
components: new ComponentRegistry(),
|
|
@@ -890,16 +940,16 @@ var registries = () => ({
|
|
|
890
940
|
const corePath = options.corePath;
|
|
891
941
|
await Promise.all([
|
|
892
942
|
this.commands.load(
|
|
893
|
-
corePath ? resolveUserPath(
|
|
943
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "commands")) : corePaths?.commandsPath ? resolveUserPath(corePaths.commandsPath) : void 0
|
|
894
944
|
),
|
|
895
945
|
this.components.load(
|
|
896
|
-
corePath ? resolveUserPath(
|
|
946
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "components")) : corePaths?.componentsPath ? resolveUserPath(corePaths.componentsPath) : void 0
|
|
897
947
|
),
|
|
898
948
|
this.events.load(
|
|
899
|
-
corePath ? resolveUserPath(
|
|
949
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "events")) : corePaths?.eventsPath ? resolveUserPath(corePaths.eventsPath) : void 0
|
|
900
950
|
),
|
|
901
951
|
this.modules.load(
|
|
902
|
-
corePath ? resolveUserPath(
|
|
952
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "modules")) : corePaths?.modulesPath ? resolveUserPath(corePaths.modulesPath) : void 0
|
|
903
953
|
)
|
|
904
954
|
]);
|
|
905
955
|
},
|
|
@@ -910,7 +960,7 @@ var registries = () => ({
|
|
|
910
960
|
});
|
|
911
961
|
|
|
912
962
|
// src/core/client/trivious.client.ts
|
|
913
|
-
var TriviousClient = class extends Client {
|
|
963
|
+
var TriviousClient = class extends import_discord6.Client {
|
|
914
964
|
/**
|
|
915
965
|
* Client registries.
|
|
916
966
|
*
|
|
@@ -975,8 +1025,8 @@ var TriviousClient = class extends Client {
|
|
|
975
1025
|
if (!clientId || !token) throw new Error("[Trivious] Invalid clientId or token reference");
|
|
976
1026
|
const slashCommands = Array.from(this.registries.commands.get().values());
|
|
977
1027
|
const body = [...slashCommands.map((command) => command.toJSON())];
|
|
978
|
-
const rest = new REST({ version: "10" }).setToken(token);
|
|
979
|
-
await rest.put(Routes.applicationCommands(clientId), { body });
|
|
1028
|
+
const rest = new import_discord6.REST({ version: "10" }).setToken(token);
|
|
1029
|
+
await rest.put(import_discord6.Routes.applicationCommands(clientId), { body });
|
|
980
1030
|
console.log(`[Trivious] Deployed ${body.length} commands`);
|
|
981
1031
|
}
|
|
982
1032
|
/**
|
|
@@ -993,15 +1043,10 @@ var TriviousClient = class extends Client {
|
|
|
993
1043
|
};
|
|
994
1044
|
|
|
995
1045
|
// src/core/commands/command.base.ts
|
|
996
|
-
|
|
997
|
-
Collection as Collection5,
|
|
998
|
-
ContextMenuCommandBuilder as ContextMenuCommandBuilder2,
|
|
999
|
-
InteractionContextType,
|
|
1000
|
-
SlashCommandBuilder
|
|
1001
|
-
} from "discord.js";
|
|
1046
|
+
var import_discord8 = require("discord.js");
|
|
1002
1047
|
|
|
1003
1048
|
// src/core/commands/contextcommand.base.ts
|
|
1004
|
-
|
|
1049
|
+
var import_discord7 = require("discord.js");
|
|
1005
1050
|
var ContextMenuCommand = class extends Command {
|
|
1006
1051
|
/**
|
|
1007
1052
|
* Base command handler.
|
|
@@ -1023,7 +1068,7 @@ var ContextMenuCommand = class extends Command {
|
|
|
1023
1068
|
if (memberHasPermission) await run(client, interaction);
|
|
1024
1069
|
}
|
|
1025
1070
|
};
|
|
1026
|
-
var ContextMenuBuilder = class extends ContextMenuCommandBuilder {
|
|
1071
|
+
var ContextMenuBuilder = class extends import_discord7.ContextMenuCommandBuilder {
|
|
1027
1072
|
_active = true;
|
|
1028
1073
|
_ownerOnly = false;
|
|
1029
1074
|
_permission = 0 /* USER */;
|
|
@@ -1099,7 +1144,7 @@ var Command = class {
|
|
|
1099
1144
|
* @returns {this is SlashCommand}
|
|
1100
1145
|
*/
|
|
1101
1146
|
isSlashCommand() {
|
|
1102
|
-
return this.data instanceof SlashCommandBuilder && this instanceof SlashCommand;
|
|
1147
|
+
return this.data instanceof import_discord8.SlashCommandBuilder && this instanceof SlashCommand;
|
|
1103
1148
|
}
|
|
1104
1149
|
/**
|
|
1105
1150
|
* Returns whether the command is a ContextMenuCommand.
|
|
@@ -1109,7 +1154,7 @@ var Command = class {
|
|
|
1109
1154
|
* @returns {this is ContextMenuCommand}
|
|
1110
1155
|
*/
|
|
1111
1156
|
isContextMenuCommand() {
|
|
1112
|
-
return this.data instanceof
|
|
1157
|
+
return this.data instanceof import_discord8.ContextMenuCommandBuilder && this instanceof ContextMenuCommand;
|
|
1113
1158
|
}
|
|
1114
1159
|
/**
|
|
1115
1160
|
* Returns JSON of the command builder.
|
|
@@ -1204,12 +1249,12 @@ var SlashCommand = class extends Command {
|
|
|
1204
1249
|
await subcommand.execute(client, interaction);
|
|
1205
1250
|
}
|
|
1206
1251
|
};
|
|
1207
|
-
var CommandBuilder = class extends SlashCommandBuilder {
|
|
1252
|
+
var CommandBuilder = class extends import_discord8.SlashCommandBuilder {
|
|
1208
1253
|
_active = true;
|
|
1209
1254
|
_guildOnly = false;
|
|
1210
1255
|
_ownerOnly = false;
|
|
1211
1256
|
_permission = 0 /* USER */;
|
|
1212
|
-
_subcommands = new
|
|
1257
|
+
_subcommands = new import_discord8.Collection();
|
|
1213
1258
|
_ephemeralReply = false;
|
|
1214
1259
|
/**
|
|
1215
1260
|
* Set the command as disabled.
|
|
@@ -1230,7 +1275,7 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1230
1275
|
setGuildOnly() {
|
|
1231
1276
|
this._guildOnly = true;
|
|
1232
1277
|
this._permission = 0 /* USER */;
|
|
1233
|
-
this.setContexts(InteractionContextType.Guild);
|
|
1278
|
+
this.setContexts(import_discord8.InteractionContextType.Guild);
|
|
1234
1279
|
return this;
|
|
1235
1280
|
}
|
|
1236
1281
|
/**
|
|
@@ -1287,10 +1332,8 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1287
1332
|
};
|
|
1288
1333
|
|
|
1289
1334
|
// src/core/commands/subcommand.base.ts
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
} from "discord.js";
|
|
1293
|
-
var SubcommandBuilder = class extends SlashCommandSubcommandBuilder2 {
|
|
1335
|
+
var import_discord9 = require("discord.js");
|
|
1336
|
+
var SubcommandBuilder = class extends import_discord9.SlashCommandSubcommandBuilder {
|
|
1294
1337
|
_active = true;
|
|
1295
1338
|
_ownerOnly = false;
|
|
1296
1339
|
_permission = 0 /* USER */;
|
|
@@ -1477,11 +1520,12 @@ var Component = class {
|
|
|
1477
1520
|
};
|
|
1478
1521
|
|
|
1479
1522
|
// src/index.ts
|
|
1480
|
-
|
|
1481
|
-
export
|
|
1523
|
+
var import_discord10 = require("discord.js");
|
|
1524
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1525
|
+
0 && (module.exports = {
|
|
1482
1526
|
BaseRegistry,
|
|
1483
|
-
|
|
1484
|
-
|
|
1527
|
+
ClientEvents,
|
|
1528
|
+
Collection,
|
|
1485
1529
|
Command,
|
|
1486
1530
|
CommandBuilder,
|
|
1487
1531
|
CommandRegistry,
|
|
@@ -1498,5 +1542,5 @@ export {
|
|
|
1498
1542
|
TriviousClient,
|
|
1499
1543
|
deconstructCustomId,
|
|
1500
1544
|
getPermissionLevel
|
|
1501
|
-
};
|
|
1502
|
-
//# sourceMappingURL=index.
|
|
1545
|
+
});
|
|
1546
|
+
//# sourceMappingURL=index.cjs.map
|