@pikokr/command.ts 4.0.0 → 4.0.1
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 -10
- package/dist/index.js +1 -22
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/publish-version.js +7 -3
- package/src/applicationCommand/AppCommand.ts +4 -0
- package/src/applicationCommand/decorator.ts +4 -0
- package/src/applicationCommand/index.ts +4 -0
- package/src/builtinModules/BuiltInModule.ts +4 -0
- package/src/builtinModules/BuiltinApplicationCommandConverters.ts +4 -0
- package/src/builtinModules/BuiltinCommandConverters.ts +4 -0
- package/src/builtinModules/CommandHandler.ts +4 -0
- package/src/builtinModules/index.ts +4 -0
- package/src/command/ArgumentConverter.ts +4 -0
- package/src/command/Command.ts +4 -0
- 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 +4 -0
- package/src/command/index.ts +4 -0
- package/src/command/utils.ts +4 -0
- package/src/constants.ts +4 -0
- package/src/error/ArgumentConverterNotFound.ts +4 -0
- package/src/error/ArgumentNotProvided.ts +4 -0
- package/src/error/CommandCheckFailed.ts +4 -0
- 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 +4 -0
- package/src/error/checks/index.ts +4 -0
- package/src/error/index.ts +4 -0
- package/src/index.ts +4 -0
- 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 +4 -0
- package/src/messageComponents/button.ts +4 -0
- package/src/messageComponents/index.ts +4 -0
- package/src/messageComponents/selectMenu.ts +4 -0
- package/src/structures/CommandClient.ts +4 -0
- package/src/structures/Module.ts +4 -0
- package/src/structures/Registry.ts +37 -12
- package/src/structures/index.ts +4 -0
- package/src/typings.ts +4 -0
- package/src/utils.ts +4 -0
- package/test/index.ts +4 -0
- package/test/modules/dev.ts +4 -0
- package/test/modules/test.ts +5 -1
- package/tsup.config.ts +14 -0
- package/dist/applicationCommand/AppCommand.d.ts +0 -18
- package/dist/applicationCommand/AppCommand.js +0 -22
- package/dist/applicationCommand/AppCommand.js.map +0 -1
- package/dist/applicationCommand/decorator.d.ts +0 -10
- package/dist/applicationCommand/decorator.js +0 -39
- package/dist/applicationCommand/decorator.js.map +0 -1
- package/dist/applicationCommand/index.d.ts +0 -2
- package/dist/applicationCommand/index.js +0 -15
- package/dist/applicationCommand/index.js.map +0 -1
- 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/BuiltinApplicationCommandConverters.d.ts +0 -8
- package/dist/builtinModules/BuiltinApplicationCommandConverters.js +0 -13
- package/dist/builtinModules/BuiltinApplicationCommandConverters.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 -14
- package/dist/builtinModules/CommandHandler.js +0 -357
- 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 -17
- package/dist/command/decorator.js +0 -138
- 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 -14
- package/dist/constants.js +0 -18
- 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/SlashCommandGlobalCheckError.d.ts +0 -5
- package/dist/error/checks/SlashCommandGlobalCheckError.js +0 -11
- 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 -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/messageComponents/base.d.ts +0 -10
- package/dist/messageComponents/base.js +0 -15
- package/dist/messageComponents/base.js.map +0 -1
- package/dist/messageComponents/button.d.ts +0 -5
- package/dist/messageComponents/button.js +0 -28
- package/dist/messageComponents/button.js.map +0 -1
- package/dist/messageComponents/index.d.ts +0 -2
- package/dist/messageComponents/index.js +0 -15
- package/dist/messageComponents/index.js.map +0 -1
- package/dist/messageComponents/selectMenu.d.ts +0 -5
- package/dist/messageComponents/selectMenu.js +0 -28
- package/dist/messageComponents/selectMenu.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 -11
- package/dist/slashCommand/decorator.js +0 -39
- 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 -45
- package/dist/structures/CommandClient.js +0 -94
- package/dist/structures/CommandClient.js.map +0 -1
- package/dist/structures/Module.d.ts +0 -21
- package/dist/structures/Module.js +0 -38
- package/dist/structures/Module.js.map +0 -1
- package/dist/structures/Registry.d.ts +0 -30
- package/dist/structures/Registry.js +0 -226
- 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 -30
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/applicationCommand/decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAoF;AACpF,oCAAsC;AACtC,4CAAyE;AAEzE,6CAAyC;AAOlC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I,UAAU,GAA+B,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IAE3G,IAAI,CAAC,UAAU,EAAE;QACf,UAAU,GAAG,IAAI,uBAAU,EAAkB,CAAA;QAC7C,OAAO,CAAC,cAAc,CAAC,gCAAoB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;KAC9E;IAED,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB"}
|
|
@@ -1,15 +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("./AppCommand"), exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/applicationCommand/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuiltInModule = void 0;
|
|
4
|
-
const structures_1 = require("../structures");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
class BuiltInModule extends structures_1.Module {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
Reflect.defineMetadata(constants_1.KBuiltInModule, true, this);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.BuiltInModule = BuiltInModule;
|
|
13
|
-
//# sourceMappingURL=BuiltInModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuiltInModule.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltInModule.ts"],"names":[],"mappings":";;;AAAA,8CAAsC;AACtC,4CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAM;IACvC;QACE,KAAK,EAAE,CAAA;QACP,OAAO,CAAC,cAAc,CAAC,0BAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACpD,CAAC;CACF;AALD,sCAKC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BuiltInModule } from './BuiltInModule';
|
|
2
|
-
import { Client } from 'discord.js';
|
|
3
|
-
import { CommandClient } from '../structures';
|
|
4
|
-
export declare class BuiltinApplicationCommandConverters extends BuiltInModule {
|
|
5
|
-
private cts;
|
|
6
|
-
client: Client;
|
|
7
|
-
constructor(cts: CommandClient);
|
|
8
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuiltinApplicationCommandConverters = void 0;
|
|
4
|
-
const BuiltInModule_1 = require("./BuiltInModule");
|
|
5
|
-
class BuiltinApplicationCommandConverters extends BuiltInModule_1.BuiltInModule {
|
|
6
|
-
constructor(cts) {
|
|
7
|
-
super();
|
|
8
|
-
this.cts = cts;
|
|
9
|
-
this.client = cts.client;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.BuiltinApplicationCommandConverters = BuiltinApplicationCommandConverters;
|
|
13
|
-
//# sourceMappingURL=BuiltinApplicationCommandConverters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuiltinApplicationCommandConverters.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltinApplicationCommandConverters.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAI/C,MAAa,mCAAoC,SAAQ,6BAAa;IAGpE,YAAoB,GAAkB;QACpC,KAAK,EAAE,CAAA;QADW,QAAG,GAAH,GAAG,CAAe;QAEpC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;CACF;AAPD,kFAOC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BuiltInModule } from './BuiltInModule';
|
|
2
|
-
import { Client, GuildMember, Message, User, Role } from 'discord.js';
|
|
3
|
-
import { CommandClient } from '../structures';
|
|
4
|
-
export declare class BuiltinCommandConverters extends BuiltInModule {
|
|
5
|
-
private cts;
|
|
6
|
-
client: Client;
|
|
7
|
-
constructor(cts: CommandClient);
|
|
8
|
-
message(msg: Message): Message<boolean>;
|
|
9
|
-
string(msg: Message, arg: string): string;
|
|
10
|
-
getUserIDByMention(mention: string): `${bigint}` | undefined;
|
|
11
|
-
user(msg: Message, value: string): User | null;
|
|
12
|
-
member(msg: Message, value: string): GuildMember | undefined;
|
|
13
|
-
number(msg: Message, value: string): number | undefined;
|
|
14
|
-
getRoleIDByMention(mention: string): `${bigint}` | undefined;
|
|
15
|
-
role(msg: Message, value: string): Role | undefined;
|
|
16
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BuiltinCommandConverters = void 0;
|
|
13
|
-
const BuiltInModule_1 = require("./BuiltInModule");
|
|
14
|
-
const command_1 = require("../command");
|
|
15
|
-
const discord_js_1 = require("discord.js");
|
|
16
|
-
class BuiltinCommandConverters extends BuiltInModule_1.BuiltInModule {
|
|
17
|
-
constructor(cts) {
|
|
18
|
-
super();
|
|
19
|
-
this.cts = cts;
|
|
20
|
-
this.client = cts.client;
|
|
21
|
-
}
|
|
22
|
-
message(msg) {
|
|
23
|
-
return msg;
|
|
24
|
-
}
|
|
25
|
-
string(msg, arg) {
|
|
26
|
-
return arg;
|
|
27
|
-
}
|
|
28
|
-
getUserIDByMention(mention) {
|
|
29
|
-
if (!mention)
|
|
30
|
-
return;
|
|
31
|
-
if (mention.startsWith('<@') && mention.endsWith('>')) {
|
|
32
|
-
mention = mention.slice(2, -1);
|
|
33
|
-
if (mention.startsWith('!')) {
|
|
34
|
-
mention = mention.slice(1);
|
|
35
|
-
}
|
|
36
|
-
return mention;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
user(msg, value) {
|
|
40
|
-
let user = this.client.users.cache.get(value);
|
|
41
|
-
if (user)
|
|
42
|
-
return user;
|
|
43
|
-
user = this.client.users.cache.find((x) => x.tag === value || x.username === value);
|
|
44
|
-
if (user)
|
|
45
|
-
return user;
|
|
46
|
-
const id = this.getUserIDByMention(value);
|
|
47
|
-
if (!id)
|
|
48
|
-
return null;
|
|
49
|
-
user = this.client.users.cache.get(id);
|
|
50
|
-
return user || null;
|
|
51
|
-
}
|
|
52
|
-
member(msg, value) {
|
|
53
|
-
var _a, _b, _c;
|
|
54
|
-
let user = (_a = msg.guild) === null || _a === void 0 ? void 0 : _a.members.cache.get(value);
|
|
55
|
-
if (!user)
|
|
56
|
-
return user;
|
|
57
|
-
user = (_b = msg.guild) === null || _b === void 0 ? void 0 : _b.members.cache.find((x) => x.user.tag === value);
|
|
58
|
-
if (user)
|
|
59
|
-
return user;
|
|
60
|
-
const id = this.getUserIDByMention(value);
|
|
61
|
-
if (!id)
|
|
62
|
-
return;
|
|
63
|
-
user = (_c = msg.guild) === null || _c === void 0 ? void 0 : _c.members.cache.get(id);
|
|
64
|
-
return user || undefined;
|
|
65
|
-
}
|
|
66
|
-
number(msg, value) {
|
|
67
|
-
const n = Number(value);
|
|
68
|
-
return isNaN(n) ? undefined : n;
|
|
69
|
-
}
|
|
70
|
-
getRoleIDByMention(mention) {
|
|
71
|
-
if (!mention)
|
|
72
|
-
return;
|
|
73
|
-
if (mention.startsWith('<@') && mention.endsWith('>')) {
|
|
74
|
-
mention = mention.slice(2, -1);
|
|
75
|
-
if (mention.startsWith('&')) {
|
|
76
|
-
mention = mention.slice(1);
|
|
77
|
-
}
|
|
78
|
-
return mention;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
role(msg, value) {
|
|
82
|
-
var _a;
|
|
83
|
-
const id = this.getRoleIDByMention(value);
|
|
84
|
-
if (!id)
|
|
85
|
-
return;
|
|
86
|
-
const role = (_a = msg.guild) === null || _a === void 0 ? void 0 : _a.roles.cache.get(id);
|
|
87
|
-
return role || undefined;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
__decorate([
|
|
91
|
-
command_1.argumentConverter(discord_js_1.Message, false),
|
|
92
|
-
__metadata("design:type", Function),
|
|
93
|
-
__metadata("design:paramtypes", [discord_js_1.Message]),
|
|
94
|
-
__metadata("design:returntype", void 0)
|
|
95
|
-
], BuiltinCommandConverters.prototype, "message", null);
|
|
96
|
-
__decorate([
|
|
97
|
-
command_1.argumentConverter(String),
|
|
98
|
-
__metadata("design:type", Function),
|
|
99
|
-
__metadata("design:paramtypes", [discord_js_1.Message, String]),
|
|
100
|
-
__metadata("design:returntype", void 0)
|
|
101
|
-
], BuiltinCommandConverters.prototype, "string", null);
|
|
102
|
-
__decorate([
|
|
103
|
-
command_1.argumentConverter(discord_js_1.User),
|
|
104
|
-
__metadata("design:type", Function),
|
|
105
|
-
__metadata("design:paramtypes", [discord_js_1.Message, String]),
|
|
106
|
-
__metadata("design:returntype", Object)
|
|
107
|
-
], BuiltinCommandConverters.prototype, "user", null);
|
|
108
|
-
__decorate([
|
|
109
|
-
command_1.argumentConverter(discord_js_1.GuildMember),
|
|
110
|
-
__metadata("design:type", Function),
|
|
111
|
-
__metadata("design:paramtypes", [discord_js_1.Message, String]),
|
|
112
|
-
__metadata("design:returntype", Object)
|
|
113
|
-
], BuiltinCommandConverters.prototype, "member", null);
|
|
114
|
-
__decorate([
|
|
115
|
-
command_1.argumentConverter(Number),
|
|
116
|
-
__metadata("design:type", Function),
|
|
117
|
-
__metadata("design:paramtypes", [discord_js_1.Message, String]),
|
|
118
|
-
__metadata("design:returntype", void 0)
|
|
119
|
-
], BuiltinCommandConverters.prototype, "number", null);
|
|
120
|
-
__decorate([
|
|
121
|
-
command_1.argumentConverter(discord_js_1.Role),
|
|
122
|
-
__metadata("design:type", Function),
|
|
123
|
-
__metadata("design:paramtypes", [discord_js_1.Message, String]),
|
|
124
|
-
__metadata("design:returntype", Object)
|
|
125
|
-
], BuiltinCommandConverters.prototype, "role", null);
|
|
126
|
-
exports.BuiltinCommandConverters = BuiltinCommandConverters;
|
|
127
|
-
//# sourceMappingURL=BuiltinCommandConverters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuiltinCommandConverters.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltinCommandConverters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA+C;AAC/C,wC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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAC3B,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;aAC3B;YACD,OAAO,OAAsB,CAAA;SAC9B;IACH,CAAC;IAGD,IAAI,CAAC,GAAY,EAAE,KAAa;;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,MAAM,IAAI,GAAG,MAAA,GAAG,CAAC,KAAK,0CAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC3C,OAAO,IAAI,IAAI,SAAS,CAAA;IAC1B,CAAC;CACF;AApEC;IADC,2BAAiB,CAAC,oBAAO,EAAE,KAAK,CAAC;;qCACrB,oBAAO;;uDAEnB;AAGD;IADC,2BAAiB,CAAC,MAAM,CAAC;;qCACd,oBAAO;;sDAElB;AAcD;IADC,2BAAiB,CAAC,iBAAI,CAAC;;qCACd,oBAAO;;oDAShB;AAGD;IADC,2BAAiB,CAAC,wBAAW,CAAC;;qCACnB,oBAAO;;sDASlB;AAGD;IADC,2BAAiB,CAAC,MAAM,CAAC;;qCACd,oBAAO;;sDAGlB;AAcD;IADC,2BAAiB,CAAC,iBAAI,CAAC;;qCACd,oBAAO;;oDAKhB;AA5EH,4DA6EC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BuiltInModule } from './BuiltInModule';
|
|
2
|
-
import { Client, CommandInteraction, CommandInteractionOptionResolver } from 'discord.js';
|
|
3
|
-
import { CommandClient } from '../structures';
|
|
4
|
-
export declare class BuiltinSlashCommandConverters extends BuiltInModule {
|
|
5
|
-
private cts;
|
|
6
|
-
client: Client;
|
|
7
|
-
constructor(cts: CommandClient);
|
|
8
|
-
message(interaction: CommandInteraction): CommandInteraction<import("discord.js").CacheType>;
|
|
9
|
-
optionResolver(interaction: CommandInteraction): CommandInteractionOptionResolver;
|
|
10
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BuiltinSlashCommandConverters = void 0;
|
|
13
|
-
const BuiltInModule_1 = require("./BuiltInModule");
|
|
14
|
-
const command_1 = require("../command");
|
|
15
|
-
const discord_js_1 = require("discord.js");
|
|
16
|
-
class BuiltinSlashCommandConverters extends BuiltInModule_1.BuiltInModule {
|
|
17
|
-
constructor(cts) {
|
|
18
|
-
super();
|
|
19
|
-
this.cts = cts;
|
|
20
|
-
this.client = cts.client;
|
|
21
|
-
}
|
|
22
|
-
message(interaction) {
|
|
23
|
-
return interaction;
|
|
24
|
-
}
|
|
25
|
-
optionResolver(interaction) {
|
|
26
|
-
return interaction.options;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
__decorate([
|
|
30
|
-
command_1.slashArgumentConverter(discord_js_1.CommandInteraction),
|
|
31
|
-
__metadata("design:type", Function),
|
|
32
|
-
__metadata("design:paramtypes", [discord_js_1.CommandInteraction]),
|
|
33
|
-
__metadata("design:returntype", void 0)
|
|
34
|
-
], BuiltinSlashCommandConverters.prototype, "message", null);
|
|
35
|
-
__decorate([
|
|
36
|
-
command_1.slashArgumentConverter(discord_js_1.CommandInteractionOptionResolver),
|
|
37
|
-
__metadata("design:type", Function),
|
|
38
|
-
__metadata("design:paramtypes", [discord_js_1.CommandInteraction]),
|
|
39
|
-
__metadata("design:returntype", discord_js_1.CommandInteractionOptionResolver)
|
|
40
|
-
], BuiltinSlashCommandConverters.prototype, "optionResolver", null);
|
|
41
|
-
exports.BuiltinSlashCommandConverters = BuiltinSlashCommandConverters;
|
|
42
|
-
//# sourceMappingURL=BuiltinSlashCommandConverters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuiltinSlashCommandConverters.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltinSlashCommandConverters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA+C;AAC/C,wCAAmD;AACnD,2CAAyF;AAGzF,MAAa,6BAA8B,SAAQ,6BAAa;IAG9D,YAAoB,GAAkB;QACpC,KAAK,EAAE,CAAA;QADW,QAAG,GAAH,GAAG,CAAe;QAEpC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;IAGD,OAAO,CAAC,WAA+B;QACrC,OAAO,WAAW,CAAA;IACpB,CAAC;IAGD,cAAc,CAAC,WAA+B;QAC5C,OAAO,WAAW,CAAC,OAA2C,CAAA;IAChE,CAAC;CACF;AARC;IADC,gCAAsB,CAAC,+BAAkB,CAAC;;qCACtB,+BAAkB;;4DAEtC;AAGD;IADC,gCAAsB,CAAC,6CAAgC,CAAC;;qCAC7B,+BAAkB;oCAAG,6CAAgC;mEAEhF;AAhBH,sEAiBC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BuiltInModule } from './BuiltInModule';
|
|
2
|
-
import { Registry } from '../structures';
|
|
3
|
-
import { Interaction, Message } from 'discord.js';
|
|
4
|
-
export declare class CommandHandler extends BuiltInModule {
|
|
5
|
-
private registry;
|
|
6
|
-
private readonly client;
|
|
7
|
-
constructor(registry: Registry);
|
|
8
|
-
message(msg: Message): Promise<boolean | undefined>;
|
|
9
|
-
private command;
|
|
10
|
-
private messageComponent;
|
|
11
|
-
private userContextMenu;
|
|
12
|
-
private messageContextMenu;
|
|
13
|
-
interaction(i: Interaction): Promise<boolean | undefined>;
|
|
14
|
-
}
|