trivious 1.3.12 → 1.3.13
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} +163 -122
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +121 -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,16 @@ 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
|
-
|
|
522
|
+
var import_fs = require("fs");
|
|
523
|
+
var import_node_path = require("path");
|
|
524
|
+
var import_url = require("url");
|
|
525
|
+
var import_path = require("path");
|
|
480
526
|
|
|
481
527
|
// src/shared/typings/permissions.ts
|
|
482
528
|
var PermissionLevel = /* @__PURE__ */ ((PermissionLevel2) => {
|
|
@@ -496,15 +542,16 @@ var getPermissionLevel = (client, member) => {
|
|
|
496
542
|
};
|
|
497
543
|
|
|
498
544
|
// src/shared/utility/functions.ts
|
|
499
|
-
var
|
|
500
|
-
var
|
|
545
|
+
var import_meta = {};
|
|
546
|
+
var __filename = (0, import_url.fileURLToPath)(import_meta.url);
|
|
547
|
+
var __dirname = (0, import_path.dirname)(__filename);
|
|
501
548
|
var getPackageRoot = () => {
|
|
502
549
|
let dir = __dirname;
|
|
503
|
-
while (dir !== dirname(dir)) {
|
|
504
|
-
if (existsSync(join(dir, "package.json")) || existsSync(join(dir, "node_modules"))) {
|
|
550
|
+
while (dir !== (0, import_path.dirname)(dir)) {
|
|
551
|
+
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
552
|
return dir;
|
|
506
553
|
}
|
|
507
|
-
dir = dirname(dir);
|
|
554
|
+
dir = (0, import_path.dirname)(dir);
|
|
508
555
|
}
|
|
509
556
|
return __dirname;
|
|
510
557
|
};
|
|
@@ -515,34 +562,34 @@ function getCorePath(options) {
|
|
|
515
562
|
return resolveUserPath(userPath);
|
|
516
563
|
}
|
|
517
564
|
const builtInCandidates = [
|
|
518
|
-
join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
519
|
-
join(FRAMEWORK_PACKAGE_ROOT, "dist", coreDirectory)
|
|
565
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
566
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "dist", coreDirectory)
|
|
520
567
|
];
|
|
521
568
|
for (const candidate of builtInCandidates) {
|
|
522
|
-
if (existsSync(candidate)) {
|
|
569
|
+
if ((0, import_fs.existsSync)(candidate)) {
|
|
523
570
|
return candidate;
|
|
524
571
|
}
|
|
525
572
|
}
|
|
526
|
-
return join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
573
|
+
return (0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
527
574
|
}
|
|
528
575
|
function resolveUserPath(relativePath) {
|
|
529
576
|
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)
|
|
577
|
+
(0, import_node_path.join)(process.cwd(), relativePath),
|
|
578
|
+
(0, import_node_path.join)(process.cwd(), "lib", relativePath),
|
|
579
|
+
(0, import_node_path.join)(process.cwd(), "dist", relativePath),
|
|
580
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, relativePath),
|
|
581
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", relativePath),
|
|
582
|
+
(0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "dist", relativePath)
|
|
536
583
|
];
|
|
537
584
|
for (const candidate of candidates) {
|
|
538
|
-
const full = resolve(candidate);
|
|
539
|
-
if (existsSync(full)) return full;
|
|
585
|
+
const full = (0, import_node_path.resolve)(candidate);
|
|
586
|
+
if ((0, import_fs.existsSync)(full)) return full;
|
|
540
587
|
}
|
|
541
|
-
return join(process.cwd(), relativePath);
|
|
588
|
+
return (0, import_node_path.join)(process.cwd(), relativePath);
|
|
542
589
|
}
|
|
543
590
|
async function exists(path2) {
|
|
544
591
|
try {
|
|
545
|
-
await
|
|
592
|
+
await import_fs.promises.access(path2);
|
|
546
593
|
return true;
|
|
547
594
|
} catch {
|
|
548
595
|
return false;
|
|
@@ -562,10 +609,10 @@ function hasPermission(client, options) {
|
|
|
562
609
|
}
|
|
563
610
|
|
|
564
611
|
// src/core/registry/command.registry.ts
|
|
565
|
-
|
|
612
|
+
var import_discord = require("discord.js");
|
|
566
613
|
|
|
567
614
|
// src/shared/typings/registry.ts
|
|
568
|
-
|
|
615
|
+
var import_url2 = require("url");
|
|
569
616
|
var BaseRegistry = class {
|
|
570
617
|
/**
|
|
571
618
|
* Get all of loaded T
|
|
@@ -586,7 +633,7 @@ var BaseRegistry = class {
|
|
|
586
633
|
*/
|
|
587
634
|
async importFile(filePath) {
|
|
588
635
|
try {
|
|
589
|
-
const { default: file } = await import(pathToFileURL(filePath).href);
|
|
636
|
+
const { default: file } = await import((0, import_url2.pathToFileURL)(filePath).href);
|
|
590
637
|
const imports = file.default ?? file;
|
|
591
638
|
if (!imports) return null;
|
|
592
639
|
if (typeof imports === "function" && imports.prototype) {
|
|
@@ -615,8 +662,8 @@ var BaseRegistry = class {
|
|
|
615
662
|
async clearCache(filePath) {
|
|
616
663
|
if (process.env.NODE_ENV === "production") return;
|
|
617
664
|
try {
|
|
618
|
-
const resvoled =
|
|
619
|
-
delete
|
|
665
|
+
const resvoled = require.resolve(filePath);
|
|
666
|
+
delete require.cache[resvoled];
|
|
620
667
|
} catch {
|
|
621
668
|
}
|
|
622
669
|
}
|
|
@@ -640,10 +687,10 @@ var deconstructCustomId = (customId) => {
|
|
|
640
687
|
};
|
|
641
688
|
|
|
642
689
|
// src/core/registry/command.registry.ts
|
|
643
|
-
|
|
644
|
-
|
|
690
|
+
var import_fs2 = require("fs");
|
|
691
|
+
var import_node_path2 = require("path");
|
|
645
692
|
var CommandRegistry = class extends BaseRegistry {
|
|
646
|
-
items = new Collection();
|
|
693
|
+
items = new import_discord.Collection();
|
|
647
694
|
/**
|
|
648
695
|
* Load all commands and their subcommands
|
|
649
696
|
*
|
|
@@ -655,12 +702,12 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
655
702
|
if (!await exists(directory)) {
|
|
656
703
|
return this;
|
|
657
704
|
}
|
|
658
|
-
const entries = await
|
|
705
|
+
const entries = await import_fs2.promises.readdir(directory, { withFileTypes: true });
|
|
659
706
|
for (const entry of entries) {
|
|
660
|
-
const fullPath =
|
|
707
|
+
const fullPath = (0, import_node_path2.join)(directory, entry.name);
|
|
661
708
|
if (!entry.isDirectory()) continue;
|
|
662
|
-
const indexFile =
|
|
663
|
-
const indexJs =
|
|
709
|
+
const indexFile = (0, import_node_path2.join)(fullPath, "index.ts");
|
|
710
|
+
const indexJs = (0, import_node_path2.join)(fullPath, "index.js");
|
|
664
711
|
let commandFile = "";
|
|
665
712
|
if (await exists(indexFile)) commandFile = indexFile;
|
|
666
713
|
else if (await exists(indexJs)) commandFile = indexJs;
|
|
@@ -669,13 +716,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
669
716
|
if (!command) continue;
|
|
670
717
|
if (!command.metadata.active) continue;
|
|
671
718
|
if (command.isSlashCommand()) {
|
|
672
|
-
const subcommandFiles = (await
|
|
719
|
+
const subcommandFiles = (await import_fs2.promises.readdir(fullPath)).filter(
|
|
673
720
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
674
721
|
);
|
|
675
722
|
for (const file of subcommandFiles) {
|
|
676
|
-
const subcommand = await this.importFile(
|
|
723
|
+
const subcommand = await this.importFile((0, import_node_path2.join)(fullPath, file));
|
|
677
724
|
if (!subcommand) continue;
|
|
678
|
-
if (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))
|
|
725
|
+
if (!subcommand.data.name || !(subcommand.data instanceof import_discord.SlashCommandSubcommandBuilder))
|
|
679
726
|
continue;
|
|
680
727
|
command.data.addSubcommand(subcommand.data);
|
|
681
728
|
command.metadata.subcommands.set(subcommand.data.name, subcommand);
|
|
@@ -688,11 +735,11 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
688
735
|
};
|
|
689
736
|
|
|
690
737
|
// src/core/registry/component.registry.ts
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
738
|
+
var import_discord2 = require("discord.js");
|
|
739
|
+
var import_fs3 = require("fs");
|
|
740
|
+
var import_node_path3 = require("path");
|
|
694
741
|
var ComponentRegistry = class extends BaseRegistry {
|
|
695
|
-
items = new
|
|
742
|
+
items = new import_discord2.Collection();
|
|
696
743
|
/**
|
|
697
744
|
* Load all components.
|
|
698
745
|
*
|
|
@@ -704,15 +751,15 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
704
751
|
if (!await exists(directory)) {
|
|
705
752
|
return this;
|
|
706
753
|
}
|
|
707
|
-
const entries = await
|
|
754
|
+
const entries = await import_fs3.promises.readdir(directory, { withFileTypes: true });
|
|
708
755
|
for (const entry of entries) {
|
|
709
|
-
const fullPath =
|
|
756
|
+
const fullPath = (0, import_node_path3.join)(directory, entry.name);
|
|
710
757
|
if (!entry.isDirectory()) continue;
|
|
711
|
-
const componentFiles = (await
|
|
758
|
+
const componentFiles = (await import_fs3.promises.readdir(fullPath)).filter(
|
|
712
759
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
713
760
|
);
|
|
714
761
|
for (const file of componentFiles) {
|
|
715
|
-
const component = await this.importFile(
|
|
762
|
+
const component = await this.importFile((0, import_node_path3.join)(fullPath, file));
|
|
716
763
|
if (!component) continue;
|
|
717
764
|
const { data } = deconstructCustomId(component.metadata.customId);
|
|
718
765
|
this.items.set(data, component);
|
|
@@ -723,12 +770,12 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
723
770
|
};
|
|
724
771
|
|
|
725
772
|
// src/core/registry/event.registry.ts
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
773
|
+
var import_discord4 = require("discord.js");
|
|
774
|
+
var import_fs4 = require("fs");
|
|
775
|
+
var import_node_path4 = require("path");
|
|
729
776
|
|
|
730
777
|
// src/core/events/interactionCreate.ts
|
|
731
|
-
|
|
778
|
+
var import_discord3 = require("discord.js");
|
|
732
779
|
var interactionCreate_default = {
|
|
733
780
|
name: "interactionCreate",
|
|
734
781
|
execute: async (client, interaction) => {
|
|
@@ -758,9 +805,9 @@ var interactionCreate_default = {
|
|
|
758
805
|
}
|
|
759
806
|
} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {
|
|
760
807
|
const { componentType, tags, data } = deconstructCustomId(interaction.customId);
|
|
761
|
-
if (componentType === "button" /* Button */ && !(interaction instanceof ButtonInteraction))
|
|
808
|
+
if (componentType === "button" /* Button */ && !(interaction instanceof import_discord3.ButtonInteraction))
|
|
762
809
|
return;
|
|
763
|
-
if (componentType === "modal" /* Modal */ && !(interaction instanceof ModalSubmitInteraction))
|
|
810
|
+
if (componentType === "modal" /* Modal */ && !(interaction instanceof import_discord3.ModalSubmitInteraction))
|
|
764
811
|
return;
|
|
765
812
|
if (tags.includes("awaited")) return;
|
|
766
813
|
const registeredComponents = client.registries.components.get();
|
|
@@ -787,7 +834,7 @@ var interactionCreate_default = {
|
|
|
787
834
|
|
|
788
835
|
// src/core/registry/event.registry.ts
|
|
789
836
|
var EventRegistry = class extends BaseRegistry {
|
|
790
|
-
items = new
|
|
837
|
+
items = new import_discord4.Collection();
|
|
791
838
|
/**
|
|
792
839
|
* Load all events.
|
|
793
840
|
*
|
|
@@ -797,9 +844,9 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
797
844
|
*/
|
|
798
845
|
async load(directory = getCorePath({ coreDirectory: "events" })) {
|
|
799
846
|
if (!await exists(directory)) return this;
|
|
800
|
-
const entries = await
|
|
847
|
+
const entries = await import_fs4.promises.readdir(directory, { withFileTypes: true });
|
|
801
848
|
for (const entry of entries) {
|
|
802
|
-
const fullPath =
|
|
849
|
+
const fullPath = (0, import_node_path4.join)(directory, entry.name);
|
|
803
850
|
if (entry.isDirectory()) {
|
|
804
851
|
await this.load(fullPath);
|
|
805
852
|
continue;
|
|
@@ -829,11 +876,11 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
829
876
|
};
|
|
830
877
|
|
|
831
878
|
// src/core/registry/module.registry.ts
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
879
|
+
var import_discord5 = require("discord.js");
|
|
880
|
+
var import_fs5 = require("fs");
|
|
881
|
+
var import_node_path5 = require("path");
|
|
835
882
|
var ModuleRegistry = class extends BaseRegistry {
|
|
836
|
-
items = new
|
|
883
|
+
items = new import_discord5.Collection();
|
|
837
884
|
/**
|
|
838
885
|
* Load all modules.
|
|
839
886
|
*
|
|
@@ -845,15 +892,15 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
845
892
|
if (!await exists(directory)) {
|
|
846
893
|
return this;
|
|
847
894
|
}
|
|
848
|
-
const entries = await
|
|
895
|
+
const entries = await import_fs5.promises.readdir(directory, { withFileTypes: true });
|
|
849
896
|
for (const entry of entries) {
|
|
850
|
-
const fullPath =
|
|
897
|
+
const fullPath = (0, import_node_path5.join)(directory, entry.name);
|
|
851
898
|
if (!entry.isDirectory()) continue;
|
|
852
|
-
const moduleFiles = (await
|
|
899
|
+
const moduleFiles = (await import_fs5.promises.readdir(fullPath)).filter(
|
|
853
900
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
854
901
|
);
|
|
855
902
|
for (const file of moduleFiles) {
|
|
856
|
-
const moduleEvent = await this.importFile(
|
|
903
|
+
const moduleEvent = await this.importFile((0, import_node_path5.join)(fullPath, file));
|
|
857
904
|
if (!moduleEvent || !moduleEvent.events) continue;
|
|
858
905
|
this.items.set(moduleEvent.name, moduleEvent);
|
|
859
906
|
}
|
|
@@ -879,7 +926,7 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
879
926
|
};
|
|
880
927
|
|
|
881
928
|
// src/core/registry/index.ts
|
|
882
|
-
|
|
929
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
883
930
|
var registries = () => ({
|
|
884
931
|
commands: new CommandRegistry(),
|
|
885
932
|
components: new ComponentRegistry(),
|
|
@@ -890,16 +937,16 @@ var registries = () => ({
|
|
|
890
937
|
const corePath = options.corePath;
|
|
891
938
|
await Promise.all([
|
|
892
939
|
this.commands.load(
|
|
893
|
-
corePath ? resolveUserPath(
|
|
940
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "commands")) : corePaths?.commandsPath ? resolveUserPath(corePaths.commandsPath) : void 0
|
|
894
941
|
),
|
|
895
942
|
this.components.load(
|
|
896
|
-
corePath ? resolveUserPath(
|
|
943
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "components")) : corePaths?.componentsPath ? resolveUserPath(corePaths.componentsPath) : void 0
|
|
897
944
|
),
|
|
898
945
|
this.events.load(
|
|
899
|
-
corePath ? resolveUserPath(
|
|
946
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "events")) : corePaths?.eventsPath ? resolveUserPath(corePaths.eventsPath) : void 0
|
|
900
947
|
),
|
|
901
948
|
this.modules.load(
|
|
902
|
-
corePath ? resolveUserPath(
|
|
949
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "modules")) : corePaths?.modulesPath ? resolveUserPath(corePaths.modulesPath) : void 0
|
|
903
950
|
)
|
|
904
951
|
]);
|
|
905
952
|
},
|
|
@@ -910,7 +957,7 @@ var registries = () => ({
|
|
|
910
957
|
});
|
|
911
958
|
|
|
912
959
|
// src/core/client/trivious.client.ts
|
|
913
|
-
var TriviousClient = class extends Client {
|
|
960
|
+
var TriviousClient = class extends import_discord6.Client {
|
|
914
961
|
/**
|
|
915
962
|
* Client registries.
|
|
916
963
|
*
|
|
@@ -975,8 +1022,8 @@ var TriviousClient = class extends Client {
|
|
|
975
1022
|
if (!clientId || !token) throw new Error("[Trivious] Invalid clientId or token reference");
|
|
976
1023
|
const slashCommands = Array.from(this.registries.commands.get().values());
|
|
977
1024
|
const body = [...slashCommands.map((command) => command.toJSON())];
|
|
978
|
-
const rest = new REST({ version: "10" }).setToken(token);
|
|
979
|
-
await rest.put(Routes.applicationCommands(clientId), { body });
|
|
1025
|
+
const rest = new import_discord6.REST({ version: "10" }).setToken(token);
|
|
1026
|
+
await rest.put(import_discord6.Routes.applicationCommands(clientId), { body });
|
|
980
1027
|
console.log(`[Trivious] Deployed ${body.length} commands`);
|
|
981
1028
|
}
|
|
982
1029
|
/**
|
|
@@ -993,15 +1040,10 @@ var TriviousClient = class extends Client {
|
|
|
993
1040
|
};
|
|
994
1041
|
|
|
995
1042
|
// src/core/commands/command.base.ts
|
|
996
|
-
|
|
997
|
-
Collection as Collection5,
|
|
998
|
-
ContextMenuCommandBuilder as ContextMenuCommandBuilder2,
|
|
999
|
-
InteractionContextType,
|
|
1000
|
-
SlashCommandBuilder
|
|
1001
|
-
} from "discord.js";
|
|
1043
|
+
var import_discord8 = require("discord.js");
|
|
1002
1044
|
|
|
1003
1045
|
// src/core/commands/contextcommand.base.ts
|
|
1004
|
-
|
|
1046
|
+
var import_discord7 = require("discord.js");
|
|
1005
1047
|
var ContextMenuCommand = class extends Command {
|
|
1006
1048
|
/**
|
|
1007
1049
|
* Base command handler.
|
|
@@ -1023,7 +1065,7 @@ var ContextMenuCommand = class extends Command {
|
|
|
1023
1065
|
if (memberHasPermission) await run(client, interaction);
|
|
1024
1066
|
}
|
|
1025
1067
|
};
|
|
1026
|
-
var ContextMenuBuilder = class extends ContextMenuCommandBuilder {
|
|
1068
|
+
var ContextMenuBuilder = class extends import_discord7.ContextMenuCommandBuilder {
|
|
1027
1069
|
_active = true;
|
|
1028
1070
|
_ownerOnly = false;
|
|
1029
1071
|
_permission = 0 /* USER */;
|
|
@@ -1099,7 +1141,7 @@ var Command = class {
|
|
|
1099
1141
|
* @returns {this is SlashCommand}
|
|
1100
1142
|
*/
|
|
1101
1143
|
isSlashCommand() {
|
|
1102
|
-
return this.data instanceof SlashCommandBuilder && this instanceof SlashCommand;
|
|
1144
|
+
return this.data instanceof import_discord8.SlashCommandBuilder && this instanceof SlashCommand;
|
|
1103
1145
|
}
|
|
1104
1146
|
/**
|
|
1105
1147
|
* Returns whether the command is a ContextMenuCommand.
|
|
@@ -1109,7 +1151,7 @@ var Command = class {
|
|
|
1109
1151
|
* @returns {this is ContextMenuCommand}
|
|
1110
1152
|
*/
|
|
1111
1153
|
isContextMenuCommand() {
|
|
1112
|
-
return this.data instanceof
|
|
1154
|
+
return this.data instanceof import_discord8.ContextMenuCommandBuilder && this instanceof ContextMenuCommand;
|
|
1113
1155
|
}
|
|
1114
1156
|
/**
|
|
1115
1157
|
* Returns JSON of the command builder.
|
|
@@ -1204,12 +1246,12 @@ var SlashCommand = class extends Command {
|
|
|
1204
1246
|
await subcommand.execute(client, interaction);
|
|
1205
1247
|
}
|
|
1206
1248
|
};
|
|
1207
|
-
var CommandBuilder = class extends SlashCommandBuilder {
|
|
1249
|
+
var CommandBuilder = class extends import_discord8.SlashCommandBuilder {
|
|
1208
1250
|
_active = true;
|
|
1209
1251
|
_guildOnly = false;
|
|
1210
1252
|
_ownerOnly = false;
|
|
1211
1253
|
_permission = 0 /* USER */;
|
|
1212
|
-
_subcommands = new
|
|
1254
|
+
_subcommands = new import_discord8.Collection();
|
|
1213
1255
|
_ephemeralReply = false;
|
|
1214
1256
|
/**
|
|
1215
1257
|
* Set the command as disabled.
|
|
@@ -1230,7 +1272,7 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1230
1272
|
setGuildOnly() {
|
|
1231
1273
|
this._guildOnly = true;
|
|
1232
1274
|
this._permission = 0 /* USER */;
|
|
1233
|
-
this.setContexts(InteractionContextType.Guild);
|
|
1275
|
+
this.setContexts(import_discord8.InteractionContextType.Guild);
|
|
1234
1276
|
return this;
|
|
1235
1277
|
}
|
|
1236
1278
|
/**
|
|
@@ -1287,10 +1329,8 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1287
1329
|
};
|
|
1288
1330
|
|
|
1289
1331
|
// src/core/commands/subcommand.base.ts
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
} from "discord.js";
|
|
1293
|
-
var SubcommandBuilder = class extends SlashCommandSubcommandBuilder2 {
|
|
1332
|
+
var import_discord9 = require("discord.js");
|
|
1333
|
+
var SubcommandBuilder = class extends import_discord9.SlashCommandSubcommandBuilder {
|
|
1294
1334
|
_active = true;
|
|
1295
1335
|
_ownerOnly = false;
|
|
1296
1336
|
_permission = 0 /* USER */;
|
|
@@ -1477,11 +1517,12 @@ var Component = class {
|
|
|
1477
1517
|
};
|
|
1478
1518
|
|
|
1479
1519
|
// src/index.ts
|
|
1480
|
-
|
|
1481
|
-
export
|
|
1520
|
+
var import_discord10 = require("discord.js");
|
|
1521
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1522
|
+
0 && (module.exports = {
|
|
1482
1523
|
BaseRegistry,
|
|
1483
|
-
|
|
1484
|
-
|
|
1524
|
+
ClientEvents,
|
|
1525
|
+
Collection,
|
|
1485
1526
|
Command,
|
|
1486
1527
|
CommandBuilder,
|
|
1487
1528
|
CommandRegistry,
|
|
@@ -1498,5 +1539,5 @@ export {
|
|
|
1498
1539
|
TriviousClient,
|
|
1499
1540
|
deconstructCustomId,
|
|
1500
1541
|
getPermissionLevel
|
|
1501
|
-
};
|
|
1502
|
-
//# sourceMappingURL=index.
|
|
1542
|
+
});
|
|
1543
|
+
//# sourceMappingURL=index.cjs.map
|