@pikokr/command.ts 4.0.0-dev.fddc66b → 4.0.2-dev.5e853b3
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/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
package/dist/command/Command.js
DELETED
|
@@ -1,25 +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.Command = void 0;
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
class Command {
|
|
9
|
-
constructor(run, argTypes, name, aliases, module, key) {
|
|
10
|
-
this.run = run;
|
|
11
|
-
this.argTypes = argTypes;
|
|
12
|
-
this.name = name;
|
|
13
|
-
this.aliases = aliases;
|
|
14
|
-
this.module = module;
|
|
15
|
-
this.key = key;
|
|
16
|
-
}
|
|
17
|
-
execute(module, args) {
|
|
18
|
-
return this.run.apply(module, args);
|
|
19
|
-
}
|
|
20
|
-
get checks() {
|
|
21
|
-
return Reflect.getMetadata(constants_1.KCommandChecks, this.module, this.key) || [];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.Command = Command;
|
|
25
|
-
//# sourceMappingURL=Command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/command/Command.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,4CAA6C;AAW7C,MAAa,OAAO;IASlB,YACU,GAAa,EACd,QAAoB,EACpB,IAAY,EACZ,OAAoE,EACpE,MAAc,EACd,GAAoB;QALnB,QAAG,GAAH,GAAG,CAAU;QACd,aAAQ,GAAR,QAAQ,CAAY;QACpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAA6D;QACpE,WAAM,GAAN,MAAM,CAAQ;QACd,QAAG,GAAH,GAAG,CAAiB;IAC1B,CAAC;IAfJ,OAAO,CAAC,MAAc,EAAE,IAAW;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACzE,CAAC;CAUF;AAjBD,0BAiBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Collection } from 'discord.js';
|
|
2
|
-
export interface CoolDownAdapter {
|
|
3
|
-
get(id: string): Promise<number | undefined>;
|
|
4
|
-
set(id: string, value: number): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare class DefaultCoolDownAdapter implements CoolDownAdapter {
|
|
7
|
-
map: Collection<string, number>;
|
|
8
|
-
get(id: string): Promise<number | undefined>;
|
|
9
|
-
set(id: string, value: number): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,34 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DefaultCoolDownAdapter = void 0;
|
|
16
|
-
const discord_js_1 = require("discord.js");
|
|
17
|
-
class DefaultCoolDownAdapter {
|
|
18
|
-
constructor() {
|
|
19
|
-
this.map = new discord_js_1.Collection();
|
|
20
|
-
}
|
|
21
|
-
get(id) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return this.map.get(id);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
set(id, value) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
this.map.set(id, value);
|
|
29
|
-
return;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.DefaultCoolDownAdapter = DefaultCoolDownAdapter;
|
|
34
|
-
//# sourceMappingURL=adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/command/cooldown/adapter.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,2CAAuC;AAOvC,MAAa,sBAAsB;IAAnC;QACE,QAAG,GAAG,IAAI,uBAAU,EAAkB,CAAA;IASxC,CAAC;IARO,GAAG,CAAC,EAAU;;YAClB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACzB,CAAC;KAAA;IAEK,GAAG,CAAC,EAAU,EAAE,KAAa;;YACjC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;YACvB,OAAM;QACR,CAAC;KAAA;CACF;AAVD,wDAUC"}
|
|
@@ -1,76 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.coolDown = void 0;
|
|
16
|
-
const utils_1 = require("../utils");
|
|
17
|
-
const type_1 = require("./type");
|
|
18
|
-
const discord_js_1 = require("discord.js");
|
|
19
|
-
const error_1 = require("./error");
|
|
20
|
-
const coolDown = (type, seconds) => utils_1.createCheckDecorator((msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
const a = msg.data.cts.coolDownAdapter;
|
|
22
|
-
const getKey = () => {
|
|
23
|
-
var _a;
|
|
24
|
-
switch (type) {
|
|
25
|
-
case type_1.CoolDownType.USER:
|
|
26
|
-
return msg.author.id;
|
|
27
|
-
case type_1.CoolDownType.GUILD:
|
|
28
|
-
return (msg.guild || msg.author).id;
|
|
29
|
-
case type_1.CoolDownType.CHANNEL:
|
|
30
|
-
return msg.channel.id;
|
|
31
|
-
case type_1.CoolDownType.MEMBER:
|
|
32
|
-
return `${(_a = msg.guild) === null || _a === void 0 ? void 0 : _a.id}.${msg.author.id}`;
|
|
33
|
-
case type_1.CoolDownType.ROLE:
|
|
34
|
-
return (msg.channel instanceof discord_js_1.DMChannel ? msg.channel : msg.member.roles.highest).id;
|
|
35
|
-
case type_1.CoolDownType.CATEGORY:
|
|
36
|
-
return (msg.channel.parent || msg.channel).id;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const key = getKey();
|
|
40
|
-
const data = yield a.get(key);
|
|
41
|
-
const now = Date.now();
|
|
42
|
-
if (!data || !(now - data < seconds * 1000)) {
|
|
43
|
-
yield a.set(key, now);
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
throw new error_1.CoolDownError(new Date(data + seconds * 1000));
|
|
47
|
-
}), (i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
const a = i.data.cts.coolDownAdapter;
|
|
49
|
-
const getKey = () => {
|
|
50
|
-
var _a;
|
|
51
|
-
switch (type) {
|
|
52
|
-
case type_1.CoolDownType.USER:
|
|
53
|
-
return i.user.id;
|
|
54
|
-
case type_1.CoolDownType.GUILD:
|
|
55
|
-
return (i.guild || i.user).id;
|
|
56
|
-
case type_1.CoolDownType.CHANNEL:
|
|
57
|
-
return i.channel.id;
|
|
58
|
-
case type_1.CoolDownType.MEMBER:
|
|
59
|
-
return `${(_a = i.guild) === null || _a === void 0 ? void 0 : _a.id}.${i.user.id}`;
|
|
60
|
-
case type_1.CoolDownType.ROLE:
|
|
61
|
-
return (i.channel instanceof discord_js_1.DMChannel ? i.channel : i.member.roles.highest).id;
|
|
62
|
-
case type_1.CoolDownType.CATEGORY:
|
|
63
|
-
return (i.channel.parent || i.channel).id;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const key = getKey();
|
|
67
|
-
const data = yield a.get(key);
|
|
68
|
-
const now = Date.now();
|
|
69
|
-
if (!data || !(now - data < seconds * 1000)) {
|
|
70
|
-
yield a.set(key, now);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
throw new error_1.CoolDownError(new Date(data + seconds * 1000));
|
|
74
|
-
}));
|
|
75
|
-
exports.coolDown = coolDown;
|
|
76
|
-
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/command/cooldown/decorator.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,oCAA+C;AAC/C,iCAAqC;AACrC,2CAAgE;AAChE,mCAAuC;AAEhC,MAAM,QAAQ,GAAG,CAAC,IAAkB,EAAE,OAAe,EAAE,EAAE,CAC9D,4BAAoB,CAClB,CAAO,GAAG,EAAE,EAAE;IACZ,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAA;IACtC,MAAM,MAAM,GAAG,GAAW,EAAE;;QAC1B,QAAQ,IAAI,EAAE;YACZ,KAAK,mBAAY,CAAC,IAAI;gBACpB,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;YACtB,KAAK,mBAAY,CAAC,KAAK;gBACrB,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAA;YACrC,KAAK,mBAAY,CAAC,OAAO;gBACvB,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;YACvB,KAAK,mBAAY,CAAC,MAAM;gBACtB,OAAO,GAAG,MAAA,GAAG,CAAC,KAAK,0CAAE,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAA;YAC5C,KAAK,mBAAY,CAAC,IAAI;gBACpB,OAAO,CAAC,GAAG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K,mBAAY,CAAC,MAAM;gBACtB,OAAO,GAAG,MAAA,CAAC,CAAC,KAAK,0CAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;YACtC,KAAK,mBAAY,CAAC,IAAI;gBACpB,OAAO,CAAC,CAAC,CAAC,OAAO,YAAY,sBAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC,MAAuB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAA;YACnG,KAAK,mBAAY,CAAC,QAAQ;gBACxB,OAAO,CAAE,CAAC,CAAC,OAAuB,CAAC,MAAM,IAAI,CAAC,CAAC,OAAQ,CAAC,CAAC,EAAE,CAAA;SAC9D;IACH,CAAC,CAAA;IACD,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;IACpB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE;QAC3C,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACrB,OAAO,IAAI,CAAA;KACZ;IACD,MAAM,IAAI,qBAAa,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;AAC1D,CAAC,CAAA,CACF,CAAA;AAxDU,QAAA,QAAQ,YAwDlB"}
|
|
@@ -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.CoolDownError = void 0;
|
|
7
|
-
class CoolDownError extends Error {
|
|
8
|
-
constructor(endsAt) {
|
|
9
|
-
super();
|
|
10
|
-
this.endsAt = endsAt;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.CoolDownError = CoolDownError;
|
|
14
|
-
//# sourceMappingURL=error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/command/cooldown/error.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAmB,MAAY;QAC7B,KAAK,EAAE,CAAA;QADU,WAAM,GAAN,MAAM,CAAM;IAE/B,CAAC;CACF;AAJD,sCAIC"}
|
|
@@ -1,21 +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 __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("./decorator"), exports);
|
|
17
|
-
__exportStar(require("./adapter"), exports);
|
|
18
|
-
__exportStar(require("./decorator"), exports);
|
|
19
|
-
__exportStar(require("./error"), exports);
|
|
20
|
-
__exportStar(require("./type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/command/cooldown/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,8CAA2B;AAC3B,4CAAyB;AACzB,8CAA2B;AAC3B,0CAAuB;AACvB,yCAAsB"}
|
|
@@ -1,16 +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.CoolDownType = void 0;
|
|
7
|
-
var CoolDownType;
|
|
8
|
-
(function (CoolDownType) {
|
|
9
|
-
CoolDownType[CoolDownType["USER"] = 0] = "USER";
|
|
10
|
-
CoolDownType[CoolDownType["CHANNEL"] = 1] = "CHANNEL";
|
|
11
|
-
CoolDownType[CoolDownType["GUILD"] = 2] = "GUILD";
|
|
12
|
-
CoolDownType[CoolDownType["ROLE"] = 3] = "ROLE";
|
|
13
|
-
CoolDownType[CoolDownType["CATEGORY"] = 4] = "CATEGORY";
|
|
14
|
-
CoolDownType[CoolDownType["MEMBER"] = 5] = "MEMBER";
|
|
15
|
-
})(CoolDownType = exports.CoolDownType || (exports.CoolDownType = {}));
|
|
16
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/command/cooldown/type.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,qDAAO,CAAA;IACP,iDAAK,CAAA;IACL,+CAAI,CAAA;IACJ,uDAAQ,CAAA;IACR,mDAAM,CAAA;AACR,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Message, PermissionResolvable } from 'discord.js';
|
|
2
|
-
declare type CommandOptions = {
|
|
3
|
-
name: string;
|
|
4
|
-
aliases: string[] | ((msg: Message) => string[]);
|
|
5
|
-
optionTypes?: any[];
|
|
6
|
-
};
|
|
7
|
-
export declare const command: (options?: Partial<CommandOptions>) => (target: Object, propertyKey: string) => void;
|
|
8
|
-
export declare const argumentConverter: (type: object, requireParameter?: boolean) => (target: Object, propertyKey: string) => void;
|
|
9
|
-
export declare const applicationCommandArgumentConverter: (type: object) => (target: Object, propertyKey: string) => void;
|
|
10
|
-
export declare const optional: ParameterDecorator;
|
|
11
|
-
export declare const rest: ParameterDecorator;
|
|
12
|
-
export declare const ownerOnly: MethodDecorator;
|
|
13
|
-
export declare const guildOnly: MethodDecorator;
|
|
14
|
-
export declare const dmOnly: MethodDecorator;
|
|
15
|
-
export declare const requireUserPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
16
|
-
export declare const requireClientPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
17
|
-
export {};
|
|
@@ -1,141 +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.requireClientPermissions = exports.requireUserPermissions = exports.dmOnly = exports.guildOnly = exports.ownerOnly = exports.rest = exports.optional = exports.applicationCommandArgumentConverter = exports.argumentConverter = exports.command = void 0;
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const Command_1 = require("./Command");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
|
-
const ArgumentConverter_1 = require("./ArgumentConverter");
|
|
11
|
-
const utils_2 = require("./utils");
|
|
12
|
-
const discord_js_1 = require("discord.js");
|
|
13
|
-
const error_1 = require("../error");
|
|
14
|
-
const command = (options = {}) => {
|
|
15
|
-
return (target, propertyKey) => {
|
|
16
|
-
var _a;
|
|
17
|
-
utils_1.checkTarget(target);
|
|
18
|
-
let properties = Reflect.getMetadata(constants_1.KCommands, target);
|
|
19
|
-
const params = (_a = options.optionTypes) !== null && _a !== void 0 ? _a : Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
20
|
-
const optionals = Reflect.getMetadata(constants_1.KOptionals, target, propertyKey) || -1;
|
|
21
|
-
const rest = Reflect.getMetadata(constants_1.KRest, target, propertyKey) || -1;
|
|
22
|
-
const command = new Command_1.Command(Reflect.get(target, propertyKey), params.map((x, i) => ({
|
|
23
|
-
type: x,
|
|
24
|
-
optional: optionals === -1 ? false : optionals <= i,
|
|
25
|
-
rest: rest === -1 ? false : rest === i,
|
|
26
|
-
})), options.name || propertyKey, options.aliases || [], target, propertyKey);
|
|
27
|
-
if (properties) {
|
|
28
|
-
properties.push(command);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
properties = [command];
|
|
32
|
-
Reflect.defineMetadata(constants_1.KCommands, properties, target);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
exports.command = command;
|
|
37
|
-
const argumentConverter = (type, requireParameter = true) => {
|
|
38
|
-
return (target, propertyKey) => {
|
|
39
|
-
utils_1.checkTarget(target);
|
|
40
|
-
let properties = Reflect.getMetadata(constants_1.KArgumentConverters, target);
|
|
41
|
-
const converter = new ArgumentConverter_1.ArgumentConverter(type, Reflect.get(target, propertyKey), !requireParameter);
|
|
42
|
-
if (properties) {
|
|
43
|
-
properties.push(converter);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
properties = [converter];
|
|
47
|
-
Reflect.defineMetadata(constants_1.KArgumentConverters, properties, target);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
exports.argumentConverter = argumentConverter;
|
|
52
|
-
const applicationCommandArgumentConverter = (type) => {
|
|
53
|
-
return (target, propertyKey) => {
|
|
54
|
-
utils_1.checkTarget(target);
|
|
55
|
-
let properties = Reflect.getMetadata(constants_1.KSlashArgumentConverters, target);
|
|
56
|
-
const converter = new ArgumentConverter_1.ApplicationCommandArgumentConverter(type, Reflect.get(target, propertyKey));
|
|
57
|
-
if (properties) {
|
|
58
|
-
properties.push(converter);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
properties = [converter];
|
|
62
|
-
Reflect.defineMetadata(constants_1.KSlashArgumentConverters, properties, target);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
exports.applicationCommandArgumentConverter = applicationCommandArgumentConverter;
|
|
67
|
-
const optional = (target, propertyKey, parameterIndex) => {
|
|
68
|
-
utils_1.checkTarget(target);
|
|
69
|
-
Reflect.defineMetadata(constants_1.KOptionals, parameterIndex, target, propertyKey);
|
|
70
|
-
};
|
|
71
|
-
exports.optional = optional;
|
|
72
|
-
const rest = (target, propertyKey, parameterIndex) => {
|
|
73
|
-
utils_1.checkTarget(target);
|
|
74
|
-
const params = Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
75
|
-
if (params.length - 1 !== parameterIndex)
|
|
76
|
-
throw new Error('Rest decorator must be used at last argument.');
|
|
77
|
-
if (params[parameterIndex] !== String)
|
|
78
|
-
throw new Error('Rest argument type must be "String"');
|
|
79
|
-
Reflect.defineMetadata(constants_1.KRest, parameterIndex, target, propertyKey);
|
|
80
|
-
};
|
|
81
|
-
exports.rest = rest;
|
|
82
|
-
exports.ownerOnly = utils_2.createCheckDecorator((msg) => {
|
|
83
|
-
if (msg.data.cts.owners.includes(msg.author.id))
|
|
84
|
-
return true;
|
|
85
|
-
throw new error_1.OwnerOnlyCommandError();
|
|
86
|
-
}, (i) => {
|
|
87
|
-
if (i.data.cts.owners.includes(i.user.id))
|
|
88
|
-
return true;
|
|
89
|
-
throw new error_1.OwnerOnlyCommandError();
|
|
90
|
-
});
|
|
91
|
-
exports.guildOnly = utils_2.createCheckDecorator((msg) => {
|
|
92
|
-
if (!!msg.guild)
|
|
93
|
-
return true;
|
|
94
|
-
throw new error_1.GuildOnlyCommandError();
|
|
95
|
-
}, (i) => {
|
|
96
|
-
if (!!i.guildId)
|
|
97
|
-
return true;
|
|
98
|
-
throw new error_1.GuildOnlyCommandError();
|
|
99
|
-
});
|
|
100
|
-
exports.dmOnly = utils_2.createCheckDecorator((msg) => {
|
|
101
|
-
if (!msg.guild)
|
|
102
|
-
return true;
|
|
103
|
-
throw new error_1.DMOnlyCommandError();
|
|
104
|
-
}, (i) => {
|
|
105
|
-
if (!i.guildId)
|
|
106
|
-
return true;
|
|
107
|
-
throw new error_1.DMOnlyCommandError();
|
|
108
|
-
});
|
|
109
|
-
const requireUserPermissions = (permission) => utils_2.createCheckDecorator((msg) => {
|
|
110
|
-
if (!msg.guild || !msg.member)
|
|
111
|
-
throw new Error('This command must be used in guild.');
|
|
112
|
-
if (msg.member.permissionsIn(msg.channel).has(permission)) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
throw new error_1.UserPermissionRequired(msg.member, new discord_js_1.Permissions(permission));
|
|
116
|
-
}, (i) => {
|
|
117
|
-
if (!i.guild || !i.member)
|
|
118
|
-
throw new Error('This command must be used in guild.');
|
|
119
|
-
if (!(i.member instanceof discord_js_1.GuildMember) || i.member.permissionsIn(i.channel).has(permission)) {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
throw new error_1.UserPermissionRequired(i.member, new discord_js_1.Permissions(permission));
|
|
123
|
-
});
|
|
124
|
-
exports.requireUserPermissions = requireUserPermissions;
|
|
125
|
-
const requireClientPermissions = (permission) => utils_2.createCheckDecorator((msg) => {
|
|
126
|
-
if (!msg.guild)
|
|
127
|
-
throw new Error('This command must be used in guild.');
|
|
128
|
-
if (msg.guild.me.permissionsIn(msg.channel).has(permission)) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
throw new error_1.ClientPermissionRequired(new discord_js_1.Permissions(permission));
|
|
132
|
-
}, (i) => {
|
|
133
|
-
if (!i.guild)
|
|
134
|
-
throw new Error('This command must be used in guild.');
|
|
135
|
-
if (i.guild.me.permissionsIn(i.channel).has(permission)) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
throw new error_1.ClientPermissionRequired(new discord_js_1.Permissions(permission));
|
|
139
|
-
});
|
|
140
|
-
exports.requireClientPermissions = requireClientPermissions;
|
|
141
|
-
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/command/decorator.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4CAA0G;AAC1G,uCAAmC;AACnC,oCAAsC;AACtC,2DAA4F;AAE5F,mCAA8C;AAC9C,2CAAiG;AACjG,oCAA6I;AAQtI,MAAM,OAAO,GAAG,CAAC,UAAmC,EAAE,EAAE,EAAE;IAC/D,OAAO,CACL,MAAc,EACd,WAAmB,EAEnB,EAAE;;QACF,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,IAAI,UAAU,GAAc,OAAO,CAAC,WAAW,CAAC,qBAAS,EAAE,MAAM,CAAC,CAAA;QAElE,MAAM,MAAM,GAAU,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;QAE1G,MAAM,SAAS,GAAW,OAAO,CAAC,WAAW,CAAC,sBAAU,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;QAEpF,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAK,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;QAElE,MAAM,OAAO,GAAG,IAAI,iBAAO,CACzB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAChC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,IAA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U,CAAC,EAAE;QAC3E,OAAO,IAAI,CAAA;KACZ;IACD,MAAM,IAAI,gCAAwB,CAAC,IAAI,wBAAW,CAAC,UAAU,CAAC,CAAC,CAAA;AACjE,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;IACJ,IAAI,CAAC,CAAC,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACpE,IAAI,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC,aAAa,CAAC,CAAC,CAAC,OAAsB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QACvE,OAAO,IAAI,CAAA;KACZ;IACD,MAAM,IAAI,gCAAwB,CAAC,IAAI,wBAAW,CAAC,UAAU,CAAC,CAAC,CAAA;AACjE,CAAC,CACF,CAAA;AAhBU,QAAA,wBAAwB,4BAgBlC"}
|
package/dist/command/index.d.ts
DELETED
package/dist/command/index.js
DELETED
|
@@ -1,21 +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 __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("./Command"), exports);
|
|
17
|
-
__exportStar(require("./decorator"), exports);
|
|
18
|
-
__exportStar(require("./ArgumentConverter"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
20
|
-
__exportStar(require("./cooldown"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,4CAAyB;AACzB,8CAA2B;AAC3B,sDAAmC;AACnC,0CAAuB;AACvB,6CAA0B"}
|
package/dist/command/utils.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js';
|
|
2
|
-
export declare const createCheckDecorator: (execute: ((msg: Message) => boolean | Promise<boolean>) | null, executeApplicationCommand?: ((i: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction) => boolean | Promise<boolean>) | undefined) => MethodDecorator;
|
package/dist/command/utils.js
DELETED
|
@@ -1,33 +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.createCheckDecorator = void 0;
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const createCheckDecorator = (execute, executeApplicationCommand) => {
|
|
9
|
-
return (target, propertyKey) => {
|
|
10
|
-
if (execute) {
|
|
11
|
-
let properties = Reflect.getMetadata(constants_1.KCommandChecks, target, propertyKey);
|
|
12
|
-
if (properties) {
|
|
13
|
-
properties.push(execute);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
properties = [execute];
|
|
17
|
-
Reflect.defineMetadata(constants_1.KCommandChecks, properties, target, propertyKey);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (executeApplicationCommand) {
|
|
21
|
-
let properties = Reflect.getMetadata(constants_1.KApplicationCommandChecks, target, propertyKey);
|
|
22
|
-
if (properties) {
|
|
23
|
-
properties.push(executeApplicationCommand);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
properties = [executeApplicationCommand];
|
|
27
|
-
Reflect.defineMetadata(constants_1.KApplicationCommandChecks, properties, target, propertyKey);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.createCheckDecorator = createCheckDecorator;
|
|
33
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/command/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,4CAAwE;AAEjE,MAAM,oBAAoB,GAAG,CAClC,OAA8D,EAC9D,yBAAwI,EACvH,EAAE;IACnB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,IAAI,OAAO,EAAE;YACX,IAAI,UAAU,GAAoB,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;YAC1F,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aACzB;iBAAM;gBACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;gBACtB,OAAO,CAAC,cAAc,CAAC,0BAAc,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;aACxE;SACF;QACD,IAAI,yBAAyB,EAAE;YAC7B,IAAI,UAAU,GAAsC,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;YACvH,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;aAC3C;iBAAM;gBACL,UAAU,GAAG,CAAC,yBAAyB,CAAC,CAAA;gBACxC,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;aACnF;SACF;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAxBY,QAAA,oBAAoB,wBAwBhC"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const KCommands: unique symbol;
|
|
2
|
-
export declare const KApplicationCommands: unique symbol;
|
|
3
|
-
export declare const KSlashCommandOptions: unique symbol;
|
|
4
|
-
export declare const KListeners: unique symbol;
|
|
5
|
-
export declare const KModulePath: unique symbol;
|
|
6
|
-
export declare const KListenerExecuteCache: unique symbol;
|
|
7
|
-
export declare const KBuiltInModule: unique symbol;
|
|
8
|
-
export declare const KOptionals: unique symbol;
|
|
9
|
-
export declare const KRest: unique symbol;
|
|
10
|
-
export declare const KArgumentConverters: unique symbol;
|
|
11
|
-
export declare const KSlashArgumentConverters: unique symbol;
|
|
12
|
-
export declare const KCommandChecks: unique symbol;
|
|
13
|
-
export declare const KApplicationCommandChecks: unique symbol;
|
|
14
|
-
export declare const KMessageComponentHandlers: unique symbol;
|
package/dist/constants.js
DELETED
|
@@ -1,21 +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.KMessageComponentHandlers = exports.KApplicationCommandChecks = exports.KCommandChecks = exports.KSlashArgumentConverters = exports.KArgumentConverters = exports.KRest = exports.KOptionals = exports.KBuiltInModule = exports.KListenerExecuteCache = exports.KModulePath = exports.KListeners = exports.KSlashCommandOptions = exports.KApplicationCommands = exports.KCommands = void 0;
|
|
7
|
-
exports.KCommands = Symbol('Command.TS Commands');
|
|
8
|
-
exports.KApplicationCommands = Symbol('Command.TS Slash Commands');
|
|
9
|
-
exports.KSlashCommandOptions = Symbol('Command.TS Slash Command Options');
|
|
10
|
-
exports.KListeners = Symbol('Command.TS Listeners');
|
|
11
|
-
exports.KModulePath = Symbol('Command.TS Module Path');
|
|
12
|
-
exports.KListenerExecuteCache = Symbol('Command.TS Module Identifier');
|
|
13
|
-
exports.KBuiltInModule = Symbol('Command.TS Built-In Module');
|
|
14
|
-
exports.KOptionals = Symbol('Command.TS Optional Parameters');
|
|
15
|
-
exports.KRest = Symbol('Command.TS Rest Parameter');
|
|
16
|
-
exports.KArgumentConverters = Symbol('Command.TS Argument Converter');
|
|
17
|
-
exports.KSlashArgumentConverters = Symbol('Command.TS Slash Argument Converter');
|
|
18
|
-
exports.KCommandChecks = Symbol('Command.TS Command Checks');
|
|
19
|
-
exports.KApplicationCommandChecks = Symbol('Command.TS Slash Command Checks');
|
|
20
|
-
exports.KMessageComponentHandlers = Symbol('Command.TS Message Component Handlers');
|
|
21
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEU,QAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzC,QAAA,oBAAoB,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAE1D,QAAA,oBAAoB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAA;AAEjE,QAAA,UAAU,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAE3C,QAAA,WAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAA;AAE9C,QAAA,qBAAqB,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAA;AAE9D,QAAA,cAAc,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAA;AAErD,QAAA,UAAU,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAA;AAErD,QAAA,KAAK,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAE3C,QAAA,mBAAmB,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAA;AAE7D,QAAA,wBAAwB,GAAG,MAAM,CAAC,qCAAqC,CAAC,CAAA;AAExE,QAAA,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAEpD,QAAA,yBAAyB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAA;AAErE,QAAA,yBAAyB,GAAG,MAAM,CAAC,uCAAuC,CAAC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js';
|
|
2
|
-
import type { Argument } from '../command';
|
|
3
|
-
import type { AppCommandArgument } from '../applicationCommand';
|
|
4
|
-
export declare class ArgumentConverterNotFound extends Error {
|
|
5
|
-
type: Argument;
|
|
6
|
-
msg: Message;
|
|
7
|
-
constructor(type: Argument, msg: Message);
|
|
8
|
-
}
|
|
9
|
-
export declare class ApplicationCommandArgumentConverterNotFound extends Error {
|
|
10
|
-
type: AppCommandArgument;
|
|
11
|
-
interaction: CommandInteraction | ContextMenuInteraction;
|
|
12
|
-
constructor(type: AppCommandArgument, interaction: CommandInteraction | ContextMenuInteraction);
|
|
13
|
-
}
|
|
@@ -1,23 +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.ApplicationCommandArgumentConverterNotFound = exports.ArgumentConverterNotFound = void 0;
|
|
7
|
-
class ArgumentConverterNotFound extends Error {
|
|
8
|
-
constructor(type, msg) {
|
|
9
|
-
super(`Argument converter ${type.type.name} not found.`);
|
|
10
|
-
this.type = type;
|
|
11
|
-
this.msg = msg;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ArgumentConverterNotFound = ArgumentConverterNotFound;
|
|
15
|
-
class ApplicationCommandArgumentConverterNotFound extends Error {
|
|
16
|
-
constructor(type, interaction) {
|
|
17
|
-
super(`Argument converter ${type.type.name} not found.`);
|
|
18
|
-
this.type = type;
|
|
19
|
-
this.interaction = interaction;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.ApplicationCommandArgumentConverterNotFound = ApplicationCommandArgumentConverterNotFound;
|
|
23
|
-
//# sourceMappingURL=ArgumentConverterNotFound.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentConverterNotFound.js","sourceRoot":"","sources":["../../src/error/ArgumentConverterNotFound.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAMH,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAmB,IAAc,EAAS,GAAY;QACpD,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAA;QADvC,SAAI,GAAJ,IAAI,CAAU;QAAS,QAAG,GAAH,GAAG,CAAS;IAEtD,CAAC;CACF;AAJD,8DAIC;AACD,MAAa,2CAA4C,SAAQ,KAAK;IACpE,YAAmB,IAAwB,EAAS,WAAwD;QAC1G,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAA;QADvC,SAAI,GAAJ,IAAI,CAAoB;QAAS,gBAAW,GAAX,WAAW,CAA6C;IAE5G,CAAC;CACF;AAJD,kGAIC"}
|
|
@@ -1,16 +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.ArgumentNotProvided = void 0;
|
|
7
|
-
class ArgumentNotProvided extends Error {
|
|
8
|
-
constructor(index, command, msg) {
|
|
9
|
-
super(`Required argument #${index} not provided.`);
|
|
10
|
-
this.index = index;
|
|
11
|
-
this.command = command;
|
|
12
|
-
this.msg = msg;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.ArgumentNotProvided = ArgumentNotProvided;
|
|
16
|
-
//# sourceMappingURL=ArgumentNotProvided.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentNotProvided.js","sourceRoot":"","sources":["../../src/error/ArgumentNotProvided.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAKH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAmB,KAAa,EAAS,OAAgB,EAAS,GAAY;QAC5E,KAAK,CAAC,sBAAsB,KAAK,gBAAgB,CAAC,CAAA;QADjC,UAAK,GAAL,KAAK,CAAQ;QAAS,YAAO,GAAP,OAAO,CAAS;QAAS,QAAG,GAAH,GAAG,CAAS;IAE9E,CAAC;CACF;AAJD,kDAIC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js';
|
|
2
|
-
import { Command } from '../command';
|
|
3
|
-
import { AppCommand } from '../applicationCommand';
|
|
4
|
-
export declare class CommandCheckFailed extends Error {
|
|
5
|
-
msg: Message;
|
|
6
|
-
command: Command;
|
|
7
|
-
constructor(msg: Message, command: Command);
|
|
8
|
-
}
|
|
9
|
-
export declare class ApplicationCommandCheckFailed extends Error {
|
|
10
|
-
interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction;
|
|
11
|
-
command: AppCommand;
|
|
12
|
-
constructor(interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction, command: AppCommand);
|
|
13
|
-
}
|