trivious 1.3.10 → 1.3.11
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/{index.cjs → esm/index.js} +149 -103
- package/dist/esm/index.js.map +1 -0
- package/dist/index.js +213 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import path, { dirname, join, resolve } from 'path';
|
|
6
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
-
});
|
|
15
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
16
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
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);
|
|
18
32
|
|
|
19
33
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
|
|
20
34
|
var require_package = __commonJS({
|
|
21
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(
|
|
22
|
-
|
|
35
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports2, module2) {
|
|
36
|
+
module2.exports = {
|
|
23
37
|
name: "dotenv",
|
|
24
38
|
version: "17.2.3",
|
|
25
39
|
description: "Loads environment variables from .env file",
|
|
@@ -86,11 +100,12 @@ var require_package = __commonJS({
|
|
|
86
100
|
|
|
87
101
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
|
|
88
102
|
var require_main = __commonJS({
|
|
89
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
103
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
104
|
+
"use strict";
|
|
105
|
+
var fs6 = require("fs");
|
|
106
|
+
var path2 = require("path");
|
|
107
|
+
var os = require("os");
|
|
108
|
+
var crypto = require("crypto");
|
|
94
109
|
var packageJson = require_package();
|
|
95
110
|
var version = packageJson.version;
|
|
96
111
|
var TIPS = [
|
|
@@ -402,20 +417,21 @@ var require_main = __commonJS({
|
|
|
402
417
|
parse,
|
|
403
418
|
populate
|
|
404
419
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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;
|
|
413
428
|
}
|
|
414
429
|
});
|
|
415
430
|
|
|
416
431
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js
|
|
417
432
|
var require_env_options = __commonJS({
|
|
418
|
-
"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) {
|
|
434
|
+
"use strict";
|
|
419
435
|
var options = {};
|
|
420
436
|
if (process.env.DOTENV_CONFIG_ENCODING != null) {
|
|
421
437
|
options.encoding = process.env.DOTENV_CONFIG_ENCODING;
|
|
@@ -435,15 +451,16 @@ var require_env_options = __commonJS({
|
|
|
435
451
|
if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
|
|
436
452
|
options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
|
|
437
453
|
}
|
|
438
|
-
|
|
454
|
+
module2.exports = options;
|
|
439
455
|
}
|
|
440
456
|
});
|
|
441
457
|
|
|
442
458
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js
|
|
443
459
|
var require_cli_options = __commonJS({
|
|
444
|
-
"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) {
|
|
461
|
+
"use strict";
|
|
445
462
|
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
446
|
-
|
|
463
|
+
module2.exports = function optionMatcher(args) {
|
|
447
464
|
const options = args.reduce(function(acc, cur) {
|
|
448
465
|
const matches = cur.match(re);
|
|
449
466
|
if (matches) {
|
|
@@ -459,6 +476,31 @@ var require_cli_options = __commonJS({
|
|
|
459
476
|
}
|
|
460
477
|
});
|
|
461
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
|
+
|
|
462
504
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/config.js
|
|
463
505
|
(function() {
|
|
464
506
|
require_main().config(
|
|
@@ -470,6 +512,18 @@ var require_cli_options = __commonJS({
|
|
|
470
512
|
);
|
|
471
513
|
})();
|
|
472
514
|
|
|
515
|
+
// src/index.ts
|
|
516
|
+
var import_node_util = require("util");
|
|
517
|
+
|
|
518
|
+
// src/core/client/trivious.client.ts
|
|
519
|
+
var import_discord6 = require("discord.js");
|
|
520
|
+
|
|
521
|
+
// src/shared/utility/functions.ts
|
|
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");
|
|
526
|
+
|
|
473
527
|
// src/shared/typings/permissions.ts
|
|
474
528
|
var PermissionLevel = /* @__PURE__ */ ((PermissionLevel2) => {
|
|
475
529
|
PermissionLevel2[PermissionLevel2["USER"] = 0] = "USER";
|
|
@@ -488,17 +542,18 @@ var getPermissionLevel = (client, member) => {
|
|
|
488
542
|
};
|
|
489
543
|
|
|
490
544
|
// src/shared/utility/functions.ts
|
|
491
|
-
var
|
|
492
|
-
var
|
|
545
|
+
var import_meta = {};
|
|
546
|
+
var __filename = (0, import_url.fileURLToPath)(import_meta.url);
|
|
547
|
+
var __dirname = (0, import_path.dirname)(__filename);
|
|
493
548
|
var getPackageRoot = () => {
|
|
494
|
-
let dir = __dirname
|
|
495
|
-
while (dir !== dirname(dir)) {
|
|
496
|
-
if (existsSync(join(dir, "package.json")) || existsSync(join(dir, "node_modules"))) {
|
|
549
|
+
let dir = __dirname;
|
|
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"))) {
|
|
497
552
|
return dir;
|
|
498
553
|
}
|
|
499
|
-
dir = dirname(dir);
|
|
554
|
+
dir = (0, import_path.dirname)(dir);
|
|
500
555
|
}
|
|
501
|
-
return __dirname
|
|
556
|
+
return __dirname;
|
|
502
557
|
};
|
|
503
558
|
var FRAMEWORK_PACKAGE_ROOT = getPackageRoot();
|
|
504
559
|
function getCorePath(options) {
|
|
@@ -507,34 +562,34 @@ function getCorePath(options) {
|
|
|
507
562
|
return resolveUserPath(userPath);
|
|
508
563
|
}
|
|
509
564
|
const builtInCandidates = [
|
|
510
|
-
join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
511
|
-
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)
|
|
512
567
|
];
|
|
513
568
|
for (const candidate of builtInCandidates) {
|
|
514
|
-
if (existsSync(candidate)) {
|
|
569
|
+
if ((0, import_fs.existsSync)(candidate)) {
|
|
515
570
|
return candidate;
|
|
516
571
|
}
|
|
517
572
|
}
|
|
518
|
-
return join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
573
|
+
return (0, import_node_path.join)(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
519
574
|
}
|
|
520
575
|
function resolveUserPath(relativePath) {
|
|
521
576
|
const candidates = [
|
|
522
|
-
join(process.cwd(), relativePath),
|
|
523
|
-
join(process.cwd(), "lib", relativePath),
|
|
524
|
-
join(process.cwd(), "dist", relativePath),
|
|
525
|
-
join(FRAMEWORK_PACKAGE_ROOT, relativePath),
|
|
526
|
-
join(FRAMEWORK_PACKAGE_ROOT, "lib", relativePath),
|
|
527
|
-
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)
|
|
528
583
|
];
|
|
529
584
|
for (const candidate of candidates) {
|
|
530
|
-
const full = resolve(candidate);
|
|
531
|
-
if (existsSync(full)) return full;
|
|
585
|
+
const full = (0, import_node_path.resolve)(candidate);
|
|
586
|
+
if ((0, import_fs.existsSync)(full)) return full;
|
|
532
587
|
}
|
|
533
|
-
return join(process.cwd(), relativePath);
|
|
588
|
+
return (0, import_node_path.join)(process.cwd(), relativePath);
|
|
534
589
|
}
|
|
535
590
|
async function exists(path2) {
|
|
536
591
|
try {
|
|
537
|
-
await promises.access(path2);
|
|
592
|
+
await import_fs.promises.access(path2);
|
|
538
593
|
return true;
|
|
539
594
|
} catch {
|
|
540
595
|
return false;
|
|
@@ -552,6 +607,12 @@ function hasPermission(client, options) {
|
|
|
552
607
|
}
|
|
553
608
|
return false;
|
|
554
609
|
}
|
|
610
|
+
|
|
611
|
+
// src/core/registry/command.registry.ts
|
|
612
|
+
var import_discord = require("discord.js");
|
|
613
|
+
|
|
614
|
+
// src/shared/typings/registry.ts
|
|
615
|
+
var import_url2 = require("url");
|
|
555
616
|
var BaseRegistry = class {
|
|
556
617
|
/**
|
|
557
618
|
* Get all of loaded T
|
|
@@ -572,7 +633,7 @@ var BaseRegistry = class {
|
|
|
572
633
|
*/
|
|
573
634
|
async importFile(filePath) {
|
|
574
635
|
try {
|
|
575
|
-
const { default: file } = await import(pathToFileURL(filePath).href);
|
|
636
|
+
const { default: file } = await import((0, import_url2.pathToFileURL)(filePath).href);
|
|
576
637
|
const imports = file.default ?? file;
|
|
577
638
|
if (!imports) return null;
|
|
578
639
|
if (typeof imports === "function" && imports.prototype) {
|
|
@@ -601,8 +662,8 @@ var BaseRegistry = class {
|
|
|
601
662
|
async clearCache(filePath) {
|
|
602
663
|
if (process.env.NODE_ENV === "production") return;
|
|
603
664
|
try {
|
|
604
|
-
const resvoled =
|
|
605
|
-
delete
|
|
665
|
+
const resvoled = require.resolve(filePath);
|
|
666
|
+
delete require.cache[resvoled];
|
|
606
667
|
} catch {
|
|
607
668
|
}
|
|
608
669
|
}
|
|
@@ -624,8 +685,12 @@ var deconstructCustomId = (customId) => {
|
|
|
624
685
|
tags
|
|
625
686
|
};
|
|
626
687
|
};
|
|
688
|
+
|
|
689
|
+
// src/core/registry/command.registry.ts
|
|
690
|
+
var import_fs2 = require("fs");
|
|
691
|
+
var import_node_path2 = require("path");
|
|
627
692
|
var CommandRegistry = class extends BaseRegistry {
|
|
628
|
-
items = new Collection();
|
|
693
|
+
items = new import_discord.Collection();
|
|
629
694
|
/**
|
|
630
695
|
* Load all commands and their subcommands
|
|
631
696
|
*
|
|
@@ -637,12 +702,12 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
637
702
|
if (!await exists(directory)) {
|
|
638
703
|
return this;
|
|
639
704
|
}
|
|
640
|
-
const entries = await promises.readdir(directory, { withFileTypes: true });
|
|
705
|
+
const entries = await import_fs2.promises.readdir(directory, { withFileTypes: true });
|
|
641
706
|
for (const entry of entries) {
|
|
642
|
-
const fullPath = join(directory, entry.name);
|
|
707
|
+
const fullPath = (0, import_node_path2.join)(directory, entry.name);
|
|
643
708
|
if (!entry.isDirectory()) continue;
|
|
644
|
-
const indexFile = join(fullPath, "index.ts");
|
|
645
|
-
const indexJs = join(fullPath, "index.js");
|
|
709
|
+
const indexFile = (0, import_node_path2.join)(fullPath, "index.ts");
|
|
710
|
+
const indexJs = (0, import_node_path2.join)(fullPath, "index.js");
|
|
646
711
|
let commandFile = "";
|
|
647
712
|
if (await exists(indexFile)) commandFile = indexFile;
|
|
648
713
|
else if (await exists(indexJs)) commandFile = indexJs;
|
|
@@ -651,13 +716,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
651
716
|
if (!command) continue;
|
|
652
717
|
if (!command.metadata.active) continue;
|
|
653
718
|
if (command.isSlashCommand()) {
|
|
654
|
-
const subcommandFiles = (await promises.readdir(fullPath)).filter(
|
|
719
|
+
const subcommandFiles = (await import_fs2.promises.readdir(fullPath)).filter(
|
|
655
720
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
656
721
|
);
|
|
657
722
|
for (const file of subcommandFiles) {
|
|
658
|
-
const subcommand = await this.importFile(join(fullPath, file));
|
|
723
|
+
const subcommand = await this.importFile((0, import_node_path2.join)(fullPath, file));
|
|
659
724
|
if (!subcommand) continue;
|
|
660
|
-
if (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))
|
|
725
|
+
if (!subcommand.data.name || !(subcommand.data instanceof import_discord.SlashCommandSubcommandBuilder))
|
|
661
726
|
continue;
|
|
662
727
|
command.data.addSubcommand(subcommand.data);
|
|
663
728
|
command.metadata.subcommands.set(subcommand.data.name, subcommand);
|
|
@@ -668,8 +733,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
668
733
|
return this;
|
|
669
734
|
}
|
|
670
735
|
};
|
|
736
|
+
|
|
737
|
+
// src/core/registry/component.registry.ts
|
|
738
|
+
var import_discord2 = require("discord.js");
|
|
739
|
+
var import_fs3 = require("fs");
|
|
740
|
+
var import_node_path3 = require("path");
|
|
671
741
|
var ComponentRegistry = class extends BaseRegistry {
|
|
672
|
-
items = new Collection();
|
|
742
|
+
items = new import_discord2.Collection();
|
|
673
743
|
/**
|
|
674
744
|
* Load all components.
|
|
675
745
|
*
|
|
@@ -681,15 +751,15 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
681
751
|
if (!await exists(directory)) {
|
|
682
752
|
return this;
|
|
683
753
|
}
|
|
684
|
-
const entries = await promises.readdir(directory, { withFileTypes: true });
|
|
754
|
+
const entries = await import_fs3.promises.readdir(directory, { withFileTypes: true });
|
|
685
755
|
for (const entry of entries) {
|
|
686
|
-
const fullPath = join(directory, entry.name);
|
|
756
|
+
const fullPath = (0, import_node_path3.join)(directory, entry.name);
|
|
687
757
|
if (!entry.isDirectory()) continue;
|
|
688
|
-
const componentFiles = (await promises.readdir(fullPath)).filter(
|
|
758
|
+
const componentFiles = (await import_fs3.promises.readdir(fullPath)).filter(
|
|
689
759
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
690
760
|
);
|
|
691
761
|
for (const file of componentFiles) {
|
|
692
|
-
const component = await this.importFile(join(fullPath, file));
|
|
762
|
+
const component = await this.importFile((0, import_node_path3.join)(fullPath, file));
|
|
693
763
|
if (!component) continue;
|
|
694
764
|
const { data } = deconstructCustomId(component.metadata.customId);
|
|
695
765
|
this.items.set(data, component);
|
|
@@ -698,6 +768,14 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
698
768
|
return this;
|
|
699
769
|
}
|
|
700
770
|
};
|
|
771
|
+
|
|
772
|
+
// src/core/registry/event.registry.ts
|
|
773
|
+
var import_discord4 = require("discord.js");
|
|
774
|
+
var import_fs4 = require("fs");
|
|
775
|
+
var import_node_path4 = require("path");
|
|
776
|
+
|
|
777
|
+
// src/core/events/interactionCreate.ts
|
|
778
|
+
var import_discord3 = require("discord.js");
|
|
701
779
|
var interactionCreate_default = {
|
|
702
780
|
name: "interactionCreate",
|
|
703
781
|
execute: async (client, interaction) => {
|
|
@@ -727,9 +805,9 @@ var interactionCreate_default = {
|
|
|
727
805
|
}
|
|
728
806
|
} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {
|
|
729
807
|
const { componentType, tags, data } = deconstructCustomId(interaction.customId);
|
|
730
|
-
if (componentType === "button" /* Button */ && !(interaction instanceof ButtonInteraction))
|
|
808
|
+
if (componentType === "button" /* Button */ && !(interaction instanceof import_discord3.ButtonInteraction))
|
|
731
809
|
return;
|
|
732
|
-
if (componentType === "modal" /* Modal */ && !(interaction instanceof ModalSubmitInteraction))
|
|
810
|
+
if (componentType === "modal" /* Modal */ && !(interaction instanceof import_discord3.ModalSubmitInteraction))
|
|
733
811
|
return;
|
|
734
812
|
if (tags.includes("awaited")) return;
|
|
735
813
|
const registeredComponents = client.registries.components.get();
|
|
@@ -756,7 +834,7 @@ var interactionCreate_default = {
|
|
|
756
834
|
|
|
757
835
|
// src/core/registry/event.registry.ts
|
|
758
836
|
var EventRegistry = class extends BaseRegistry {
|
|
759
|
-
items = new Collection();
|
|
837
|
+
items = new import_discord4.Collection();
|
|
760
838
|
/**
|
|
761
839
|
* Load all events.
|
|
762
840
|
*
|
|
@@ -766,9 +844,9 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
766
844
|
*/
|
|
767
845
|
async load(directory = getCorePath({ coreDirectory: "events" })) {
|
|
768
846
|
if (!await exists(directory)) return this;
|
|
769
|
-
const entries = await promises.readdir(directory, { withFileTypes: true });
|
|
847
|
+
const entries = await import_fs4.promises.readdir(directory, { withFileTypes: true });
|
|
770
848
|
for (const entry of entries) {
|
|
771
|
-
const fullPath = join(directory, entry.name);
|
|
849
|
+
const fullPath = (0, import_node_path4.join)(directory, entry.name);
|
|
772
850
|
if (entry.isDirectory()) {
|
|
773
851
|
await this.load(fullPath);
|
|
774
852
|
continue;
|
|
@@ -796,8 +874,13 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
796
874
|
}
|
|
797
875
|
}
|
|
798
876
|
};
|
|
877
|
+
|
|
878
|
+
// src/core/registry/module.registry.ts
|
|
879
|
+
var import_discord5 = require("discord.js");
|
|
880
|
+
var import_fs5 = require("fs");
|
|
881
|
+
var import_node_path5 = require("path");
|
|
799
882
|
var ModuleRegistry = class extends BaseRegistry {
|
|
800
|
-
items = new Collection();
|
|
883
|
+
items = new import_discord5.Collection();
|
|
801
884
|
/**
|
|
802
885
|
* Load all modules.
|
|
803
886
|
*
|
|
@@ -809,15 +892,15 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
809
892
|
if (!await exists(directory)) {
|
|
810
893
|
return this;
|
|
811
894
|
}
|
|
812
|
-
const entries = await promises.readdir(directory, { withFileTypes: true });
|
|
895
|
+
const entries = await import_fs5.promises.readdir(directory, { withFileTypes: true });
|
|
813
896
|
for (const entry of entries) {
|
|
814
|
-
const fullPath = join(directory, entry.name);
|
|
897
|
+
const fullPath = (0, import_node_path5.join)(directory, entry.name);
|
|
815
898
|
if (!entry.isDirectory()) continue;
|
|
816
|
-
const moduleFiles = (await promises.readdir(fullPath)).filter(
|
|
899
|
+
const moduleFiles = (await import_fs5.promises.readdir(fullPath)).filter(
|
|
817
900
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
818
901
|
);
|
|
819
902
|
for (const file of moduleFiles) {
|
|
820
|
-
const moduleEvent = await this.importFile(join(fullPath, file));
|
|
903
|
+
const moduleEvent = await this.importFile((0, import_node_path5.join)(fullPath, file));
|
|
821
904
|
if (!moduleEvent || !moduleEvent.events) continue;
|
|
822
905
|
this.items.set(moduleEvent.name, moduleEvent);
|
|
823
906
|
}
|
|
@@ -841,6 +924,9 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
841
924
|
}
|
|
842
925
|
}
|
|
843
926
|
};
|
|
927
|
+
|
|
928
|
+
// src/core/registry/index.ts
|
|
929
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
844
930
|
var registries = () => ({
|
|
845
931
|
commands: new CommandRegistry(),
|
|
846
932
|
components: new ComponentRegistry(),
|
|
@@ -851,16 +937,16 @@ var registries = () => ({
|
|
|
851
937
|
const corePath = options.corePath;
|
|
852
938
|
await Promise.all([
|
|
853
939
|
this.commands.load(
|
|
854
|
-
corePath ? resolveUserPath(
|
|
940
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "commands")) : corePaths?.commandsPath ? resolveUserPath(corePaths.commandsPath) : void 0
|
|
855
941
|
),
|
|
856
942
|
this.components.load(
|
|
857
|
-
corePath ? resolveUserPath(
|
|
943
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "components")) : corePaths?.componentsPath ? resolveUserPath(corePaths.componentsPath) : void 0
|
|
858
944
|
),
|
|
859
945
|
this.events.load(
|
|
860
|
-
corePath ? resolveUserPath(
|
|
946
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "events")) : corePaths?.eventsPath ? resolveUserPath(corePaths.eventsPath) : void 0
|
|
861
947
|
),
|
|
862
948
|
this.modules.load(
|
|
863
|
-
corePath ? resolveUserPath(
|
|
949
|
+
corePath ? resolveUserPath(import_node_path6.default.join(corePath, "modules")) : corePaths?.modulesPath ? resolveUserPath(corePaths.modulesPath) : void 0
|
|
864
950
|
)
|
|
865
951
|
]);
|
|
866
952
|
},
|
|
@@ -871,7 +957,7 @@ var registries = () => ({
|
|
|
871
957
|
});
|
|
872
958
|
|
|
873
959
|
// src/core/client/trivious.client.ts
|
|
874
|
-
var TriviousClient = class extends Client {
|
|
960
|
+
var TriviousClient = class extends import_discord6.Client {
|
|
875
961
|
/**
|
|
876
962
|
* Client registries.
|
|
877
963
|
*
|
|
@@ -936,8 +1022,8 @@ var TriviousClient = class extends Client {
|
|
|
936
1022
|
if (!clientId || !token) throw new Error("[Trivious] Invalid clientId or token reference");
|
|
937
1023
|
const slashCommands = Array.from(this.registries.commands.get().values());
|
|
938
1024
|
const body = [...slashCommands.map((command) => command.toJSON())];
|
|
939
|
-
const rest = new REST({ version: "10" }).setToken(token);
|
|
940
|
-
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 });
|
|
941
1027
|
console.log(`[Trivious] Deployed ${body.length} commands`);
|
|
942
1028
|
}
|
|
943
1029
|
/**
|
|
@@ -952,6 +1038,12 @@ var TriviousClient = class extends Client {
|
|
|
952
1038
|
return this._options.rolePermissions ?? {};
|
|
953
1039
|
}
|
|
954
1040
|
};
|
|
1041
|
+
|
|
1042
|
+
// src/core/commands/command.base.ts
|
|
1043
|
+
var import_discord8 = require("discord.js");
|
|
1044
|
+
|
|
1045
|
+
// src/core/commands/contextcommand.base.ts
|
|
1046
|
+
var import_discord7 = require("discord.js");
|
|
955
1047
|
var ContextMenuCommand = class extends Command {
|
|
956
1048
|
/**
|
|
957
1049
|
* Base command handler.
|
|
@@ -973,7 +1065,7 @@ var ContextMenuCommand = class extends Command {
|
|
|
973
1065
|
if (memberHasPermission) await run(client, interaction);
|
|
974
1066
|
}
|
|
975
1067
|
};
|
|
976
|
-
var ContextMenuBuilder = class extends ContextMenuCommandBuilder {
|
|
1068
|
+
var ContextMenuBuilder = class extends import_discord7.ContextMenuCommandBuilder {
|
|
977
1069
|
_active = true;
|
|
978
1070
|
_ownerOnly = false;
|
|
979
1071
|
_permission = 0 /* USER */;
|
|
@@ -1049,7 +1141,7 @@ var Command = class {
|
|
|
1049
1141
|
* @returns {this is SlashCommand}
|
|
1050
1142
|
*/
|
|
1051
1143
|
isSlashCommand() {
|
|
1052
|
-
return this.data instanceof SlashCommandBuilder && this instanceof SlashCommand;
|
|
1144
|
+
return this.data instanceof import_discord8.SlashCommandBuilder && this instanceof SlashCommand;
|
|
1053
1145
|
}
|
|
1054
1146
|
/**
|
|
1055
1147
|
* Returns whether the command is a ContextMenuCommand.
|
|
@@ -1059,7 +1151,7 @@ var Command = class {
|
|
|
1059
1151
|
* @returns {this is ContextMenuCommand}
|
|
1060
1152
|
*/
|
|
1061
1153
|
isContextMenuCommand() {
|
|
1062
|
-
return this.data instanceof ContextMenuCommandBuilder && this instanceof ContextMenuCommand;
|
|
1154
|
+
return this.data instanceof import_discord8.ContextMenuCommandBuilder && this instanceof ContextMenuCommand;
|
|
1063
1155
|
}
|
|
1064
1156
|
/**
|
|
1065
1157
|
* Returns JSON of the command builder.
|
|
@@ -1154,12 +1246,12 @@ var SlashCommand = class extends Command {
|
|
|
1154
1246
|
await subcommand.execute(client, interaction);
|
|
1155
1247
|
}
|
|
1156
1248
|
};
|
|
1157
|
-
var CommandBuilder = class extends SlashCommandBuilder {
|
|
1249
|
+
var CommandBuilder = class extends import_discord8.SlashCommandBuilder {
|
|
1158
1250
|
_active = true;
|
|
1159
1251
|
_guildOnly = false;
|
|
1160
1252
|
_ownerOnly = false;
|
|
1161
1253
|
_permission = 0 /* USER */;
|
|
1162
|
-
_subcommands = new Collection();
|
|
1254
|
+
_subcommands = new import_discord8.Collection();
|
|
1163
1255
|
_ephemeralReply = false;
|
|
1164
1256
|
/**
|
|
1165
1257
|
* Set the command as disabled.
|
|
@@ -1180,7 +1272,7 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1180
1272
|
setGuildOnly() {
|
|
1181
1273
|
this._guildOnly = true;
|
|
1182
1274
|
this._permission = 0 /* USER */;
|
|
1183
|
-
this.setContexts(InteractionContextType.Guild);
|
|
1275
|
+
this.setContexts(import_discord8.InteractionContextType.Guild);
|
|
1184
1276
|
return this;
|
|
1185
1277
|
}
|
|
1186
1278
|
/**
|
|
@@ -1235,7 +1327,10 @@ var CommandBuilder = class extends SlashCommandBuilder {
|
|
|
1235
1327
|
};
|
|
1236
1328
|
}
|
|
1237
1329
|
};
|
|
1238
|
-
|
|
1330
|
+
|
|
1331
|
+
// src/core/commands/subcommand.base.ts
|
|
1332
|
+
var import_discord9 = require("discord.js");
|
|
1333
|
+
var SubcommandBuilder = class extends import_discord9.SlashCommandSubcommandBuilder {
|
|
1239
1334
|
_active = true;
|
|
1240
1335
|
_ownerOnly = false;
|
|
1241
1336
|
_permission = 0 /* USER */;
|
|
@@ -1421,6 +1516,28 @@ var Component = class {
|
|
|
1421
1516
|
}
|
|
1422
1517
|
};
|
|
1423
1518
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1519
|
+
// src/index.ts
|
|
1520
|
+
var import_discord10 = require("discord.js");
|
|
1521
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1522
|
+
0 && (module.exports = {
|
|
1523
|
+
BaseRegistry,
|
|
1524
|
+
ClientEvents,
|
|
1525
|
+
Collection,
|
|
1526
|
+
Command,
|
|
1527
|
+
CommandBuilder,
|
|
1528
|
+
CommandRegistry,
|
|
1529
|
+
Component,
|
|
1530
|
+
ComponentBuilder,
|
|
1531
|
+
ComponentRegistry,
|
|
1532
|
+
ComponentType,
|
|
1533
|
+
ContextMenuBuilder,
|
|
1534
|
+
ContextMenuCommand,
|
|
1535
|
+
PermissionLevel,
|
|
1536
|
+
SlashCommand,
|
|
1537
|
+
Subcommand,
|
|
1538
|
+
SubcommandBuilder,
|
|
1539
|
+
TriviousClient,
|
|
1540
|
+
deconstructCustomId,
|
|
1541
|
+
getPermissionLevel
|
|
1542
|
+
});
|
|
1426
1543
|
//# sourceMappingURL=index.js.map
|