@pikokr/command.ts 3.2.4 → 4.0.1-dev.1c9fbc0
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.d.ts +310 -9
- package/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/publish-version.js +7 -3
- package/src/applicationCommand/AppCommand.ts +32 -0
- package/src/{slashCommand → applicationCommand}/decorator.ts +14 -10
- package/src/applicationCommand/index.ts +6 -0
- package/src/builtinModules/BuiltInModule.ts +4 -0
- package/src/builtinModules/BuiltinApplicationCommandConverters.ts +16 -0
- package/src/builtinModules/BuiltinCommandConverters.ts +4 -0
- package/src/builtinModules/CommandHandler.ts +178 -22
- package/src/builtinModules/index.ts +5 -1
- package/src/command/ArgumentConverter.ts +7 -3
- package/src/command/Command.ts +6 -2
- package/src/command/cooldown/adapter.ts +4 -0
- package/src/command/cooldown/decorator.ts +4 -0
- package/src/command/cooldown/error.ts +4 -0
- package/src/command/cooldown/index.ts +4 -0
- package/src/command/cooldown/type.ts +4 -0
- package/src/command/decorator.ts +10 -5
- package/src/command/index.ts +4 -0
- package/src/command/utils.ts +13 -9
- package/src/constants.ts +8 -2
- package/src/error/ArgumentConverterNotFound.ts +8 -4
- package/src/error/ArgumentNotProvided.ts +4 -0
- package/src/error/CommandCheckFailed.ts +8 -4
- package/src/error/CommandNotFound.ts +4 -0
- package/src/error/InvalidTargetError.ts +4 -0
- package/src/error/ModuleError.ts +4 -0
- package/src/error/PermissionRequired.ts +4 -0
- package/src/error/checks/DMOnlyCommand.ts +4 -0
- package/src/error/checks/GuildOnlyCommand.ts +4 -0
- package/src/error/checks/OwnerOnlyCommand.ts +4 -0
- package/src/error/checks/SlashCommandGlobalCheckError.ts +11 -0
- package/src/error/checks/index.ts +4 -0
- package/src/error/index.ts +4 -0
- package/src/index.ts +6 -1
- package/src/interface/index.ts +4 -0
- package/src/listener/Listener.ts +4 -0
- package/src/listener/decorator.ts +4 -0
- package/src/listener/index.ts +4 -0
- package/src/messageComponents/base.ts +16 -0
- package/src/messageComponents/button.ts +30 -0
- package/src/messageComponents/index.ts +6 -0
- package/src/messageComponents/selectMenu.ts +30 -0
- package/src/structures/CommandClient.ts +22 -10
- package/src/structures/Module.ts +15 -6
- package/src/structures/Registry.ts +59 -28
- package/src/structures/index.ts +4 -0
- package/src/typings.ts +18 -2
- package/src/utils.ts +4 -0
- package/test/index.ts +6 -2
- package/test/modules/dev.ts +13 -5
- package/test/modules/test.ts +92 -15
- package/tsup.config.ts +14 -0
- package/dist/builtinModules/BuiltInModule.d.ts +0 -4
- package/dist/builtinModules/BuiltInModule.js +0 -13
- package/dist/builtinModules/BuiltInModule.js.map +0 -1
- package/dist/builtinModules/BuiltinCommandConverters.d.ts +0 -16
- package/dist/builtinModules/BuiltinCommandConverters.js +0 -127
- package/dist/builtinModules/BuiltinCommandConverters.js.map +0 -1
- package/dist/builtinModules/BuiltinSlashCommandConverters.d.ts +0 -10
- package/dist/builtinModules/BuiltinSlashCommandConverters.js +0 -42
- package/dist/builtinModules/BuiltinSlashCommandConverters.js.map +0 -1
- package/dist/builtinModules/CommandHandler.d.ts +0 -11
- package/dist/builtinModules/CommandHandler.js +0 -230
- package/dist/builtinModules/CommandHandler.js.map +0 -1
- package/dist/builtinModules/index.d.ts +0 -3
- package/dist/builtinModules/index.js +0 -16
- package/dist/builtinModules/index.js.map +0 -1
- package/dist/command/ArgumentConverter.d.ts +0 -15
- package/dist/command/ArgumentConverter.js +0 -25
- package/dist/command/ArgumentConverter.js.map +0 -1
- package/dist/command/Command.d.ts +0 -20
- package/dist/command/Command.js +0 -22
- package/dist/command/Command.js.map +0 -1
- package/dist/command/cooldown/adapter.d.ts +0 -10
- package/dist/command/cooldown/adapter.js +0 -31
- 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 -73
- 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 -11
- 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 -18
- 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 -13
- package/dist/command/cooldown/type.js.map +0 -1
- package/dist/command/decorator.d.ts +0 -16
- package/dist/command/decorator.js +0 -137
- package/dist/command/decorator.js.map +0 -1
- package/dist/command/index.d.ts +0 -5
- package/dist/command/index.js +0 -18
- package/dist/command/index.js.map +0 -1
- package/dist/command/utils.d.ts +0 -2
- package/dist/command/utils.js +0 -30
- package/dist/command/utils.js.map +0 -1
- package/dist/constants.d.ts +0 -13
- package/dist/constants.js +0 -17
- package/dist/constants.js.map +0 -1
- package/dist/error/ArgumentConverterNotFound.d.ts +0 -13
- package/dist/error/ArgumentConverterNotFound.js +0 -20
- package/dist/error/ArgumentConverterNotFound.js.map +0 -1
- package/dist/error/ArgumentNotProvided.d.ts +0 -8
- package/dist/error/ArgumentNotProvided.js +0 -13
- package/dist/error/ArgumentNotProvided.js.map +0 -1
- package/dist/error/CommandCheckFailed.d.ts +0 -13
- package/dist/error/CommandCheckFailed.js +0 -20
- package/dist/error/CommandCheckFailed.js.map +0 -1
- package/dist/error/CommandNotFound.d.ts +0 -7
- package/dist/error/CommandNotFound.js +0 -13
- package/dist/error/CommandNotFound.js.map +0 -1
- package/dist/error/InvalidTargetError.d.ts +0 -3
- package/dist/error/InvalidTargetError.js +0 -10
- package/dist/error/InvalidTargetError.js.map +0 -1
- package/dist/error/ModuleError.d.ts +0 -6
- package/dist/error/ModuleError.js +0 -14
- package/dist/error/ModuleError.js.map +0 -1
- package/dist/error/PermissionRequired.d.ts +0 -10
- package/dist/error/PermissionRequired.js +0 -19
- package/dist/error/PermissionRequired.js.map +0 -1
- package/dist/error/checks/DMOnlyCommand.d.ts +0 -3
- package/dist/error/checks/DMOnlyCommand.js +0 -10
- 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 -10
- 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 -10
- package/dist/error/checks/OwnerOnlyCommand.js.map +0 -1
- package/dist/error/checks/index.d.ts +0 -3
- package/dist/error/checks/index.js +0 -16
- package/dist/error/checks/index.js.map +0 -1
- package/dist/error/index.d.ts +0 -7
- package/dist/error/index.js +0 -20
- package/dist/error/index.js.map +0 -1
- package/dist/interface/index.d.ts +0 -1
- package/dist/interface/index.js +0 -4
- package/dist/interface/index.js.map +0 -1
- package/dist/listener/Listener.d.ts +0 -5
- package/dist/listener/Listener.js +0 -11
- package/dist/listener/Listener.js.map +0 -1
- package/dist/listener/decorator.d.ts +0 -2
- package/dist/listener/decorator.js +0 -22
- package/dist/listener/decorator.js.map +0 -1
- package/dist/listener/index.d.ts +0 -2
- package/dist/listener/index.js +0 -15
- package/dist/listener/index.js.map +0 -1
- package/dist/slashCommand/SlashCommand.d.ts +0 -19
- package/dist/slashCommand/SlashCommand.js +0 -22
- package/dist/slashCommand/SlashCommand.js.map +0 -1
- package/dist/slashCommand/decorator.d.ts +0 -10
- package/dist/slashCommand/decorator.js +0 -38
- package/dist/slashCommand/decorator.js.map +0 -1
- package/dist/slashCommand/index.d.ts +0 -2
- package/dist/slashCommand/index.js +0 -15
- package/dist/slashCommand/index.js.map +0 -1
- package/dist/structures/CommandClient.d.ts +0 -40
- package/dist/structures/CommandClient.js +0 -94
- package/dist/structures/CommandClient.js.map +0 -1
- package/dist/structures/Module.d.ts +0 -19
- package/dist/structures/Module.js +0 -35
- package/dist/structures/Module.js.map +0 -1
- package/dist/structures/Registry.d.ts +0 -28
- package/dist/structures/Registry.js +0 -223
- package/dist/structures/Registry.js.map +0 -1
- package/dist/structures/index.d.ts +0 -3
- package/dist/structures/index.js +0 -16
- package/dist/structures/index.js.map +0 -1
- package/dist/typings.d.ts +0 -18
- package/dist/typings.js +0 -3
- package/dist/typings.js.map +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -11
- package/dist/utils.js.map +0 -1
- package/src/builtinModules/BuiltinSlashCommandConverters.ts +0 -23
- package/src/slashCommand/SlashCommand.ts +0 -29
- package/src/slashCommand/index.ts +0 -2
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./CommandHandler"), exports);
|
|
14
|
-
__exportStar(require("./BuiltinCommandConverters"), exports);
|
|
15
|
-
__exportStar(require("./BuiltinSlashCommandConverters"), exports);
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builtinModules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgC;AAChC,6DAA0C;AAC1C,kEAA+C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Module } from '../structures';
|
|
2
|
-
import { CommandInteraction, Message } from 'discord.js';
|
|
3
|
-
export declare class ArgumentConverter {
|
|
4
|
-
type: object;
|
|
5
|
-
private run;
|
|
6
|
-
withoutParameter: boolean;
|
|
7
|
-
execute(module: Module, msg: Message, arg?: string): any;
|
|
8
|
-
constructor(type: object, run: Function, withoutParameter: boolean);
|
|
9
|
-
}
|
|
10
|
-
export declare class SlashArgumentConverter {
|
|
11
|
-
type: object;
|
|
12
|
-
private run;
|
|
13
|
-
execute(module: Module, interaction: CommandInteraction): any;
|
|
14
|
-
constructor(type: object, run: Function);
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashArgumentConverter = exports.ArgumentConverter = void 0;
|
|
4
|
-
class ArgumentConverter {
|
|
5
|
-
constructor(type, run, withoutParameter) {
|
|
6
|
-
this.type = type;
|
|
7
|
-
this.run = run;
|
|
8
|
-
this.withoutParameter = withoutParameter;
|
|
9
|
-
}
|
|
10
|
-
execute(module, msg, arg) {
|
|
11
|
-
return this.run.apply(module, [msg, arg]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ArgumentConverter = ArgumentConverter;
|
|
15
|
-
class SlashArgumentConverter {
|
|
16
|
-
constructor(type, run) {
|
|
17
|
-
this.type = type;
|
|
18
|
-
this.run = run;
|
|
19
|
-
}
|
|
20
|
-
execute(module, interaction) {
|
|
21
|
-
return this.run.apply(module, [interaction]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.SlashArgumentConverter = SlashArgumentConverter;
|
|
25
|
-
//# sourceMappingURL=ArgumentConverter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentConverter.js","sourceRoot":"","sources":["../../src/command/ArgumentConverter.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAK5B,YAAmB,IAAY,EAAU,GAAa,EAAS,gBAAyB;QAArE,SAAI,GAAJ,IAAI,CAAQ;QAAU,QAAG,GAAH,GAAG,CAAU;QAAS,qBAAgB,GAAhB,gBAAgB,CAAS;IAAG,CAAC;IAJ5F,OAAO,CAAC,MAAc,EAAE,GAAY,EAAE,GAAY;QAChD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IAC3C,CAAC;CAGF;AAND,8CAMC;AAED,MAAa,sBAAsB;IAKjC,YAAmB,IAAY,EAAU,GAAa;QAAnC,SAAI,GAAJ,IAAI,CAAQ;QAAU,QAAG,GAAH,GAAG,CAAU;IAAG,CAAC;IAJ1D,OAAO,CAAC,MAAc,EAAE,WAA+B;QACrD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAC9C,CAAC;CAGF;AAND,wDAMC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Module } from '../structures';
|
|
2
|
-
import { CommandInteraction, Message } from 'discord.js';
|
|
3
|
-
export declare type Argument = {
|
|
4
|
-
optional: boolean;
|
|
5
|
-
type: any;
|
|
6
|
-
rest: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare type CheckFunction = (msg: Message) => boolean | Promise<boolean>;
|
|
9
|
-
export declare type SlashCheckFunction = (i: CommandInteraction) => boolean | Promise<boolean>;
|
|
10
|
-
export declare class Command {
|
|
11
|
-
private run;
|
|
12
|
-
argTypes: Argument[];
|
|
13
|
-
name: string;
|
|
14
|
-
aliases: string[] | ((msg: Message) => string[] | Promise<string[]>);
|
|
15
|
-
module: Module;
|
|
16
|
-
key: symbol | string;
|
|
17
|
-
execute(module: Module, args: any[]): any;
|
|
18
|
-
get checks(): CheckFunction[];
|
|
19
|
-
constructor(run: Function, argTypes: Argument[], name: string, aliases: string[] | ((msg: Message) => string[] | Promise<string[]>), module: Module, key: symbol | string);
|
|
20
|
-
}
|
package/dist/command/Command.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Command = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
class Command {
|
|
6
|
-
constructor(run, argTypes, name, aliases, module, key) {
|
|
7
|
-
this.run = run;
|
|
8
|
-
this.argTypes = argTypes;
|
|
9
|
-
this.name = name;
|
|
10
|
-
this.aliases = aliases;
|
|
11
|
-
this.module = module;
|
|
12
|
-
this.key = key;
|
|
13
|
-
}
|
|
14
|
-
execute(module, args) {
|
|
15
|
-
return this.run.apply(module, args);
|
|
16
|
-
}
|
|
17
|
-
get checks() {
|
|
18
|
-
return Reflect.getMetadata(constants_1.KCommandChecks, this.module, this.key) || [];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.Command = Command;
|
|
22
|
-
//# sourceMappingURL=Command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/command/Command.ts"],"names":[],"mappings":";;;AAEA,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,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DefaultCoolDownAdapter = void 0;
|
|
13
|
-
const discord_js_1 = require("discord.js");
|
|
14
|
-
class DefaultCoolDownAdapter {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.map = new discord_js_1.Collection();
|
|
17
|
-
}
|
|
18
|
-
get(id) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return this.map.get(id);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
set(id, value) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
this.map.set(id, value);
|
|
26
|
-
return;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.DefaultCoolDownAdapter = DefaultCoolDownAdapter;
|
|
31
|
-
//# sourceMappingURL=adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/command/cooldown/adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,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,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.coolDown = void 0;
|
|
13
|
-
const utils_1 = require("../utils");
|
|
14
|
-
const type_1 = require("./type");
|
|
15
|
-
const discord_js_1 = require("discord.js");
|
|
16
|
-
const error_1 = require("./error");
|
|
17
|
-
const coolDown = (type, seconds) => utils_1.createCheckDecorator((msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const a = msg.data.cts.coolDownAdapter;
|
|
19
|
-
const getKey = () => {
|
|
20
|
-
var _a;
|
|
21
|
-
switch (type) {
|
|
22
|
-
case type_1.CoolDownType.USER:
|
|
23
|
-
return msg.author.id;
|
|
24
|
-
case type_1.CoolDownType.GUILD:
|
|
25
|
-
return (msg.guild || msg.author).id;
|
|
26
|
-
case type_1.CoolDownType.CHANNEL:
|
|
27
|
-
return msg.channel.id;
|
|
28
|
-
case type_1.CoolDownType.MEMBER:
|
|
29
|
-
return `${(_a = msg.guild) === null || _a === void 0 ? void 0 : _a.id}.${msg.author.id}`;
|
|
30
|
-
case type_1.CoolDownType.ROLE:
|
|
31
|
-
return (msg.channel instanceof discord_js_1.DMChannel ? msg.channel : msg.member.roles.highest).id;
|
|
32
|
-
case type_1.CoolDownType.CATEGORY:
|
|
33
|
-
return (msg.channel.parent || msg.channel).id;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const key = getKey();
|
|
37
|
-
const data = yield a.get(key);
|
|
38
|
-
const now = Date.now();
|
|
39
|
-
if (!data || !(now - data < seconds * 1000)) {
|
|
40
|
-
yield a.set(key, now);
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
throw new error_1.CoolDownError(new Date(data + seconds * 1000));
|
|
44
|
-
}), (i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
const a = i.data.cts.coolDownAdapter;
|
|
46
|
-
const getKey = () => {
|
|
47
|
-
var _a;
|
|
48
|
-
switch (type) {
|
|
49
|
-
case type_1.CoolDownType.USER:
|
|
50
|
-
return i.user.id;
|
|
51
|
-
case type_1.CoolDownType.GUILD:
|
|
52
|
-
return (i.guild || i.user).id;
|
|
53
|
-
case type_1.CoolDownType.CHANNEL:
|
|
54
|
-
return i.channel.id;
|
|
55
|
-
case type_1.CoolDownType.MEMBER:
|
|
56
|
-
return `${(_a = i.guild) === null || _a === void 0 ? void 0 : _a.id}.${i.user.id}`;
|
|
57
|
-
case type_1.CoolDownType.ROLE:
|
|
58
|
-
return (i.channel instanceof discord_js_1.DMChannel ? i.channel : i.member.roles.highest).id;
|
|
59
|
-
case type_1.CoolDownType.CATEGORY:
|
|
60
|
-
return (i.channel.parent || i.channel).id;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const key = getKey();
|
|
64
|
-
const data = yield a.get(key);
|
|
65
|
-
const now = Date.now();
|
|
66
|
-
if (!data || !(now - data < seconds * 1000)) {
|
|
67
|
-
yield a.set(key, now);
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
throw new error_1.CoolDownError(new Date(data + seconds * 1000));
|
|
71
|
-
}));
|
|
72
|
-
exports.coolDown = coolDown;
|
|
73
|
-
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/command/cooldown/decorator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,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,E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
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoolDownError = void 0;
|
|
4
|
-
class CoolDownError extends Error {
|
|
5
|
-
constructor(endsAt) {
|
|
6
|
-
super();
|
|
7
|
-
this.endsAt = endsAt;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CoolDownError = CoolDownError;
|
|
11
|
-
//# sourceMappingURL=error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/command/cooldown/error.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAmB,MAAY;QAC7B,KAAK,EAAE,CAAA;QADU,WAAM,GAAN,MAAM,CAAM;IAE/B,CAAC;CACF;AAJD,sCAIC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./decorator"), exports);
|
|
14
|
-
__exportStar(require("./adapter"), exports);
|
|
15
|
-
__exportStar(require("./decorator"), exports);
|
|
16
|
-
__exportStar(require("./error"), exports);
|
|
17
|
-
__exportStar(require("./type"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/command/cooldown/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAC3B,4CAAyB;AACzB,8CAA2B;AAC3B,0CAAuB;AACvB,yCAAsB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoolDownType = void 0;
|
|
4
|
-
var CoolDownType;
|
|
5
|
-
(function (CoolDownType) {
|
|
6
|
-
CoolDownType[CoolDownType["USER"] = 0] = "USER";
|
|
7
|
-
CoolDownType[CoolDownType["CHANNEL"] = 1] = "CHANNEL";
|
|
8
|
-
CoolDownType[CoolDownType["GUILD"] = 2] = "GUILD";
|
|
9
|
-
CoolDownType[CoolDownType["ROLE"] = 3] = "ROLE";
|
|
10
|
-
CoolDownType[CoolDownType["CATEGORY"] = 4] = "CATEGORY";
|
|
11
|
-
CoolDownType[CoolDownType["MEMBER"] = 5] = "MEMBER";
|
|
12
|
-
})(CoolDownType = exports.CoolDownType || (exports.CoolDownType = {}));
|
|
13
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/command/cooldown/type.ts"],"names":[],"mappings":";;;AAAA,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,16 +0,0 @@
|
|
|
1
|
-
import { Message, PermissionResolvable } from 'discord.js';
|
|
2
|
-
declare type CommandOptions = {
|
|
3
|
-
name: string;
|
|
4
|
-
aliases: string[] | ((msg: Message) => string[]);
|
|
5
|
-
};
|
|
6
|
-
export declare const command: (options?: Partial<CommandOptions>) => (target: Object, propertyKey: string) => void;
|
|
7
|
-
export declare const argumentConverter: (type: object, requireParameter?: boolean) => (target: Object, propertyKey: string) => void;
|
|
8
|
-
export declare const slashArgumentConverter: (type: object) => (target: Object, propertyKey: string) => void;
|
|
9
|
-
export declare const optional: ParameterDecorator;
|
|
10
|
-
export declare const rest: ParameterDecorator;
|
|
11
|
-
export declare const ownerOnly: MethodDecorator;
|
|
12
|
-
export declare const guildOnly: MethodDecorator;
|
|
13
|
-
export declare const dmOnly: MethodDecorator;
|
|
14
|
-
export declare const requireUserPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
15
|
-
export declare const requireClientPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
16
|
-
export {};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requireClientPermissions = exports.requireUserPermissions = exports.dmOnly = exports.guildOnly = exports.ownerOnly = exports.rest = exports.optional = exports.slashArgumentConverter = exports.argumentConverter = exports.command = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const Command_1 = require("./Command");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const ArgumentConverter_1 = require("./ArgumentConverter");
|
|
8
|
-
const utils_2 = require("./utils");
|
|
9
|
-
const discord_js_1 = require("discord.js");
|
|
10
|
-
const error_1 = require("../error");
|
|
11
|
-
const command = (options = {}) => {
|
|
12
|
-
return (target, propertyKey) => {
|
|
13
|
-
utils_1.checkTarget(target);
|
|
14
|
-
let properties = Reflect.getMetadata(constants_1.KCommands, target);
|
|
15
|
-
const params = Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
16
|
-
const optionals = Reflect.getMetadata(constants_1.KOptionals, target, propertyKey) || -1;
|
|
17
|
-
const rest = Reflect.getMetadata(constants_1.KRest, target, propertyKey) || -1;
|
|
18
|
-
const command = new Command_1.Command(Reflect.get(target, propertyKey), params.map((x, i) => ({
|
|
19
|
-
type: x,
|
|
20
|
-
optional: optionals === -1 ? false : optionals <= i,
|
|
21
|
-
rest: rest === -1 ? false : rest === i,
|
|
22
|
-
})), options.name || propertyKey, options.aliases || [], target, propertyKey);
|
|
23
|
-
if (properties) {
|
|
24
|
-
properties.push(command);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
properties = [command];
|
|
28
|
-
Reflect.defineMetadata(constants_1.KCommands, properties, target);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.command = command;
|
|
33
|
-
const argumentConverter = (type, requireParameter = true) => {
|
|
34
|
-
return (target, propertyKey) => {
|
|
35
|
-
utils_1.checkTarget(target);
|
|
36
|
-
let properties = Reflect.getMetadata(constants_1.KArgumentConverters, target);
|
|
37
|
-
const converter = new ArgumentConverter_1.ArgumentConverter(type, Reflect.get(target, propertyKey), !requireParameter);
|
|
38
|
-
if (properties) {
|
|
39
|
-
properties.push(converter);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
properties = [converter];
|
|
43
|
-
Reflect.defineMetadata(constants_1.KArgumentConverters, properties, target);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
exports.argumentConverter = argumentConverter;
|
|
48
|
-
const slashArgumentConverter = (type) => {
|
|
49
|
-
return (target, propertyKey) => {
|
|
50
|
-
utils_1.checkTarget(target);
|
|
51
|
-
let properties = Reflect.getMetadata(constants_1.KSlashArgumentConverters, target);
|
|
52
|
-
const converter = new ArgumentConverter_1.SlashArgumentConverter(type, Reflect.get(target, propertyKey));
|
|
53
|
-
if (properties) {
|
|
54
|
-
properties.push(converter);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
properties = [converter];
|
|
58
|
-
Reflect.defineMetadata(constants_1.KSlashArgumentConverters, properties, target);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
exports.slashArgumentConverter = slashArgumentConverter;
|
|
63
|
-
const optional = (target, propertyKey, parameterIndex) => {
|
|
64
|
-
utils_1.checkTarget(target);
|
|
65
|
-
Reflect.defineMetadata(constants_1.KOptionals, parameterIndex, target, propertyKey);
|
|
66
|
-
};
|
|
67
|
-
exports.optional = optional;
|
|
68
|
-
const rest = (target, propertyKey, parameterIndex) => {
|
|
69
|
-
utils_1.checkTarget(target);
|
|
70
|
-
const params = Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
71
|
-
if (params.length - 1 !== parameterIndex)
|
|
72
|
-
throw new Error('Rest decorator must be used at last argument.');
|
|
73
|
-
if (params[parameterIndex] !== String)
|
|
74
|
-
throw new Error('Rest argument type must be "String"');
|
|
75
|
-
Reflect.defineMetadata(constants_1.KRest, parameterIndex, target, propertyKey);
|
|
76
|
-
};
|
|
77
|
-
exports.rest = rest;
|
|
78
|
-
exports.ownerOnly = utils_2.createCheckDecorator((msg) => {
|
|
79
|
-
if (msg.data.cts.owners.includes(msg.author.id))
|
|
80
|
-
return true;
|
|
81
|
-
throw new error_1.OwnerOnlyCommandError();
|
|
82
|
-
}, (i) => {
|
|
83
|
-
if (i.data.cts.owners.includes(i.user.id))
|
|
84
|
-
return true;
|
|
85
|
-
throw new error_1.OwnerOnlyCommandError();
|
|
86
|
-
});
|
|
87
|
-
exports.guildOnly = utils_2.createCheckDecorator((msg) => {
|
|
88
|
-
if (!!msg.guild)
|
|
89
|
-
return true;
|
|
90
|
-
throw new error_1.GuildOnlyCommandError();
|
|
91
|
-
}, (i) => {
|
|
92
|
-
if (!!i.guildId)
|
|
93
|
-
return true;
|
|
94
|
-
throw new error_1.GuildOnlyCommandError();
|
|
95
|
-
});
|
|
96
|
-
exports.dmOnly = utils_2.createCheckDecorator((msg) => {
|
|
97
|
-
if (!msg.guild)
|
|
98
|
-
return true;
|
|
99
|
-
throw new error_1.DMOnlyCommandError();
|
|
100
|
-
}, (i) => {
|
|
101
|
-
if (!i.guildId)
|
|
102
|
-
return true;
|
|
103
|
-
throw new error_1.DMOnlyCommandError();
|
|
104
|
-
});
|
|
105
|
-
const requireUserPermissions = (permission) => utils_2.createCheckDecorator((msg) => {
|
|
106
|
-
if (!msg.guild || !msg.member)
|
|
107
|
-
throw new Error('This command must be used in guild.');
|
|
108
|
-
if (msg.member.permissionsIn(msg.channel).has(permission)) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
throw new error_1.UserPermissionRequired(msg.member, new discord_js_1.Permissions(permission));
|
|
112
|
-
}, (i) => {
|
|
113
|
-
if (!i.guild || !i.member)
|
|
114
|
-
throw new Error('This command must be used in guild.');
|
|
115
|
-
if (!(i.member instanceof discord_js_1.GuildMember) || i.member.permissionsIn(i.channel).has(permission)) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
throw new error_1.UserPermissionRequired(i.member, new discord_js_1.Permissions(permission));
|
|
119
|
-
});
|
|
120
|
-
exports.requireUserPermissions = requireUserPermissions;
|
|
121
|
-
const requireClientPermissions = (permission) => utils_2.createCheckDecorator((msg) => {
|
|
122
|
-
if (!msg.guild)
|
|
123
|
-
throw new Error('This command must be used in guild.');
|
|
124
|
-
if (msg.guild.me.permissionsIn(msg.channel).has(permission)) {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
throw new error_1.ClientPermissionRequired(new discord_js_1.Permissions(permission));
|
|
128
|
-
}, (i) => {
|
|
129
|
-
if (!i.guild)
|
|
130
|
-
throw new Error('This command must be used in guild.');
|
|
131
|
-
if (i.guild.me.permissionsIn(i.channel).has(permission)) {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
throw new error_1.ClientPermissionRequired(new discord_js_1.Permissions(permission));
|
|
135
|
-
});
|
|
136
|
-
exports.requireClientPermissions = requireClientPermissions;
|
|
137
|
-
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/command/decorator.ts"],"names":[],"mappings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Aa,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,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./Command"), exports);
|
|
14
|
-
__exportStar(require("./decorator"), exports);
|
|
15
|
-
__exportStar(require("./ArgumentConverter"), exports);
|
|
16
|
-
__exportStar(require("./utils"), exports);
|
|
17
|
-
__exportStar(require("./cooldown"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,8CAA2B;AAC3B,sDAAmC;AACnC,0CAAuB;AACvB,6CAA0B"}
|
package/dist/command/utils.d.ts
DELETED
package/dist/command/utils.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCheckDecorator = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const createCheckDecorator = (execute, slashExecute) => {
|
|
6
|
-
return (target, propertyKey) => {
|
|
7
|
-
if (execute) {
|
|
8
|
-
let properties = Reflect.getMetadata(constants_1.KCommandChecks, target, propertyKey);
|
|
9
|
-
if (properties) {
|
|
10
|
-
properties.push(execute);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
properties = [execute];
|
|
14
|
-
Reflect.defineMetadata(constants_1.KCommandChecks, properties, target, propertyKey);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (slashExecute) {
|
|
18
|
-
let properties = Reflect.getMetadata(constants_1.KSlashCommandChecks, target, propertyKey);
|
|
19
|
-
if (properties) {
|
|
20
|
-
properties.push(slashExecute);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
properties = [slashExecute];
|
|
24
|
-
Reflect.defineMetadata(constants_1.KSlashCommandChecks, properties, target, propertyKey);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
exports.createCheckDecorator = createCheckDecorator;
|
|
30
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/command/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAkE;AAE3D,MAAM,oBAAoB,GAAG,CAClC,OAA8D,EAC9D,YAAoE,EACnD,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,YAAY,EAAE;YAChB,IAAI,UAAU,GAAyB,OAAO,CAAC,WAAW,CAAC,+BAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;YACpG,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;aAC9B;iBAAM;gBACL,UAAU,GAAG,CAAC,YAAY,CAAC,CAAA;gBAC3B,OAAO,CAAC,cAAc,CAAC,+BAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;aAC7E;SACF;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAxBY,QAAA,oBAAoB,wBAwBhC"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const KCommands: unique symbol;
|
|
2
|
-
export declare const KSlashCommands: 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 KSlashCommandChecks: unique symbol;
|
package/dist/constants.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KSlashCommandChecks = exports.KCommandChecks = exports.KSlashArgumentConverters = exports.KArgumentConverters = exports.KRest = exports.KOptionals = exports.KBuiltInModule = exports.KListenerExecuteCache = exports.KModulePath = exports.KListeners = exports.KSlashCommandOptions = exports.KSlashCommands = exports.KCommands = void 0;
|
|
4
|
-
exports.KCommands = Symbol('Command.TS Commands');
|
|
5
|
-
exports.KSlashCommands = Symbol('Command.TS Slash Commands');
|
|
6
|
-
exports.KSlashCommandOptions = Symbol('Command.TS Slash Command Options');
|
|
7
|
-
exports.KListeners = Symbol('Command.TS Listeners');
|
|
8
|
-
exports.KModulePath = Symbol('Command.TS Module Path');
|
|
9
|
-
exports.KListenerExecuteCache = Symbol('Command.TS Module Identifier');
|
|
10
|
-
exports.KBuiltInModule = Symbol('Command.TS Built-In Module');
|
|
11
|
-
exports.KOptionals = Symbol('Command.TS Optional Parameters');
|
|
12
|
-
exports.KRest = Symbol('Command.TS Rest Parameter');
|
|
13
|
-
exports.KArgumentConverters = Symbol('Command.TS Argument Converter');
|
|
14
|
-
exports.KSlashArgumentConverters = Symbol('Command.TS Slash Argument Converter');
|
|
15
|
-
exports.KCommandChecks = Symbol('Command.TS Command Checks');
|
|
16
|
-
exports.KSlashCommandChecks = Symbol('Command.TS Slash Command Checks');
|
|
17
|
-
//# 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,QAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzC,QAAA,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAEpD,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,mBAAmB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandInteraction, Message } from 'discord.js';
|
|
2
|
-
import type { Argument } from '../command';
|
|
3
|
-
import type { SlashArgument } from '../slashCommand';
|
|
4
|
-
export declare class ArgumentConverterNotFound extends Error {
|
|
5
|
-
type: Argument;
|
|
6
|
-
msg: Message;
|
|
7
|
-
constructor(type: Argument, msg: Message);
|
|
8
|
-
}
|
|
9
|
-
export declare class SlashArgumentConverterNotFound extends Error {
|
|
10
|
-
type: SlashArgument;
|
|
11
|
-
interaction: CommandInteraction;
|
|
12
|
-
constructor(type: SlashArgument, interaction: CommandInteraction);
|
|
13
|
-
}
|