@pikokr/command.ts 4.0.0-dev.fddc66b → 4.0.2-dev.425daba
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/.github/workflows/docs.yml +79 -0
- package/.github/workflows/publish.stable.yml +19 -0
- package/dist/index.d.ts +310 -10
- package/dist/index.js +1 -25
- package/dist/index.js.map +1 -1
- package/docs/index.yml +5 -0
- package/package.json +9 -4
- package/scripts/docs.ts +11 -0
- package/src/structures/Registry.ts +30 -12
- package/test/modules/dev.ts +1 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +14 -0
- package/dist/applicationCommand/AppCommand.d.ts +0 -18
- package/dist/applicationCommand/AppCommand.js +0 -25
- package/dist/applicationCommand/AppCommand.js.map +0 -1
- package/dist/applicationCommand/decorator.d.ts +0 -10
- package/dist/applicationCommand/decorator.js +0 -42
- package/dist/applicationCommand/decorator.js.map +0 -1
- package/dist/applicationCommand/index.d.ts +0 -2
- package/dist/applicationCommand/index.js +0 -18
- package/dist/applicationCommand/index.js.map +0 -1
- package/dist/builtinModules/BuiltInModule.d.ts +0 -4
- package/dist/builtinModules/BuiltInModule.js +0 -16
- package/dist/builtinModules/BuiltInModule.js.map +0 -1
- package/dist/builtinModules/BuiltinApplicationCommandConverters.d.ts +0 -8
- package/dist/builtinModules/BuiltinApplicationCommandConverters.js +0 -16
- package/dist/builtinModules/BuiltinApplicationCommandConverters.js.map +0 -1
- package/dist/builtinModules/BuiltinCommandConverters.d.ts +0 -16
- package/dist/builtinModules/BuiltinCommandConverters.js +0 -130
- package/dist/builtinModules/BuiltinCommandConverters.js.map +0 -1
- package/dist/builtinModules/CommandHandler.d.ts +0 -14
- package/dist/builtinModules/CommandHandler.js +0 -360
- package/dist/builtinModules/CommandHandler.js.map +0 -1
- package/dist/builtinModules/index.d.ts +0 -3
- package/dist/builtinModules/index.js +0 -19
- package/dist/builtinModules/index.js.map +0 -1
- package/dist/command/ArgumentConverter.d.ts +0 -15
- package/dist/command/ArgumentConverter.js +0 -28
- package/dist/command/ArgumentConverter.js.map +0 -1
- package/dist/command/Command.d.ts +0 -20
- package/dist/command/Command.js +0 -25
- package/dist/command/Command.js.map +0 -1
- package/dist/command/cooldown/adapter.d.ts +0 -10
- package/dist/command/cooldown/adapter.js +0 -34
- package/dist/command/cooldown/adapter.js.map +0 -1
- package/dist/command/cooldown/decorator.d.ts +0 -2
- package/dist/command/cooldown/decorator.js +0 -76
- package/dist/command/cooldown/decorator.js.map +0 -1
- package/dist/command/cooldown/error.d.ts +0 -4
- package/dist/command/cooldown/error.js +0 -14
- package/dist/command/cooldown/error.js.map +0 -1
- package/dist/command/cooldown/index.d.ts +0 -5
- package/dist/command/cooldown/index.js +0 -21
- package/dist/command/cooldown/index.js.map +0 -1
- package/dist/command/cooldown/type.d.ts +0 -8
- package/dist/command/cooldown/type.js +0 -16
- package/dist/command/cooldown/type.js.map +0 -1
- package/dist/command/decorator.d.ts +0 -17
- package/dist/command/decorator.js +0 -141
- package/dist/command/decorator.js.map +0 -1
- package/dist/command/index.d.ts +0 -5
- package/dist/command/index.js +0 -21
- package/dist/command/index.js.map +0 -1
- package/dist/command/utils.d.ts +0 -2
- package/dist/command/utils.js +0 -33
- package/dist/command/utils.js.map +0 -1
- package/dist/constants.d.ts +0 -14
- package/dist/constants.js +0 -21
- package/dist/constants.js.map +0 -1
- package/dist/error/ArgumentConverterNotFound.d.ts +0 -13
- package/dist/error/ArgumentConverterNotFound.js +0 -23
- package/dist/error/ArgumentConverterNotFound.js.map +0 -1
- package/dist/error/ArgumentNotProvided.d.ts +0 -8
- package/dist/error/ArgumentNotProvided.js +0 -16
- package/dist/error/ArgumentNotProvided.js.map +0 -1
- package/dist/error/CommandCheckFailed.d.ts +0 -13
- package/dist/error/CommandCheckFailed.js +0 -23
- package/dist/error/CommandCheckFailed.js.map +0 -1
- package/dist/error/CommandNotFound.d.ts +0 -7
- package/dist/error/CommandNotFound.js +0 -16
- package/dist/error/CommandNotFound.js.map +0 -1
- package/dist/error/InvalidTargetError.d.ts +0 -3
- package/dist/error/InvalidTargetError.js +0 -13
- package/dist/error/InvalidTargetError.js.map +0 -1
- package/dist/error/ModuleError.d.ts +0 -6
- package/dist/error/ModuleError.js +0 -17
- package/dist/error/ModuleError.js.map +0 -1
- package/dist/error/PermissionRequired.d.ts +0 -10
- package/dist/error/PermissionRequired.js +0 -22
- package/dist/error/PermissionRequired.js.map +0 -1
- package/dist/error/checks/DMOnlyCommand.d.ts +0 -3
- package/dist/error/checks/DMOnlyCommand.js +0 -13
- package/dist/error/checks/DMOnlyCommand.js.map +0 -1
- package/dist/error/checks/GuildOnlyCommand.d.ts +0 -3
- package/dist/error/checks/GuildOnlyCommand.js +0 -13
- package/dist/error/checks/GuildOnlyCommand.js.map +0 -1
- package/dist/error/checks/OwnerOnlyCommand.d.ts +0 -3
- package/dist/error/checks/OwnerOnlyCommand.js +0 -13
- package/dist/error/checks/OwnerOnlyCommand.js.map +0 -1
- package/dist/error/checks/SlashCommandGlobalCheckError.d.ts +0 -5
- package/dist/error/checks/SlashCommandGlobalCheckError.js +0 -14
- package/dist/error/checks/SlashCommandGlobalCheckError.js.map +0 -1
- package/dist/error/checks/index.d.ts +0 -3
- package/dist/error/checks/index.js +0 -19
- package/dist/error/checks/index.js.map +0 -1
- package/dist/error/index.d.ts +0 -7
- package/dist/error/index.js +0 -23
- package/dist/error/index.js.map +0 -1
- package/dist/interface/index.d.ts +0 -1
- package/dist/interface/index.js +0 -6
- package/dist/interface/index.js.map +0 -1
- package/dist/listener/Listener.d.ts +0 -5
- package/dist/listener/Listener.js +0 -14
- package/dist/listener/Listener.js.map +0 -1
- package/dist/listener/decorator.d.ts +0 -2
- package/dist/listener/decorator.js +0 -25
- package/dist/listener/decorator.js.map +0 -1
- package/dist/listener/index.d.ts +0 -2
- package/dist/listener/index.js +0 -18
- package/dist/listener/index.js.map +0 -1
- package/dist/messageComponents/base.d.ts +0 -10
- package/dist/messageComponents/base.js +0 -18
- package/dist/messageComponents/base.js.map +0 -1
- package/dist/messageComponents/button.d.ts +0 -5
- package/dist/messageComponents/button.js +0 -31
- package/dist/messageComponents/button.js.map +0 -1
- package/dist/messageComponents/index.d.ts +0 -2
- package/dist/messageComponents/index.js +0 -18
- package/dist/messageComponents/index.js.map +0 -1
- package/dist/messageComponents/selectMenu.d.ts +0 -5
- package/dist/messageComponents/selectMenu.js +0 -31
- package/dist/messageComponents/selectMenu.js.map +0 -1
- package/dist/structures/CommandClient.d.ts +0 -45
- package/dist/structures/CommandClient.js +0 -97
- package/dist/structures/CommandClient.js.map +0 -1
- package/dist/structures/Module.d.ts +0 -21
- package/dist/structures/Module.js +0 -41
- package/dist/structures/Module.js.map +0 -1
- package/dist/structures/Registry.d.ts +0 -30
- package/dist/structures/Registry.js +0 -229
- package/dist/structures/Registry.js.map +0 -1
- package/dist/structures/index.d.ts +0 -3
- package/dist/structures/index.js +0 -19
- package/dist/structures/index.js.map +0 -1
- package/dist/typings.d.ts +0 -30
- package/dist/typings.js +0 -6
- package/dist/typings.js.map +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -14
- package/dist/utils.js.map +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022 pikokr. Licensed under the MIT license
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
15
|
-
var t = {};
|
|
16
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17
|
-
t[p] = s[p];
|
|
18
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
19
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
20
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
21
|
-
t[p[i]] = s[p[i]];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.CommandClient = void 0;
|
|
30
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
-
const Registry_1 = require("./Registry");
|
|
32
|
-
const discord_js_1 = require("discord.js");
|
|
33
|
-
const builtinModules_1 = require("../builtinModules");
|
|
34
|
-
const command_1 = require("../command");
|
|
35
|
-
const tslog_1 = require("tslog");
|
|
36
|
-
class CommandClient {
|
|
37
|
-
constructor(_a) {
|
|
38
|
-
var { client, coolDownAdapter, logger } = _a, options = __rest(_a, ["client", "coolDownAdapter", "logger"]);
|
|
39
|
-
this.owners = [];
|
|
40
|
-
this.registry = new Registry_1.Registry(this);
|
|
41
|
-
this._isReady = false;
|
|
42
|
-
this.client = client;
|
|
43
|
-
this.coolDownAdapter = coolDownAdapter || new command_1.DefaultCoolDownAdapter();
|
|
44
|
-
this.options = lodash_1.default.merge({
|
|
45
|
-
command: {
|
|
46
|
-
prefix: '!',
|
|
47
|
-
check: () => true,
|
|
48
|
-
globalAliases: () => [],
|
|
49
|
-
},
|
|
50
|
-
owners: 'auto',
|
|
51
|
-
slashCommands: {
|
|
52
|
-
check: () => true,
|
|
53
|
-
},
|
|
54
|
-
applicationCommands: {
|
|
55
|
-
autoSync: false,
|
|
56
|
-
beforeRunCheck: () => { },
|
|
57
|
-
},
|
|
58
|
-
}, options);
|
|
59
|
-
this.logger = logger !== null && logger !== void 0 ? logger : new tslog_1.Logger({ name: 'Command.TS' });
|
|
60
|
-
if (this.options.owners !== 'auto') {
|
|
61
|
-
this.owners = this.options.owners;
|
|
62
|
-
}
|
|
63
|
-
this.client.once('ready', () => this.ready());
|
|
64
|
-
this.registry.registerModule(new builtinModules_1.CommandHandler(this.registry));
|
|
65
|
-
this.registry.registerModule(new builtinModules_1.BuiltinCommandConverters(this));
|
|
66
|
-
this.registry.registerModule(new builtinModules_1.BuiltinApplicationCommandConverters(this));
|
|
67
|
-
}
|
|
68
|
-
fetchOwners() {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
yield ((_a = this.client.application) === null || _a === void 0 ? void 0 : _a.fetch());
|
|
72
|
-
const o = (_b = this.client.application) === null || _b === void 0 ? void 0 : _b.owner;
|
|
73
|
-
if (!o)
|
|
74
|
-
return [];
|
|
75
|
-
if (o instanceof discord_js_1.User)
|
|
76
|
-
return [o.id];
|
|
77
|
-
else
|
|
78
|
-
return o.members.map((x) => x.id);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
ready() {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
if (this._isReady)
|
|
84
|
-
return;
|
|
85
|
-
this._isReady = true;
|
|
86
|
-
if (this.options.owners === 'auto') {
|
|
87
|
-
const owners = yield this.fetchOwners();
|
|
88
|
-
this.owners.push(...owners);
|
|
89
|
-
}
|
|
90
|
-
if (this.options.applicationCommands.autoSync) {
|
|
91
|
-
yield this.registry.syncCommands();
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.CommandClient = CommandClient;
|
|
97
|
-
//# sourceMappingURL=CommandClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandClient.js","sourceRoot":"","sources":["../../src/structures/CommandClient.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsB;AACtB,yCAAqC;AACrC,2CAA8F;AAC9F,sDAAiH;AACjH,wCAAoE;AACpE,iCAA8B;AAgC9B,MAAa,aAAa;IA8BxB,YAAY,EAA4J;YAA5J,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAA2H,EAAtH,OAAO,cAA7C,uCAA+C,CAAF;QA5BzD,WAAM,GAAa,EAAE,CAAA;QACrB,aAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAA;QAKrB,aAAQ,GAAG,KAAK,CAAA;QAuBtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,IAAI,gCAAsB,EAAE,CAAA;QACtE,IAAI,CAAC,OAAO,GAAG,gBAAC,CAAC,KAAK,CACpB;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;gBACjB,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE;aACxB;YACD,MAAM,EAAE,MAAM;YACd,aAAa,EAAE;gBACb,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;aAClB;YACD,mBAAmB,EAAE;gBACnB,QAAQ,EAAE,KAAK;gBACf,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;aACzB;SACF,EACD,OAAO,CACR,CAAA;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,cAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;QAE1D,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YAClC,IAAI,C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AAQ,EAAE;gBAC7C,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAA;aACnC;QACH,CAAC;KAAA;CAmCF;AA/DD,sCA+DC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Command } from '../command';
|
|
2
|
-
import { Listener } from '../listener';
|
|
3
|
-
import { ArgumentConverter, ApplicationCommandArgumentConverter } from '../command';
|
|
4
|
-
import { AppCommand } from '../applicationCommand';
|
|
5
|
-
import { CommandClient } from './CommandClient';
|
|
6
|
-
import { MessageComponentHandler } from '../messageComponents/base';
|
|
7
|
-
export declare abstract class Module {
|
|
8
|
-
commandClient: CommandClient;
|
|
9
|
-
get logger(): import("tslog").Logger;
|
|
10
|
-
get commands(): Command[];
|
|
11
|
-
get listeners(): Listener[];
|
|
12
|
-
get argumentConverters(): ArgumentConverter[];
|
|
13
|
-
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
14
|
-
get applicationCommands(): AppCommand[];
|
|
15
|
-
get messageComponentHandlers(): MessageComponentHandler[];
|
|
16
|
-
get path(): string | undefined;
|
|
17
|
-
load(): void;
|
|
18
|
-
unload(): void;
|
|
19
|
-
beforeReload(): void;
|
|
20
|
-
afterReload(): void;
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022 pikokr. Licensed under the MIT license
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Module = void 0;
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
class Module {
|
|
9
|
-
get logger() {
|
|
10
|
-
return this.commandClient.logger.getChildLogger({
|
|
11
|
-
name: this.constructor.name,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
get commands() {
|
|
15
|
-
return Reflect.getMetadata(constants_1.KCommands, this) || [];
|
|
16
|
-
}
|
|
17
|
-
get listeners() {
|
|
18
|
-
return Reflect.getMetadata(constants_1.KListeners, this) || [];
|
|
19
|
-
}
|
|
20
|
-
get argumentConverters() {
|
|
21
|
-
return Reflect.getMetadata(constants_1.KArgumentConverters, this) || [];
|
|
22
|
-
}
|
|
23
|
-
get applicationCommandArgumentConverters() {
|
|
24
|
-
return Reflect.getMetadata(constants_1.KSlashArgumentConverters, this) || [];
|
|
25
|
-
}
|
|
26
|
-
get applicationCommands() {
|
|
27
|
-
return Reflect.getMetadata(constants_1.KApplicationCommands, this) || [];
|
|
28
|
-
}
|
|
29
|
-
get messageComponentHandlers() {
|
|
30
|
-
return Reflect.getMetadata(constants_1.KMessageComponentHandlers, this) || [];
|
|
31
|
-
}
|
|
32
|
-
get path() {
|
|
33
|
-
return Reflect.getMetadata(constants_1.KModulePath, this);
|
|
34
|
-
}
|
|
35
|
-
load() { }
|
|
36
|
-
unload() { }
|
|
37
|
-
beforeReload() { }
|
|
38
|
-
afterReload() { }
|
|
39
|
-
}
|
|
40
|
-
exports.Module = Module;
|
|
41
|
-
//# sourceMappingURL=Module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Module.js","sourceRoot":"","sources":["../../src/structures/Module.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4CAAiK;AAQjK,MAAsB,MAAM;IAG1B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC;YAC9C,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;SAC5B,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,OAAO,CAAC,WAAW,CAAC,qBAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,IAAI,SAAS;QACX,OAAO,OAAO,CAAC,WAAW,CAAC,sBAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACpD,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,OAAO,CAAC,WAAW,CAAC,+BAAmB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC7D,CAAC;IAED,IAAI,oCAAoC;QACtC,OAAO,OAAO,CAAC,WAAW,CAAC,oCAAwB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAClE,CAAC;IAED,IAAI,mBAAmB;QACrB,OAAO,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC9D,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,OAAO,CAAC,WAAW,CAAC,uBAAW,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC;IAED,IAAI,KAAI,CAAC;IACT,MAAM,KAAI,CAAC;IACX,YAAY,KAAI,CAAC;IACjB,WAAW,KAAI,CAAC;CACjB;AAzCD,wBAyCC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CommandClient } from './CommandClient';
|
|
2
|
-
import { Module } from './Module';
|
|
3
|
-
import { Command, ApplicationCommandArgumentConverter } from '../command';
|
|
4
|
-
import { Collection } from 'discord.js';
|
|
5
|
-
import { ArgumentConverter } from '../command';
|
|
6
|
-
import { AppCommand } from '../applicationCommand';
|
|
7
|
-
import { MessageComponentHandler } from '../messageComponents/base';
|
|
8
|
-
export declare class Registry {
|
|
9
|
-
client: CommandClient;
|
|
10
|
-
constructor(client: CommandClient);
|
|
11
|
-
modules: Collection<symbol, Module>;
|
|
12
|
-
private get logger();
|
|
13
|
-
get commands(): Command[];
|
|
14
|
-
get argumentConverters(): ArgumentConverter[];
|
|
15
|
-
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
16
|
-
get applicationCommands(): AppCommand[];
|
|
17
|
-
get messageComponentHandlers(): MessageComponentHandler[];
|
|
18
|
-
registerModule(module: Module): Module;
|
|
19
|
-
loadModulesIn(dir: string, absolute?: boolean): Promise<void>;
|
|
20
|
-
loadModule(file: string, absolute?: boolean): Promise<Module>;
|
|
21
|
-
syncCommands(): Promise<void>;
|
|
22
|
-
unregisterModule(module: Module): Promise<Module>;
|
|
23
|
-
unloadModule(module: Module): Promise<void>;
|
|
24
|
-
reloadModule(module: Module): Promise<boolean>;
|
|
25
|
-
reloadAll(): Promise<{
|
|
26
|
-
path: string;
|
|
27
|
-
success: boolean;
|
|
28
|
-
error?: Error | undefined;
|
|
29
|
-
}[]>;
|
|
30
|
-
}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022 pikokr. Licensed under the MIT license
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
25
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.Registry = void 0;
|
|
38
|
-
const Module_1 = require("./Module");
|
|
39
|
-
const constants_1 = require("../constants");
|
|
40
|
-
const path_1 = __importDefault(require("path"));
|
|
41
|
-
const error_1 = require("../error");
|
|
42
|
-
const discord_js_1 = require("discord.js");
|
|
43
|
-
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
44
|
-
const fs = __importStar(require("fs"));
|
|
45
|
-
class Registry {
|
|
46
|
-
constructor(client) {
|
|
47
|
-
this.client = client;
|
|
48
|
-
this.modules = new discord_js_1.Collection();
|
|
49
|
-
}
|
|
50
|
-
get logger() {
|
|
51
|
-
return this.client.logger.getChildLogger({
|
|
52
|
-
name: 'Registry',
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
get commands() {
|
|
56
|
-
const result = [];
|
|
57
|
-
for (const [, module] of this.modules) {
|
|
58
|
-
result.push(...module.commands);
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
get argumentConverters() {
|
|
63
|
-
const result = [];
|
|
64
|
-
for (const [, module] of this.modules) {
|
|
65
|
-
result.push(...module.argumentConverters);
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
get applicationCommandArgumentConverters() {
|
|
70
|
-
const result = [];
|
|
71
|
-
for (const [, module] of this.modules) {
|
|
72
|
-
result.push(...module.applicationCommandArgumentConverters);
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
get applicationCommands() {
|
|
77
|
-
const result = [];
|
|
78
|
-
for (const [, module] of this.modules) {
|
|
79
|
-
result.push(...module.applicationCommands);
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
get messageComponentHandlers() {
|
|
84
|
-
const result = [];
|
|
85
|
-
for (const [, module] of this.modules) {
|
|
86
|
-
result.push(...module.messageComponentHandlers);
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
registerModule(module) {
|
|
91
|
-
module.commandClient = this.client;
|
|
92
|
-
this.modules.set(Symbol(module.constructor.name), module);
|
|
93
|
-
const list = [];
|
|
94
|
-
for (const listener of module.listeners) {
|
|
95
|
-
const bound = listener.execute.bind(module);
|
|
96
|
-
list.push({ event: listener.name, execute: bound });
|
|
97
|
-
this.client.client.on(listener.name, bound);
|
|
98
|
-
}
|
|
99
|
-
Reflect.defineMetadata(constants_1.KListenerExecuteCache, list, module);
|
|
100
|
-
return module;
|
|
101
|
-
}
|
|
102
|
-
loadModulesIn(dir, absolute = false) {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
let p = absolute ? dir : path_1.default.join(require.main.path, dir);
|
|
105
|
-
for (const i of walk_sync_1.default(p)) {
|
|
106
|
-
if (fs.lstatSync(path_1.default.join(p, i)).isFile()) {
|
|
107
|
-
if (i.endsWith('.map'))
|
|
108
|
-
continue;
|
|
109
|
-
yield this.loadModule(path_1.default.join(p, i), true);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
loadModule(file, absolute = false) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
let p = absolute ? file : path_1.default.join(require.main.path, file);
|
|
117
|
-
let m;
|
|
118
|
-
try {
|
|
119
|
-
m = require(p);
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
throw new error_1.ModuleLoadError(p, e);
|
|
123
|
-
}
|
|
124
|
-
if (m.loaded)
|
|
125
|
-
throw new Error('MODULE_ALREADY_LOADED');
|
|
126
|
-
if (!m.install)
|
|
127
|
-
throw new error_1.InvalidModuleError('Install function not found.');
|
|
128
|
-
const mod = m.install(this.client);
|
|
129
|
-
if (!(mod instanceof Module_1.Module))
|
|
130
|
-
throw new error_1.InvalidTargetError();
|
|
131
|
-
Reflect.defineMetadata(constants_1.KModulePath, require.resolve(p), mod);
|
|
132
|
-
this.registerModule(mod);
|
|
133
|
-
yield mod.load();
|
|
134
|
-
m.loaded = true;
|
|
135
|
-
return mod;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
syncCommands() {
|
|
139
|
-
var _a;
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
this.logger.debug(`Syncing commands...`);
|
|
142
|
-
const commands = this.applicationCommands.filter((x) => !x.guild);
|
|
143
|
-
const guild = this.client.options.applicationCommands.guild;
|
|
144
|
-
if (guild) {
|
|
145
|
-
const syncForGuild = (g) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
this.logger.debug(`Syncing for guild ${g.name}(${g.id})`);
|
|
147
|
-
const commandsToRegister = [
|
|
148
|
-
...commands.map((x) => x.command),
|
|
149
|
-
...this.applicationCommands.filter((y) => { var _a; return y.guild === g.id || ((_a = y.guild) === null || _a === void 0 ? void 0 : _a.includes(g.id)) || false; }).map((x) => x.command),
|
|
150
|
-
];
|
|
151
|
-
this.logger.debug(`Command List: ${commandsToRegister.map((x) => x.name).join(', ')}`);
|
|
152
|
-
yield g.commands.set(commandsToRegister);
|
|
153
|
-
});
|
|
154
|
-
if (typeof guild === 'string') {
|
|
155
|
-
yield syncForGuild(yield this.client.client.guilds.fetch(guild));
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
for (const g of guild) {
|
|
159
|
-
yield syncForGuild(yield this.client.client.guilds.fetch(g));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
this.logger.debug('Syncing global...');
|
|
165
|
-
yield ((_a = this.client.client.application) === null || _a === void 0 ? void 0 : _a.commands.set(commands.map((x) => x.command)));
|
|
166
|
-
}
|
|
167
|
-
this.logger.debug('Syncing ended.');
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
unregisterModule(module) {
|
|
171
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
if (Reflect.getMetadata(constants_1.KBuiltInModule, module))
|
|
173
|
-
throw new Error('Built-in modules cannot be unloaded');
|
|
174
|
-
const symbol = this.modules.findKey((x) => x === module);
|
|
175
|
-
if (!symbol)
|
|
176
|
-
return module;
|
|
177
|
-
yield module.unload();
|
|
178
|
-
const list = Reflect.getMetadata(constants_1.KListenerExecuteCache, module);
|
|
179
|
-
for (const listener of list) {
|
|
180
|
-
this.client.client.removeListener(listener.event, listener.execute);
|
|
181
|
-
}
|
|
182
|
-
this.modules.delete(symbol);
|
|
183
|
-
return module;
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
unloadModule(module) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
const p = Reflect.getMetadata(constants_1.KModulePath, module);
|
|
189
|
-
if (!p)
|
|
190
|
-
throw new error_1.InvalidModuleError('This module is not loaded by loadModule.');
|
|
191
|
-
yield this.unregisterModule(module);
|
|
192
|
-
delete require.cache[p];
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
reloadModule(module) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
yield module.beforeReload();
|
|
198
|
-
const p = Reflect.getMetadata(constants_1.KModulePath, module);
|
|
199
|
-
yield this.unloadModule(module);
|
|
200
|
-
const mod = yield this.loadModule(p, true);
|
|
201
|
-
yield mod.afterReload();
|
|
202
|
-
return true;
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
reloadAll() {
|
|
206
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
const results = [];
|
|
208
|
-
for (const [, module] of this.modules.filter((x) => !!x.path && !Reflect.getMetadata(constants_1.KBuiltInModule, x))) {
|
|
209
|
-
try {
|
|
210
|
-
yield this.reloadModule(module);
|
|
211
|
-
results.push({
|
|
212
|
-
path: module.path,
|
|
213
|
-
success: true,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
catch (e) {
|
|
217
|
-
results.push({
|
|
218
|
-
error: e,
|
|
219
|
-
path: module.path,
|
|
220
|
-
success: false,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return results;
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
exports.Registry = Registry;
|
|
229
|
-
//# sourceMappingURL=Registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../src/structures/Registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,qCAAiC;AAEjC,4CAAiF;AACjF,gDAAuB;AACvB,oCAAkF;AAClF,2CAA8C;AAC9C,0DAAgC;AAGhC,uCAAwB;AAQxB,MAAa,QAAQ;IACnB,YAAmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QAExC,YAAO,GAA+B,IAAI,uBAAU,EAAE,CAAA;IAFX,CAAC;IAI5C,IAAY,MAAM;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;YACvC,IAAI,EAAE,UAAU;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,MAAM,GAAc,EAAE,CAAA;QAE5B,KAAK,MAAM,CAAC,EAAE,MAAM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
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022 pikokr. Licensed under the MIT license
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
__exportStar(require("./Module"), exports);
|
|
17
|
-
__exportStar(require("./CommandClient"), exports);
|
|
18
|
-
__exportStar(require("./Registry"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,2CAAwB;AACxB,kDAA+B;AAC/B,6CAA0B"}
|
package/dist/typings.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Command } from './command';
|
|
2
|
-
import { CommandClient } from './structures';
|
|
3
|
-
import { AppCommand } from './applicationCommand';
|
|
4
|
-
declare module 'discord.js' {
|
|
5
|
-
interface Message {
|
|
6
|
-
data: {
|
|
7
|
-
command: Command | null;
|
|
8
|
-
prefix: string;
|
|
9
|
-
cts: CommandClient;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
interface CommandInteraction {
|
|
13
|
-
data: {
|
|
14
|
-
command: AppCommand;
|
|
15
|
-
cts: CommandClient;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
interface MessageComponentInteraction {
|
|
19
|
-
data: {
|
|
20
|
-
command: AppCommand;
|
|
21
|
-
cts: CommandClient;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
interface ContextMenuInteraction {
|
|
25
|
-
data: {
|
|
26
|
-
command: AppCommand;
|
|
27
|
-
cts: CommandClient;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
package/dist/typings.js
DELETED
package/dist/typings.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typings.js","sourceRoot":"","sources":["../src/typings.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const checkTarget: (target: Object) => void;
|
package/dist/utils.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022 pikokr. Licensed under the MIT license
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkTarget = void 0;
|
|
7
|
-
const structures_1 = require("./structures");
|
|
8
|
-
const error_1 = require("./error");
|
|
9
|
-
const checkTarget = (target) => {
|
|
10
|
-
if (!(target instanceof structures_1.Module))
|
|
11
|
-
throw new error_1.InvalidTargetError();
|
|
12
|
-
};
|
|
13
|
-
exports.checkTarget = checkTarget;
|
|
14
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,6CAAqC;AACrC,mCAA4C;AAErC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,IAAI,CAAC,CAAC,MAAM,YAAY,mBAAM,CAAC;QAAE,MAAM,IAAI,0BAAkB,EAAE,CAAA;AACjE,CAAC,CAAA;AAFY,QAAA,WAAW,eAEvB"}
|