trivious 1.3.9 → 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} +151 -104
- package/dist/esm/index.js.map +1 -0
- package/dist/index.js +215 -97
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('util');
|
|
4
|
-
var discord_js = require('discord.js');
|
|
5
|
-
var fs = require('fs');
|
|
6
|
-
var path = require('path');
|
|
7
|
-
var url = require('url');
|
|
8
|
-
|
|
9
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
13
|
-
|
|
14
1
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
16
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -24,7 +11,7 @@ var __commonJS = (cb, mod) => function __require2() {
|
|
|
24
11
|
|
|
25
12
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
|
|
26
13
|
var require_package = __commonJS({
|
|
27
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports
|
|
14
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports, module) {
|
|
28
15
|
module.exports = {
|
|
29
16
|
name: "dotenv",
|
|
30
17
|
version: "17.2.3",
|
|
@@ -92,7 +79,8 @@ var require_package = __commonJS({
|
|
|
92
79
|
|
|
93
80
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
|
|
94
81
|
var require_main = __commonJS({
|
|
95
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports
|
|
82
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports, module) {
|
|
83
|
+
"use strict";
|
|
96
84
|
var fs6 = __require("fs");
|
|
97
85
|
var path2 = __require("path");
|
|
98
86
|
var os = __require("os");
|
|
@@ -421,7 +409,8 @@ var require_main = __commonJS({
|
|
|
421
409
|
|
|
422
410
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js
|
|
423
411
|
var require_env_options = __commonJS({
|
|
424
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js"(exports
|
|
412
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/env-options.js"(exports, module) {
|
|
413
|
+
"use strict";
|
|
425
414
|
var options = {};
|
|
426
415
|
if (process.env.DOTENV_CONFIG_ENCODING != null) {
|
|
427
416
|
options.encoding = process.env.DOTENV_CONFIG_ENCODING;
|
|
@@ -447,7 +436,8 @@ var require_env_options = __commonJS({
|
|
|
447
436
|
|
|
448
437
|
// node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js
|
|
449
438
|
var require_cli_options = __commonJS({
|
|
450
|
-
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js"(exports
|
|
439
|
+
"node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/cli-options.js"(exports, module) {
|
|
440
|
+
"use strict";
|
|
451
441
|
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
452
442
|
module.exports = function optionMatcher(args) {
|
|
453
443
|
const options = args.reduce(function(acc, cur) {
|
|
@@ -476,6 +466,18 @@ var require_cli_options = __commonJS({
|
|
|
476
466
|
);
|
|
477
467
|
})();
|
|
478
468
|
|
|
469
|
+
// src/index.ts
|
|
470
|
+
import "util";
|
|
471
|
+
|
|
472
|
+
// src/core/client/trivious.client.ts
|
|
473
|
+
import { Client, REST, Routes } from "discord.js";
|
|
474
|
+
|
|
475
|
+
// src/shared/utility/functions.ts
|
|
476
|
+
import { promises as fs, existsSync } from "fs";
|
|
477
|
+
import { join, resolve } from "path";
|
|
478
|
+
import { fileURLToPath } from "url";
|
|
479
|
+
import { dirname } from "path";
|
|
480
|
+
|
|
479
481
|
// src/shared/typings/permissions.ts
|
|
480
482
|
var PermissionLevel = /* @__PURE__ */ ((PermissionLevel2) => {
|
|
481
483
|
PermissionLevel2[PermissionLevel2["USER"] = 0] = "USER";
|
|
@@ -494,17 +496,17 @@ var getPermissionLevel = (client, member) => {
|
|
|
494
496
|
};
|
|
495
497
|
|
|
496
498
|
// src/shared/utility/functions.ts
|
|
497
|
-
var __filename
|
|
498
|
-
var __dirname
|
|
499
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
500
|
+
var __dirname = dirname(__filename);
|
|
499
501
|
var getPackageRoot = () => {
|
|
500
|
-
let dir = __dirname
|
|
501
|
-
while (dir !==
|
|
502
|
-
if (
|
|
502
|
+
let dir = __dirname;
|
|
503
|
+
while (dir !== dirname(dir)) {
|
|
504
|
+
if (existsSync(join(dir, "package.json")) || existsSync(join(dir, "node_modules"))) {
|
|
503
505
|
return dir;
|
|
504
506
|
}
|
|
505
|
-
dir =
|
|
507
|
+
dir = dirname(dir);
|
|
506
508
|
}
|
|
507
|
-
return __dirname
|
|
509
|
+
return __dirname;
|
|
508
510
|
};
|
|
509
511
|
var FRAMEWORK_PACKAGE_ROOT = getPackageRoot();
|
|
510
512
|
function getCorePath(options) {
|
|
@@ -513,34 +515,34 @@ function getCorePath(options) {
|
|
|
513
515
|
return resolveUserPath(userPath);
|
|
514
516
|
}
|
|
515
517
|
const builtInCandidates = [
|
|
516
|
-
|
|
517
|
-
|
|
518
|
+
join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory),
|
|
519
|
+
join(FRAMEWORK_PACKAGE_ROOT, "dist", coreDirectory)
|
|
518
520
|
];
|
|
519
521
|
for (const candidate of builtInCandidates) {
|
|
520
|
-
if (
|
|
522
|
+
if (existsSync(candidate)) {
|
|
521
523
|
return candidate;
|
|
522
524
|
}
|
|
523
525
|
}
|
|
524
|
-
return
|
|
526
|
+
return join(FRAMEWORK_PACKAGE_ROOT, "lib", coreDirectory);
|
|
525
527
|
}
|
|
526
528
|
function resolveUserPath(relativePath) {
|
|
527
529
|
const candidates = [
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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)
|
|
534
536
|
];
|
|
535
537
|
for (const candidate of candidates) {
|
|
536
|
-
const full =
|
|
537
|
-
if (
|
|
538
|
+
const full = resolve(candidate);
|
|
539
|
+
if (existsSync(full)) return full;
|
|
538
540
|
}
|
|
539
|
-
return
|
|
541
|
+
return join(process.cwd(), relativePath);
|
|
540
542
|
}
|
|
541
543
|
async function exists(path2) {
|
|
542
544
|
try {
|
|
543
|
-
await fs.
|
|
545
|
+
await fs.access(path2);
|
|
544
546
|
return true;
|
|
545
547
|
} catch {
|
|
546
548
|
return false;
|
|
@@ -558,6 +560,12 @@ function hasPermission(client, options) {
|
|
|
558
560
|
}
|
|
559
561
|
return false;
|
|
560
562
|
}
|
|
563
|
+
|
|
564
|
+
// src/core/registry/command.registry.ts
|
|
565
|
+
import { Collection, SlashCommandSubcommandBuilder } from "discord.js";
|
|
566
|
+
|
|
567
|
+
// src/shared/typings/registry.ts
|
|
568
|
+
import { pathToFileURL } from "url";
|
|
561
569
|
var BaseRegistry = class {
|
|
562
570
|
/**
|
|
563
571
|
* Get all of loaded T
|
|
@@ -578,7 +586,7 @@ var BaseRegistry = class {
|
|
|
578
586
|
*/
|
|
579
587
|
async importFile(filePath) {
|
|
580
588
|
try {
|
|
581
|
-
const { default: file } = await import(
|
|
589
|
+
const { default: file } = await import(pathToFileURL(filePath).href);
|
|
582
590
|
const imports = file.default ?? file;
|
|
583
591
|
if (!imports) return null;
|
|
584
592
|
if (typeof imports === "function" && imports.prototype) {
|
|
@@ -630,8 +638,12 @@ var deconstructCustomId = (customId) => {
|
|
|
630
638
|
tags
|
|
631
639
|
};
|
|
632
640
|
};
|
|
641
|
+
|
|
642
|
+
// src/core/registry/command.registry.ts
|
|
643
|
+
import { promises as fs2 } from "fs";
|
|
644
|
+
import { join as join2 } from "path";
|
|
633
645
|
var CommandRegistry = class extends BaseRegistry {
|
|
634
|
-
items = new
|
|
646
|
+
items = new Collection();
|
|
635
647
|
/**
|
|
636
648
|
* Load all commands and their subcommands
|
|
637
649
|
*
|
|
@@ -643,12 +655,12 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
643
655
|
if (!await exists(directory)) {
|
|
644
656
|
return this;
|
|
645
657
|
}
|
|
646
|
-
const entries = await
|
|
658
|
+
const entries = await fs2.readdir(directory, { withFileTypes: true });
|
|
647
659
|
for (const entry of entries) {
|
|
648
|
-
const fullPath =
|
|
660
|
+
const fullPath = join2(directory, entry.name);
|
|
649
661
|
if (!entry.isDirectory()) continue;
|
|
650
|
-
const indexFile =
|
|
651
|
-
const indexJs =
|
|
662
|
+
const indexFile = join2(fullPath, "index.ts");
|
|
663
|
+
const indexJs = join2(fullPath, "index.js");
|
|
652
664
|
let commandFile = "";
|
|
653
665
|
if (await exists(indexFile)) commandFile = indexFile;
|
|
654
666
|
else if (await exists(indexJs)) commandFile = indexJs;
|
|
@@ -657,13 +669,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
657
669
|
if (!command) continue;
|
|
658
670
|
if (!command.metadata.active) continue;
|
|
659
671
|
if (command.isSlashCommand()) {
|
|
660
|
-
const subcommandFiles = (await
|
|
672
|
+
const subcommandFiles = (await fs2.readdir(fullPath)).filter(
|
|
661
673
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
662
674
|
);
|
|
663
675
|
for (const file of subcommandFiles) {
|
|
664
|
-
const subcommand = await this.importFile(
|
|
676
|
+
const subcommand = await this.importFile(join2(fullPath, file));
|
|
665
677
|
if (!subcommand) continue;
|
|
666
|
-
if (!subcommand.data.name || !(subcommand.data instanceof
|
|
678
|
+
if (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))
|
|
667
679
|
continue;
|
|
668
680
|
command.data.addSubcommand(subcommand.data);
|
|
669
681
|
command.metadata.subcommands.set(subcommand.data.name, subcommand);
|
|
@@ -674,8 +686,13 @@ var CommandRegistry = class extends BaseRegistry {
|
|
|
674
686
|
return this;
|
|
675
687
|
}
|
|
676
688
|
};
|
|
689
|
+
|
|
690
|
+
// src/core/registry/component.registry.ts
|
|
691
|
+
import { Collection as Collection2 } from "discord.js";
|
|
692
|
+
import { promises as fs3 } from "fs";
|
|
693
|
+
import { join as join3 } from "path";
|
|
677
694
|
var ComponentRegistry = class extends BaseRegistry {
|
|
678
|
-
items = new
|
|
695
|
+
items = new Collection2();
|
|
679
696
|
/**
|
|
680
697
|
* Load all components.
|
|
681
698
|
*
|
|
@@ -687,15 +704,15 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
687
704
|
if (!await exists(directory)) {
|
|
688
705
|
return this;
|
|
689
706
|
}
|
|
690
|
-
const entries = await
|
|
707
|
+
const entries = await fs3.readdir(directory, { withFileTypes: true });
|
|
691
708
|
for (const entry of entries) {
|
|
692
|
-
const fullPath =
|
|
709
|
+
const fullPath = join3(directory, entry.name);
|
|
693
710
|
if (!entry.isDirectory()) continue;
|
|
694
|
-
const componentFiles = (await
|
|
711
|
+
const componentFiles = (await fs3.readdir(fullPath)).filter(
|
|
695
712
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
696
713
|
);
|
|
697
714
|
for (const file of componentFiles) {
|
|
698
|
-
const component = await this.importFile(
|
|
715
|
+
const component = await this.importFile(join3(fullPath, file));
|
|
699
716
|
if (!component) continue;
|
|
700
717
|
const { data } = deconstructCustomId(component.metadata.customId);
|
|
701
718
|
this.items.set(data, component);
|
|
@@ -704,6 +721,14 @@ var ComponentRegistry = class extends BaseRegistry {
|
|
|
704
721
|
return this;
|
|
705
722
|
}
|
|
706
723
|
};
|
|
724
|
+
|
|
725
|
+
// src/core/registry/event.registry.ts
|
|
726
|
+
import { Collection as Collection3 } from "discord.js";
|
|
727
|
+
import { promises as fs4 } from "fs";
|
|
728
|
+
import { join as join4 } from "path";
|
|
729
|
+
|
|
730
|
+
// src/core/events/interactionCreate.ts
|
|
731
|
+
import { ButtonInteraction, ModalSubmitInteraction } from "discord.js";
|
|
707
732
|
var interactionCreate_default = {
|
|
708
733
|
name: "interactionCreate",
|
|
709
734
|
execute: async (client, interaction) => {
|
|
@@ -733,9 +758,9 @@ var interactionCreate_default = {
|
|
|
733
758
|
}
|
|
734
759
|
} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {
|
|
735
760
|
const { componentType, tags, data } = deconstructCustomId(interaction.customId);
|
|
736
|
-
if (componentType === "button" /* Button */ && !(interaction instanceof
|
|
761
|
+
if (componentType === "button" /* Button */ && !(interaction instanceof ButtonInteraction))
|
|
737
762
|
return;
|
|
738
|
-
if (componentType === "modal" /* Modal */ && !(interaction instanceof
|
|
763
|
+
if (componentType === "modal" /* Modal */ && !(interaction instanceof ModalSubmitInteraction))
|
|
739
764
|
return;
|
|
740
765
|
if (tags.includes("awaited")) return;
|
|
741
766
|
const registeredComponents = client.registries.components.get();
|
|
@@ -762,7 +787,7 @@ var interactionCreate_default = {
|
|
|
762
787
|
|
|
763
788
|
// src/core/registry/event.registry.ts
|
|
764
789
|
var EventRegistry = class extends BaseRegistry {
|
|
765
|
-
items = new
|
|
790
|
+
items = new Collection3();
|
|
766
791
|
/**
|
|
767
792
|
* Load all events.
|
|
768
793
|
*
|
|
@@ -772,9 +797,9 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
772
797
|
*/
|
|
773
798
|
async load(directory = getCorePath({ coreDirectory: "events" })) {
|
|
774
799
|
if (!await exists(directory)) return this;
|
|
775
|
-
const entries = await
|
|
800
|
+
const entries = await fs4.readdir(directory, { withFileTypes: true });
|
|
776
801
|
for (const entry of entries) {
|
|
777
|
-
const fullPath =
|
|
802
|
+
const fullPath = join4(directory, entry.name);
|
|
778
803
|
if (entry.isDirectory()) {
|
|
779
804
|
await this.load(fullPath);
|
|
780
805
|
continue;
|
|
@@ -785,7 +810,8 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
785
810
|
this.items.set(event.name, event);
|
|
786
811
|
}
|
|
787
812
|
}
|
|
788
|
-
this.items.
|
|
813
|
+
if (!this.items.get(interactionCreate_default.name))
|
|
814
|
+
this.items.set(interactionCreate_default.name, interactionCreate_default);
|
|
789
815
|
return this;
|
|
790
816
|
}
|
|
791
817
|
/**
|
|
@@ -801,8 +827,13 @@ var EventRegistry = class extends BaseRegistry {
|
|
|
801
827
|
}
|
|
802
828
|
}
|
|
803
829
|
};
|
|
830
|
+
|
|
831
|
+
// src/core/registry/module.registry.ts
|
|
832
|
+
import { Collection as Collection4 } from "discord.js";
|
|
833
|
+
import { promises as fs5 } from "fs";
|
|
834
|
+
import { join as join5 } from "path";
|
|
804
835
|
var ModuleRegistry = class extends BaseRegistry {
|
|
805
|
-
items = new
|
|
836
|
+
items = new Collection4();
|
|
806
837
|
/**
|
|
807
838
|
* Load all modules.
|
|
808
839
|
*
|
|
@@ -814,15 +845,15 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
814
845
|
if (!await exists(directory)) {
|
|
815
846
|
return this;
|
|
816
847
|
}
|
|
817
|
-
const entries = await
|
|
848
|
+
const entries = await fs5.readdir(directory, { withFileTypes: true });
|
|
818
849
|
for (const entry of entries) {
|
|
819
|
-
const fullPath =
|
|
850
|
+
const fullPath = join5(directory, entry.name);
|
|
820
851
|
if (!entry.isDirectory()) continue;
|
|
821
|
-
const moduleFiles = (await
|
|
852
|
+
const moduleFiles = (await fs5.readdir(fullPath)).filter(
|
|
822
853
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
823
854
|
);
|
|
824
855
|
for (const file of moduleFiles) {
|
|
825
|
-
const moduleEvent = await this.importFile(
|
|
856
|
+
const moduleEvent = await this.importFile(join5(fullPath, file));
|
|
826
857
|
if (!moduleEvent || !moduleEvent.events) continue;
|
|
827
858
|
this.items.set(moduleEvent.name, moduleEvent);
|
|
828
859
|
}
|
|
@@ -846,6 +877,9 @@ var ModuleRegistry = class extends BaseRegistry {
|
|
|
846
877
|
}
|
|
847
878
|
}
|
|
848
879
|
};
|
|
880
|
+
|
|
881
|
+
// src/core/registry/index.ts
|
|
882
|
+
import path from "path";
|
|
849
883
|
var registries = () => ({
|
|
850
884
|
commands: new CommandRegistry(),
|
|
851
885
|
components: new ComponentRegistry(),
|
|
@@ -856,16 +890,16 @@ var registries = () => ({
|
|
|
856
890
|
const corePath = options.corePath;
|
|
857
891
|
await Promise.all([
|
|
858
892
|
this.commands.load(
|
|
859
|
-
corePath ? resolveUserPath(
|
|
893
|
+
corePath ? resolveUserPath(path.join(corePath, "commands")) : corePaths?.commandsPath ? resolveUserPath(corePaths.commandsPath) : void 0
|
|
860
894
|
),
|
|
861
895
|
this.components.load(
|
|
862
|
-
corePath ? resolveUserPath(
|
|
896
|
+
corePath ? resolveUserPath(path.join(corePath, "components")) : corePaths?.componentsPath ? resolveUserPath(corePaths.componentsPath) : void 0
|
|
863
897
|
),
|
|
864
898
|
this.events.load(
|
|
865
|
-
corePath ? resolveUserPath(
|
|
899
|
+
corePath ? resolveUserPath(path.join(corePath, "events")) : corePaths?.eventsPath ? resolveUserPath(corePaths.eventsPath) : void 0
|
|
866
900
|
),
|
|
867
901
|
this.modules.load(
|
|
868
|
-
corePath ? resolveUserPath(
|
|
902
|
+
corePath ? resolveUserPath(path.join(corePath, "modules")) : corePaths?.modulesPath ? resolveUserPath(corePaths.modulesPath) : void 0
|
|
869
903
|
)
|
|
870
904
|
]);
|
|
871
905
|
},
|
|
@@ -876,7 +910,7 @@ var registries = () => ({
|
|
|
876
910
|
});
|
|
877
911
|
|
|
878
912
|
// src/core/client/trivious.client.ts
|
|
879
|
-
var TriviousClient = class extends
|
|
913
|
+
var TriviousClient = class extends Client {
|
|
880
914
|
/**
|
|
881
915
|
* Client registries.
|
|
882
916
|
*
|
|
@@ -941,8 +975,8 @@ var TriviousClient = class extends discord_js.Client {
|
|
|
941
975
|
if (!clientId || !token) throw new Error("[Trivious] Invalid clientId or token reference");
|
|
942
976
|
const slashCommands = Array.from(this.registries.commands.get().values());
|
|
943
977
|
const body = [...slashCommands.map((command) => command.toJSON())];
|
|
944
|
-
const rest = new
|
|
945
|
-
await rest.put(
|
|
978
|
+
const rest = new REST({ version: "10" }).setToken(token);
|
|
979
|
+
await rest.put(Routes.applicationCommands(clientId), { body });
|
|
946
980
|
console.log(`[Trivious] Deployed ${body.length} commands`);
|
|
947
981
|
}
|
|
948
982
|
/**
|
|
@@ -957,6 +991,17 @@ var TriviousClient = class extends discord_js.Client {
|
|
|
957
991
|
return this._options.rolePermissions ?? {};
|
|
958
992
|
}
|
|
959
993
|
};
|
|
994
|
+
|
|
995
|
+
// src/core/commands/command.base.ts
|
|
996
|
+
import {
|
|
997
|
+
Collection as Collection5,
|
|
998
|
+
ContextMenuCommandBuilder as ContextMenuCommandBuilder2,
|
|
999
|
+
InteractionContextType,
|
|
1000
|
+
SlashCommandBuilder
|
|
1001
|
+
} from "discord.js";
|
|
1002
|
+
|
|
1003
|
+
// src/core/commands/contextcommand.base.ts
|
|
1004
|
+
import { ContextMenuCommandBuilder } from "discord.js";
|
|
960
1005
|
var ContextMenuCommand = class extends Command {
|
|
961
1006
|
/**
|
|
962
1007
|
* Base command handler.
|
|
@@ -978,7 +1023,7 @@ var ContextMenuCommand = class extends Command {
|
|
|
978
1023
|
if (memberHasPermission) await run(client, interaction);
|
|
979
1024
|
}
|
|
980
1025
|
};
|
|
981
|
-
var ContextMenuBuilder = class extends
|
|
1026
|
+
var ContextMenuBuilder = class extends ContextMenuCommandBuilder {
|
|
982
1027
|
_active = true;
|
|
983
1028
|
_ownerOnly = false;
|
|
984
1029
|
_permission = 0 /* USER */;
|
|
@@ -1054,7 +1099,7 @@ var Command = class {
|
|
|
1054
1099
|
* @returns {this is SlashCommand}
|
|
1055
1100
|
*/
|
|
1056
1101
|
isSlashCommand() {
|
|
1057
|
-
return this.data instanceof
|
|
1102
|
+
return this.data instanceof SlashCommandBuilder && this instanceof SlashCommand;
|
|
1058
1103
|
}
|
|
1059
1104
|
/**
|
|
1060
1105
|
* Returns whether the command is a ContextMenuCommand.
|
|
@@ -1064,7 +1109,7 @@ var Command = class {
|
|
|
1064
1109
|
* @returns {this is ContextMenuCommand}
|
|
1065
1110
|
*/
|
|
1066
1111
|
isContextMenuCommand() {
|
|
1067
|
-
return this.data instanceof
|
|
1112
|
+
return this.data instanceof ContextMenuCommandBuilder2 && this instanceof ContextMenuCommand;
|
|
1068
1113
|
}
|
|
1069
1114
|
/**
|
|
1070
1115
|
* Returns JSON of the command builder.
|
|
@@ -1159,12 +1204,12 @@ var SlashCommand = class extends Command {
|
|
|
1159
1204
|
await subcommand.execute(client, interaction);
|
|
1160
1205
|
}
|
|
1161
1206
|
};
|
|
1162
|
-
var CommandBuilder = class extends
|
|
1207
|
+
var CommandBuilder = class extends SlashCommandBuilder {
|
|
1163
1208
|
_active = true;
|
|
1164
1209
|
_guildOnly = false;
|
|
1165
1210
|
_ownerOnly = false;
|
|
1166
1211
|
_permission = 0 /* USER */;
|
|
1167
|
-
_subcommands = new
|
|
1212
|
+
_subcommands = new Collection5();
|
|
1168
1213
|
_ephemeralReply = false;
|
|
1169
1214
|
/**
|
|
1170
1215
|
* Set the command as disabled.
|
|
@@ -1185,7 +1230,7 @@ var CommandBuilder = class extends discord_js.SlashCommandBuilder {
|
|
|
1185
1230
|
setGuildOnly() {
|
|
1186
1231
|
this._guildOnly = true;
|
|
1187
1232
|
this._permission = 0 /* USER */;
|
|
1188
|
-
this.setContexts(
|
|
1233
|
+
this.setContexts(InteractionContextType.Guild);
|
|
1189
1234
|
return this;
|
|
1190
1235
|
}
|
|
1191
1236
|
/**
|
|
@@ -1240,7 +1285,12 @@ var CommandBuilder = class extends discord_js.SlashCommandBuilder {
|
|
|
1240
1285
|
};
|
|
1241
1286
|
}
|
|
1242
1287
|
};
|
|
1243
|
-
|
|
1288
|
+
|
|
1289
|
+
// src/core/commands/subcommand.base.ts
|
|
1290
|
+
import {
|
|
1291
|
+
SlashCommandSubcommandBuilder as SlashCommandSubcommandBuilder2
|
|
1292
|
+
} from "discord.js";
|
|
1293
|
+
var SubcommandBuilder = class extends SlashCommandSubcommandBuilder2 {
|
|
1244
1294
|
_active = true;
|
|
1245
1295
|
_ownerOnly = false;
|
|
1246
1296
|
_permission = 0 /* USER */;
|
|
@@ -1426,30 +1476,27 @@ var Component = class {
|
|
|
1426
1476
|
}
|
|
1427
1477
|
};
|
|
1428
1478
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
exports.getPermissionLevel = getPermissionLevel;
|
|
1454
|
-
//# sourceMappingURL=index.cjs.map
|
|
1455
|
-
//# sourceMappingURL=index.cjs.map
|
|
1479
|
+
// src/index.ts
|
|
1480
|
+
import { Collection as Collection6, ClientEvents as ClientEvents2 } from "discord.js";
|
|
1481
|
+
export {
|
|
1482
|
+
BaseRegistry,
|
|
1483
|
+
ClientEvents2 as ClientEvents,
|
|
1484
|
+
Collection6 as Collection,
|
|
1485
|
+
Command,
|
|
1486
|
+
CommandBuilder,
|
|
1487
|
+
CommandRegistry,
|
|
1488
|
+
Component,
|
|
1489
|
+
ComponentBuilder,
|
|
1490
|
+
ComponentRegistry,
|
|
1491
|
+
ComponentType,
|
|
1492
|
+
ContextMenuBuilder,
|
|
1493
|
+
ContextMenuCommand,
|
|
1494
|
+
PermissionLevel,
|
|
1495
|
+
SlashCommand,
|
|
1496
|
+
Subcommand,
|
|
1497
|
+
SubcommandBuilder,
|
|
1498
|
+
TriviousClient,
|
|
1499
|
+
deconstructCustomId,
|
|
1500
|
+
getPermissionLevel
|
|
1501
|
+
};
|
|
1502
|
+
//# sourceMappingURL=index.js.map
|