@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
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,310 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as tslog from 'tslog';
|
|
2
|
+
import { Logger } from 'tslog';
|
|
3
|
+
import { ApplicationCommandDataResolvable, Snowflake, MessageComponentInteraction, MessageComponentType, Collection, Message, CommandInteraction, Interaction, Client, ContextMenuInteraction, PermissionResolvable, GuildMember, Permissions } from 'discord.js';
|
|
4
|
+
|
|
5
|
+
declare class Listener {
|
|
6
|
+
name: string;
|
|
7
|
+
execute: Function;
|
|
8
|
+
constructor(name: string, execute: Function);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const listener: (event: string) => (target: Module, propertyKey: string) => void;
|
|
12
|
+
|
|
13
|
+
declare type ApplicationCommandOptions$1 = {
|
|
14
|
+
guild: Snowflake | Snowflake[];
|
|
15
|
+
optionTypes?: any[];
|
|
16
|
+
};
|
|
17
|
+
declare const applicationCommand: (opt: Partial<ApplicationCommandOptions$1> & {
|
|
18
|
+
command: ApplicationCommandDataResolvable;
|
|
19
|
+
}) => (target: Object, propertyKey: string) => void;
|
|
20
|
+
declare const option: (key: string) => ParameterDecorator;
|
|
21
|
+
|
|
22
|
+
declare type AppCommandArgument = {
|
|
23
|
+
type: any;
|
|
24
|
+
name?: string;
|
|
25
|
+
};
|
|
26
|
+
declare class AppCommand {
|
|
27
|
+
command: ApplicationCommandDataResolvable;
|
|
28
|
+
private run;
|
|
29
|
+
module: Module;
|
|
30
|
+
params: AppCommandArgument[];
|
|
31
|
+
guild: Snowflake | Snowflake[] | undefined;
|
|
32
|
+
private key;
|
|
33
|
+
get checks(): ApplicationCommandCheckFunction[];
|
|
34
|
+
execute(module: Module, args: any[]): any;
|
|
35
|
+
constructor(command: ApplicationCommandDataResolvable, run: Function, module: Module, params: AppCommandArgument[], guild: Snowflake | Snowflake[] | undefined, key: string | symbol);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare type MessageComponentExecutor = (i: MessageComponentInteraction) => void | Promise<void>;
|
|
39
|
+
declare class MessageComponentHandler {
|
|
40
|
+
componentId: string;
|
|
41
|
+
componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
|
42
|
+
execute: MessageComponentExecutor;
|
|
43
|
+
constructor(componentId: string, componentType: Exclude<MessageComponentType, 'ACTION_ROW'>, execute: MessageComponentExecutor);
|
|
44
|
+
run(module: Module, i: MessageComponentInteraction): void | Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class Registry {
|
|
48
|
+
client: CommandClient;
|
|
49
|
+
constructor(client: CommandClient);
|
|
50
|
+
modules: Collection<symbol, Module>;
|
|
51
|
+
private get logger();
|
|
52
|
+
get commands(): Command[];
|
|
53
|
+
get argumentConverters(): ArgumentConverter[];
|
|
54
|
+
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
55
|
+
get applicationCommands(): AppCommand[];
|
|
56
|
+
get messageComponentHandlers(): MessageComponentHandler[];
|
|
57
|
+
registerModule(module: Module): Module;
|
|
58
|
+
loadModulesIn(dir: string, absolute?: boolean): Promise<void>;
|
|
59
|
+
loadModule(file: string, absolute?: boolean): Promise<Module>;
|
|
60
|
+
syncCommands(): Promise<void>;
|
|
61
|
+
unregisterModule(module: Module): Promise<Module>;
|
|
62
|
+
unloadModule(module: Module): Promise<void>;
|
|
63
|
+
reloadModule(module: Module): Promise<boolean>;
|
|
64
|
+
reloadAll(): Promise<{
|
|
65
|
+
path: string;
|
|
66
|
+
success: boolean;
|
|
67
|
+
error?: Error | undefined;
|
|
68
|
+
}[]>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface CommandOptions$1 {
|
|
72
|
+
prefix: string | ((msg: any) => string | Promise<string | string[]> | string[]) | string[];
|
|
73
|
+
check: (msg: Message) => boolean | Promise<boolean>;
|
|
74
|
+
globalAliases: (cmd: string, msg: Message) => string[] | Promise<string[]>;
|
|
75
|
+
}
|
|
76
|
+
interface SlashCommandOptions {
|
|
77
|
+
check: (i: CommandInteraction) => boolean | Promise<boolean>;
|
|
78
|
+
}
|
|
79
|
+
interface ApplicationCommandOptions {
|
|
80
|
+
guild?: Snowflake | Snowflake[];
|
|
81
|
+
autoSync: boolean;
|
|
82
|
+
beforeRunCheck: (i: Interaction) => void | Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
interface CommandClientOptions {
|
|
85
|
+
command: CommandOptions$1;
|
|
86
|
+
owners: 'auto' | Snowflake[];
|
|
87
|
+
slashCommands: SlashCommandOptions;
|
|
88
|
+
applicationCommands: ApplicationCommandOptions;
|
|
89
|
+
}
|
|
90
|
+
interface CommandClientOptionsParam {
|
|
91
|
+
command: Partial<CommandOptions$1>;
|
|
92
|
+
owners: 'auto' | string[];
|
|
93
|
+
slashCommands: Partial<SlashCommandOptions>;
|
|
94
|
+
applicationCommands: Partial<ApplicationCommandOptions>;
|
|
95
|
+
}
|
|
96
|
+
declare class CommandClient {
|
|
97
|
+
options: CommandClientOptions;
|
|
98
|
+
owners: string[];
|
|
99
|
+
registry: Registry;
|
|
100
|
+
client: Client;
|
|
101
|
+
coolDownAdapter: CoolDownAdapter;
|
|
102
|
+
logger: Logger;
|
|
103
|
+
private _isReady;
|
|
104
|
+
private fetchOwners;
|
|
105
|
+
ready(): Promise<void>;
|
|
106
|
+
constructor({ client, coolDownAdapter, logger, ...options }: Partial<CommandClientOptionsParam> & {
|
|
107
|
+
client: Client;
|
|
108
|
+
coolDownAdapter?: CoolDownAdapter;
|
|
109
|
+
logger?: Logger;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare abstract class Module {
|
|
114
|
+
commandClient: CommandClient;
|
|
115
|
+
get logger(): tslog.Logger;
|
|
116
|
+
get commands(): Command[];
|
|
117
|
+
get listeners(): Listener[];
|
|
118
|
+
get argumentConverters(): ArgumentConverter[];
|
|
119
|
+
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
120
|
+
get applicationCommands(): AppCommand[];
|
|
121
|
+
get messageComponentHandlers(): MessageComponentHandler[];
|
|
122
|
+
get path(): string | undefined;
|
|
123
|
+
load(): void;
|
|
124
|
+
unload(): void;
|
|
125
|
+
beforeReload(): void;
|
|
126
|
+
afterReload(): void;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare type Argument = {
|
|
130
|
+
optional: boolean;
|
|
131
|
+
type: any;
|
|
132
|
+
rest: boolean;
|
|
133
|
+
};
|
|
134
|
+
declare type CheckFunction = (msg: Message) => boolean | Promise<boolean>;
|
|
135
|
+
declare type ApplicationCommandCheckFunction = (i: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction) => boolean | Promise<boolean>;
|
|
136
|
+
declare class Command {
|
|
137
|
+
private run;
|
|
138
|
+
argTypes: Argument[];
|
|
139
|
+
name: string;
|
|
140
|
+
aliases: string[] | ((msg: Message) => string[] | Promise<string[]>);
|
|
141
|
+
module: Module;
|
|
142
|
+
key: symbol | string;
|
|
143
|
+
execute(module: Module, args: any[]): any;
|
|
144
|
+
get checks(): CheckFunction[];
|
|
145
|
+
constructor(run: Function, argTypes: Argument[], name: string, aliases: string[] | ((msg: Message) => string[] | Promise<string[]>), module: Module, key: symbol | string);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare type CommandOptions = {
|
|
149
|
+
name: string;
|
|
150
|
+
aliases: string[] | ((msg: Message) => string[]);
|
|
151
|
+
optionTypes?: any[];
|
|
152
|
+
};
|
|
153
|
+
declare const command: (options?: Partial<CommandOptions>) => (target: Object, propertyKey: string) => void;
|
|
154
|
+
declare const argumentConverter: (type: object, requireParameter?: boolean) => (target: Object, propertyKey: string) => void;
|
|
155
|
+
declare const applicationCommandArgumentConverter: (type: object) => (target: Object, propertyKey: string) => void;
|
|
156
|
+
declare const optional: ParameterDecorator;
|
|
157
|
+
declare const rest: ParameterDecorator;
|
|
158
|
+
declare const ownerOnly: MethodDecorator;
|
|
159
|
+
declare const guildOnly: MethodDecorator;
|
|
160
|
+
declare const dmOnly: MethodDecorator;
|
|
161
|
+
declare const requireUserPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
162
|
+
declare const requireClientPermissions: (permission: PermissionResolvable) => MethodDecorator;
|
|
163
|
+
|
|
164
|
+
declare class ArgumentConverter {
|
|
165
|
+
type: object;
|
|
166
|
+
private run;
|
|
167
|
+
withoutParameter: boolean;
|
|
168
|
+
execute(module: Module, msg: Message, arg?: string): any;
|
|
169
|
+
constructor(type: object, run: Function, withoutParameter: boolean);
|
|
170
|
+
}
|
|
171
|
+
declare class ApplicationCommandArgumentConverter {
|
|
172
|
+
type: object;
|
|
173
|
+
private run;
|
|
174
|
+
execute(module: Module, interaction: CommandInteraction | ContextMenuInteraction): any;
|
|
175
|
+
constructor(type: object, run: Function);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare const createCheckDecorator: (execute: ((msg: Message) => boolean | Promise<boolean>) | null, executeApplicationCommand?: ((i: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction) => boolean | Promise<boolean>) | undefined) => MethodDecorator;
|
|
179
|
+
|
|
180
|
+
declare enum CoolDownType {
|
|
181
|
+
USER = 0,
|
|
182
|
+
CHANNEL = 1,
|
|
183
|
+
GUILD = 2,
|
|
184
|
+
ROLE = 3,
|
|
185
|
+
CATEGORY = 4,
|
|
186
|
+
MEMBER = 5
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare const coolDown: (type: CoolDownType, seconds: number) => MethodDecorator;
|
|
190
|
+
|
|
191
|
+
interface CoolDownAdapter {
|
|
192
|
+
get(id: string): Promise<number | undefined>;
|
|
193
|
+
set(id: string, value: number): Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
declare class DefaultCoolDownAdapter implements CoolDownAdapter {
|
|
196
|
+
map: Collection<string, number>;
|
|
197
|
+
get(id: string): Promise<number | undefined>;
|
|
198
|
+
set(id: string, value: number): Promise<void>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare class CoolDownError extends Error {
|
|
202
|
+
endsAt: Date;
|
|
203
|
+
constructor(endsAt: Date);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare module 'discord.js' {
|
|
207
|
+
interface Message {
|
|
208
|
+
data: {
|
|
209
|
+
command: Command | null;
|
|
210
|
+
prefix: string;
|
|
211
|
+
cts: CommandClient;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
interface CommandInteraction {
|
|
215
|
+
data: {
|
|
216
|
+
command: AppCommand;
|
|
217
|
+
cts: CommandClient;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
interface MessageComponentInteraction {
|
|
221
|
+
data: {
|
|
222
|
+
command: AppCommand;
|
|
223
|
+
cts: CommandClient;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
interface ContextMenuInteraction {
|
|
227
|
+
data: {
|
|
228
|
+
command: AppCommand;
|
|
229
|
+
cts: CommandClient;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare class InvalidTargetError extends Error {
|
|
235
|
+
constructor();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
declare class ModuleLoadError extends Error {
|
|
239
|
+
error: Error;
|
|
240
|
+
constructor(file: string, error: Error);
|
|
241
|
+
}
|
|
242
|
+
declare class InvalidModuleError extends Error {
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare class ArgumentNotProvided extends Error {
|
|
246
|
+
index: number;
|
|
247
|
+
command: Command;
|
|
248
|
+
msg: Message;
|
|
249
|
+
constructor(index: number, command: Command, msg: Message);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare class ArgumentConverterNotFound extends Error {
|
|
253
|
+
type: Argument;
|
|
254
|
+
msg: Message;
|
|
255
|
+
constructor(type: Argument, msg: Message);
|
|
256
|
+
}
|
|
257
|
+
declare class ApplicationCommandArgumentConverterNotFound extends Error {
|
|
258
|
+
type: AppCommandArgument;
|
|
259
|
+
interaction: CommandInteraction | ContextMenuInteraction;
|
|
260
|
+
constructor(type: AppCommandArgument, interaction: CommandInteraction | ContextMenuInteraction);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare class CommandCheckFailed extends Error {
|
|
264
|
+
msg: Message;
|
|
265
|
+
command: Command;
|
|
266
|
+
constructor(msg: Message, command: Command);
|
|
267
|
+
}
|
|
268
|
+
declare class ApplicationCommandCheckFailed extends Error {
|
|
269
|
+
interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction;
|
|
270
|
+
command: AppCommand;
|
|
271
|
+
constructor(interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction, command: AppCommand);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
declare class UserPermissionRequired extends Error {
|
|
275
|
+
user: GuildMember;
|
|
276
|
+
permissions: Permissions;
|
|
277
|
+
constructor(user: GuildMember, permissions: Permissions);
|
|
278
|
+
}
|
|
279
|
+
declare class ClientPermissionRequired extends Error {
|
|
280
|
+
permissions: Permissions;
|
|
281
|
+
constructor(permissions: Permissions);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare class OwnerOnlyCommandError extends Error {
|
|
285
|
+
constructor();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class GuildOnlyCommandError extends Error {
|
|
289
|
+
constructor();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare class DMOnlyCommandError extends Error {
|
|
293
|
+
constructor();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
declare class BuiltInModule extends Module {
|
|
297
|
+
constructor();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
declare class ButtonInteractionHandler extends MessageComponentHandler {
|
|
301
|
+
constructor(id: string, execute: MessageComponentExecutor);
|
|
302
|
+
}
|
|
303
|
+
declare const messageButton: (id: string) => MethodDecorator;
|
|
304
|
+
|
|
305
|
+
declare class SelectMenuInteractionHandler extends MessageComponentHandler {
|
|
306
|
+
constructor(id: string, execute: MessageComponentExecutor);
|
|
307
|
+
}
|
|
308
|
+
declare const messageSelectMenu: (id: string) => MethodDecorator;
|
|
309
|
+
|
|
310
|
+
export { AppCommand, AppCommandArgument, ApplicationCommandArgumentConverter, ApplicationCommandArgumentConverterNotFound, ApplicationCommandCheckFailed, ApplicationCommandCheckFunction, ApplicationCommandOptions, Argument, ArgumentConverter, ArgumentConverterNotFound, ArgumentNotProvided, BuiltInModule, ButtonInteractionHandler, CheckFunction, ClientPermissionRequired, Command, CommandCheckFailed, CommandClient, CommandClientOptions, CommandClientOptionsParam, CommandOptions$1 as CommandOptions, CoolDownAdapter, CoolDownError, CoolDownType, DMOnlyCommandError, DefaultCoolDownAdapter, GuildOnlyCommandError, InvalidModuleError, InvalidTargetError, Listener, Module, ModuleLoadError, OwnerOnlyCommandError, Registry, SelectMenuInteractionHandler, SlashCommandOptions, UserPermissionRequired, applicationCommand, applicationCommandArgumentConverter, argumentConverter, command, coolDown, createCheckDecorator, dmOnly, guildOnly, listener, messageButton, messageSelectMenu, option, optional, ownerOnly, requireClientPermissions, requireUserPermissions, rest };
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
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
|
-
require("reflect-metadata");
|
|
14
|
-
require("./typings");
|
|
15
|
-
__exportStar(require("./interface"), exports);
|
|
16
|
-
__exportStar(require("./structures"), exports);
|
|
17
|
-
__exportStar(require("./error"), exports);
|
|
18
|
-
__exportStar(require("./command"), exports);
|
|
19
|
-
__exportStar(require("./listener"), exports);
|
|
20
|
-
__exportStar(require("./builtinModules/BuiltInModule"), exports);
|
|
21
|
-
__exportStar(require("./slashCommand"), exports);
|
|
1
|
+
var dt=Object.create;var W=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames,ve=Object.getOwnPropertySymbols,ft=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var ke=n=>W(n,"__esModule",{value:!0}),i=(n,e)=>W(n,"name",{value:e,configurable:!0});var Ae=(n,e)=>{var t={};for(var r in n)Oe.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&ve)for(var r of ve(n))e.indexOf(r)<0&&ht.call(n,r)&&(t[r]=n[r]);return t};var gt=(n,e)=>{for(var t in e)W(n,t,{get:e[t],enumerable:!0})},Te=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pt(e))!Oe.call(n,o)&&(t||o!=="default")&&W(n,o,{get:()=>e[o],enumerable:!(r=ut(e,o))||r.enumerable});return n},de=(n,e)=>Te(ke(W(n!=null?dt(ft(n)):{},"default",!e&&n&&n.__esModule?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n),yt=(n=>(e,t)=>n&&n.get(e)||(t=Te(ke({}),e,1),n&&n.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var jt={};gt(jt,{AppCommand:()=>me,ApplicationCommandArgumentConverter:()=>ce,ApplicationCommandArgumentConverterNotFound:()=>k,ApplicationCommandCheckFailed:()=>A,ArgumentConverter:()=>ae,ArgumentConverterNotFound:()=>D,ArgumentNotProvided:()=>K,BuiltInModule:()=>R,ButtonInteractionHandler:()=>ye,ClientPermissionRequired:()=>U,Command:()=>ie,CommandCheckFailed:()=>re,CommandClient:()=>Ee,CoolDownError:()=>G,CoolDownType:()=>y,DMOnlyCommandError:()=>H,DefaultCoolDownAdapter:()=>le,GuildOnlyCommandError:()=>N,InvalidModuleError:()=>L,InvalidTargetError:()=>O,Listener:()=>se,Module:()=>C,ModuleLoadError:()=>te,OwnerOnlyCommandError:()=>B,Registry:()=>oe,SelectMenuInteractionHandler:()=>we,UserPermissionRequired:()=>P,applicationCommand:()=>kt,applicationCommandArgumentConverter:()=>xt,argumentConverter:()=>S,command:()=>wt,coolDown:()=>Ot,createCheckDecorator:()=>M,dmOnly:()=>Et,guildOnly:()=>Mt,listener:()=>pe,messageButton:()=>Tt,messageSelectMenu:()=>_t,option:()=>At,optional:()=>Ct,ownerOnly:()=>bt,requireClientPermissions:()=>vt,requireUserPermissions:()=>St,rest:()=>Rt});var Yn=require("reflect-metadata");var q=Symbol("Command.TS Commands"),Y=Symbol("Command.TS Slash Commands"),ue=Symbol("Command.TS Slash Command Options"),J=Symbol("Command.TS Listeners"),I=Symbol("Command.TS Module Path"),Ce=Symbol("Command.TS Module Identifier"),Q=Symbol("Command.TS Built-In Module"),Re=Symbol("Command.TS Optional Parameters"),be=Symbol("Command.TS Rest Parameter"),V=Symbol("Command.TS Argument Converter"),X=Symbol("Command.TS Slash Argument Converter"),Z=Symbol("Command.TS Command Checks"),ee=Symbol("Command.TS Slash Command Checks"),E=Symbol("Command.TS Message Component Handlers");var C=class{get logger(){return this.commandClient.logger.getChildLogger({name:this.constructor.name})}get commands(){return Reflect.getMetadata(q,this)||[]}get listeners(){return Reflect.getMetadata(J,this)||[]}get argumentConverters(){return Reflect.getMetadata(V,this)||[]}get applicationCommandArgumentConverters(){return Reflect.getMetadata(X,this)||[]}get applicationCommands(){return Reflect.getMetadata(Y,this)||[]}get messageComponentHandlers(){return Reflect.getMetadata(E,this)||[]}get path(){return Reflect.getMetadata(I,this)}load(){}unload(){}beforeReload(){}afterReload(){}};i(C,"Module");var ct=de(require("lodash"));var ne=de(require("path"));var O=class extends Error{constructor(){super('Class does not extend "Module" class.')}};i(O,"InvalidTargetError");var te=class extends Error{constructor(e,t){super("Failed to load module "+e);this.error=t}};i(te,"ModuleLoadError");var L=class extends Error{};i(L,"InvalidModuleError");var K=class extends Error{constructor(e,t,r){super(`Required argument #${e} not provided.`);this.index=e,this.command=t,this.msg=r}};i(K,"ArgumentNotProvided");var D=class extends Error{constructor(e,t){super(`Argument converter ${e.type.name} not found.`);this.type=e,this.msg=t}};i(D,"ArgumentConverterNotFound");var k=class extends Error{constructor(e,t){super(`Argument converter ${e.type.name} not found.`);this.type=e,this.interaction=t}};i(k,"ApplicationCommandArgumentConverterNotFound");var re=class extends Error{constructor(e,t){super();this.msg=e,this.command=t}};i(re,"CommandCheckFailed");var A=class extends Error{constructor(e,t){super();this.interaction=e,this.command=t}};i(A,"ApplicationCommandCheckFailed");var P=class extends Error{constructor(e,t){super();this.user=e,this.permissions=t}};i(P,"UserPermissionRequired");var U=class extends Error{constructor(e){super();this.permissions=e}};i(U,"ClientPermissionRequired");var B=class extends Error{constructor(){super()}};i(B,"OwnerOnlyCommandError");var N=class extends Error{constructor(){super()}};i(N,"GuildOnlyCommandError");var H=class extends Error{constructor(){super()}};i(H,"DMOnlyCommandError");var _e=require("discord.js"),je=de(require("walk-sync")),Ie=de(require("fs")),oe=class{constructor(e){this.client=e,this.modules=new _e.Collection}get logger(){return this.client.logger.getChildLogger({name:"Registry"})}get commands(){let e=[];for(let[,t]of this.modules)e.push(...t.commands);return e}get argumentConverters(){let e=[];for(let[,t]of this.modules)e.push(...t.argumentConverters);return e}get applicationCommandArgumentConverters(){let e=[];for(let[,t]of this.modules)e.push(...t.applicationCommandArgumentConverters);return e}get applicationCommands(){let e=[];for(let[,t]of this.modules)e.push(...t.applicationCommands);return e}get messageComponentHandlers(){let e=[];for(let[,t]of this.modules)e.push(...t.messageComponentHandlers);return e}registerModule(e){e.commandClient=this.client,this.modules.set(Symbol(e.constructor.name),e);let t=[];for(let r of e.listeners){let o=r.execute.bind(e);t.push({event:r.name,execute:o}),this.client.client.on(r.name,o)}return Reflect.defineMetadata(Ce,t,e),e}async loadModulesIn(e,t=!1){let r=t?e:ne.default.join(require.main.path,e);for(let o of(0,je.default)(r))if(Ie.lstatSync(ne.default.join(r,o)).isFile()){if(o.endsWith(".map"))continue;await this.loadModule(ne.default.join(r,o),!0)}}async loadModule(e,t=!1){let r=t?e:ne.default.join(require.main.path,e),o;try{o=require(r)}catch(c){throw new te(r,c)}if(o.loaded)throw new Error("MODULE_ALREADY_LOADED");if(!o.install)throw new L("Install function not found.");let s=o.install(this.client);if(!(s instanceof C))throw new O;return Reflect.defineMetadata(I,require.resolve(r),s),this.registerModule(s),await s.load(),o.loaded=!0,s}async syncCommands(){var c;this.logger.debug("Syncing commands...");let e=this.applicationCommands.filter(a=>!a.guild),t=this.client.options.applicationCommands.guild,r=i(async(a,l)=>{this.logger.debug(`Syncing for guild ${a.name}(${a.id})`);let u=[...l.map(g=>g.command),...this.applicationCommands.filter(g=>{var d;return g.guild===a.id||((d=g.guild)==null?void 0:d.includes(a.id))||!1}).map(g=>g.command)];this.logger.debug(`Command List: ${u.map(g=>g.name).join(", ")}`),await a.commands.set(u)},"syncForGuild");if(t)if(typeof t=="string")await r(await this.client.client.guilds.fetch(t),e);else for(let a of t)await r(await this.client.client.guilds.fetch(a),e);else this.logger.debug("Syncing global..."),await((c=this.client.client.application)==null?void 0:c.commands.set(e.map(a=>a.command)));let o=this.applicationCommands.filter(a=>a.guild),s=new Set;for(let a of o)if(!!a.guild)if(typeof a.guild=="string")s.add(a.guild);else for(let l of a.guild)s.add(l);for(let a of s)await r(await this.client.client.guilds.fetch(a),o.filter(l=>l.guild&&(typeof l.guild=="string"?a===l.guild:l.guild.includes(a))));this.logger.debug("Syncing ended.")}async unregisterModule(e){if(Reflect.getMetadata(Q,e))throw new Error("Built-in modules cannot be unloaded");let t=this.modules.findKey(o=>o===e);if(!t)return e;await e.unload();let r=Reflect.getMetadata(Ce,e);for(let o of r)this.client.client.removeListener(o.event,o.execute);return this.modules.delete(t),e}async unloadModule(e){let t=Reflect.getMetadata(I,e);if(!t)throw new L("This module is not loaded by loadModule.");await this.unregisterModule(e),delete require.cache[t]}async reloadModule(e){await e.beforeReload();let t=Reflect.getMetadata(I,e);return await this.unloadModule(e),await(await this.loadModule(t,!0)).afterReload(),!0}async reloadAll(){let e=[];for(let[,t]of this.modules.filter(r=>!!r.path&&!Reflect.getMetadata(Q,r)))try{await this.reloadModule(t),e.push({path:t.path,success:!0})}catch(r){e.push({error:r,path:t.path,success:!1})}return e}};i(oe,"Registry");var lt=require("discord.js");var R=class extends C{constructor(){super();Reflect.defineMetadata(Q,!0,this)}};i(R,"BuiltInModule");var se=class{constructor(e,t){this.name=e,this.execute=t}};i(se,"Listener");var w=i(n=>{if(!(n instanceof C))throw new O},"checkTarget");var pe=i(n=>(e,t)=>{w(e);let r=Reflect.getMetadata(J,e),o=new se(n,Reflect.get(e,t));r?r.push(o):(r=[o],Reflect.defineMetadata(J,r,e))},"listener");var f=require("discord.js");var fe=class extends Error{constructor(e,t,r){super(`Command ${e} not found.`);this.commandName=e,this.msg=t,this.args=r}};i(fe,"CommandNotFound");var he=class extends Error{constructor(e){super("Slash command before-run check failed.");this.i=e}};i(he,"SlashCommandGlobalCheckError");function Le(n,e,t,r,o){var s={};Object.keys(r).forEach(function(a){s[a]=r[a]}),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=t.slice().reverse().reduce(function(a,l){return l&&l(n,e,a)||a},s),o&&s.initializer!==void 0&&(s.value=s.initializer?s.initializer.call(o):void 0,s.initializer=void 0);var c=Object.getOwnPropertyDescriptor(n,e);return c&&(c.get||c.set)&&(delete s.writable,delete s.initializer),s.initializer===void 0&&(Object.defineProperty(n,e,s),s=null),s}i(Le,"_applyDecoratedDescriptor");var b,Ke,De,Pe,Ue,Be,Ne,He=(b=i(class extends R{constructor(e){super();this.registry=e,this.client=e.client}async message(e){let t=i(r=>this.client.client.emit("commandError",r,e),"error1");try{let r=typeof this.client.options.command.prefix=="string"?this.client.options.command.prefix:typeof this.client.options.command.prefix=="function"?await this.client.options.command.prefix(e):this.client.options.command.prefix,o;if(typeof r=="object"){let d=r.find(x=>e.content.includes(x));if(!d)return;o=d}else{if(!e.content.includes(r))return;o=r}if(!e.content.startsWith(o))return;let s=e.content.slice(o.length).split(" "),c=s.shift();if(!c)return;let a=null,l=await this.client.options.command.globalAliases(c,e);for(let d of this.registry.commands){let x=await this.client.options.command.globalAliases(d.name,e);if([...typeof d.aliases=="function"?await d.aliases(e):d.aliases,d.name].some(v=>v===c)){a=d;break}if(l.every((v,$)=>x[$]===v)){a=d;break}}if(e.data={cts:this.client,command:a,prefix:o},!await this.client.options.command.check(e))return;if(!a)return t(new fe(c,e,s));let u=this.registry.modules.find(d=>d.commands.includes(a));if(!u)return;let g=[];for(let d of a.checks)if(!await d(e))return t(new re(e,a));for(let d=0;d<a.argTypes.length;d++){let x=a.argTypes[d],_=this.registry.argumentConverters.find(j=>j.type===x.type);if(x.rest){let j=s.join(" ");if(!j)break;g.push(j);break}if(!_)return t(new D(x,e));let v=this.registry.modules.find(j=>j.argumentConverters.includes(_));if(!v)return t(new D(x,e));if(_.withoutParameter){g.push(await _.execute(v,e));continue}let $=s.shift();if(x.optional&&!$)break;if(!$)return t(new K(d,a,e));let xe=await _.execute(v,e,$);if(xe==null&&!x.optional)return t(new K(d,a,e));g.push(xe)}try{await a.execute(u,g)}catch(d){return t(d)}}catch(r){return t(r)}}async command(e){var r,o;let t=i(s=>this.client.client.emit("applicationCommandError",s,e),"error2");try{let s=this.registry.applicationCommands.find(l=>l.command.type==="CHAT_INPUT"&&l.command.name===e.commandName);if(!s)return;let c=this.registry.modules.find(l=>l.applicationCommands.includes(s));if(!c)return;let a=[];if(e.data={cts:this.client,command:s},!await this.client.options.slashCommands.check(e))return t(new he(e));for(let l of s.checks)if(!await l(e))return t(new A(e,s));for(let l=0;l<s.params.length;l++){let u=s.params[l],g=this.registry.applicationCommandArgumentConverters.find(d=>d.type===u.type);if(u.type===f.CommandInteraction){a.push(e);continue}if(u.type===f.CommandInteractionOptionResolver){a.push(e.options);continue}if(u.name){switch(u.type){case String:a.push(e.options.getString(u.name,!1)||void 0);break;case f.Role:a.push(e.options.getRole(u.name,!1)||void 0);break;case f.User:a.push(e.options.getUser(u.name,!1)||void 0);break;case f.GuildMember:a.push(e.options.getMember(u.name,!1)||void 0);break;case Boolean:a.push(e.options.getBoolean(u.name,!1)||void 0);break;case Number:let d=e.options.get(u.name,!1);if(!d){a.push(void 0);break}if(d.type=="NUMBER"){a.push((r=e.options.getNumber(u.name,!1))!=null?r:void 0);break}if(d.type=="INTEGER"){a.push((o=e.options.getInteger(u.name,!1))!=null?o:void 0);break}}continue}if(!g)return t(new k(u,e));a.push(await g.execute(c,e))}await s.execute(c,a)}catch(s){return t(s)}}async messageComponent(e){let t=i(r=>this.client.client.emit("messageComponentError",r),"error");try{let r=[];for(let o of this.registry.messageComponentHandlers)o.componentId===o.componentId&&o.componentType===e.componentType&&r.push(o);for(let o of r){let s=this.registry.modules.find(c=>c.messageComponentHandlers.includes(o));!s||await o.run(s,e)}}catch(r){t(r)}}async userContextMenu(e){let t=i(r=>this.client.client.emit("applicationCommandError",r,e),"error3");try{let r=this.registry.applicationCommands.find(c=>c.command.type==="USER"&&c.command.name===e.commandName);if(!r)return;let o=this.registry.modules.find(c=>c.applicationCommands.includes(r));if(!o)return;e.data={cts:this.client,command:r};for(let c of r.checks)if(!await c(e))return t(new A(e,r));let s=[];for(let c=0;c<r.params.length;c++){let a=r.params[c],l=this.registry.applicationCommandArgumentConverters.find(u=>u.type===a.type);if(a.type===f.UserContextMenuInteraction){s.push(e);continue}if(!l)return t(new k(a,e));s.push(await l.execute(o,e))}await r.execute(o,s)}catch(r){return t(r)}}async messageContextMenu(e){let t=i(r=>this.client.client.emit("applicationCommandError",r,e),"error4");try{let r=this.registry.applicationCommands.find(c=>c.command.type==="MESSAGE"&&c.command.name===e.commandName);if(!r)return;let o=this.registry.modules.find(c=>c.applicationCommands.includes(r));if(!o)return;e.data={cts:this.client,command:r};for(let c of r.checks)if(!await c(e))return t(new A(e,r));let s=[];for(let c=0;c<r.params.length;c++){let a=r.params[c],l=this.registry.applicationCommandArgumentConverters.find(u=>u.type===a.type);if(a.type===f.MessageContextMenuInteraction){s.push(e);continue}if(!l)return t(new k(a,e));s.push(await l.execute(o,e))}await r.execute(o,s)}catch(r){return t(r)}}async interaction(e){let t=i(r=>this.client.client.emit("interactionError",r,e),"error");try{if(await this.client.options.applicationCommands.beforeRunCheck(e),e.isCommand()){await this.command(e);return}if(e.isMessageComponent()){await this.messageComponent(e);return}if(e.isMessageContextMenu()){await this.messageContextMenu(e);return}if(e.isUserContextMenu()){await this.userContextMenu(e);return}}catch(r){return t(r)}}},"CommandHandler"),Ke=pe("messageCreate"),De=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),Pe=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof f.Message=="undefined"?Object:f.Message]),Le(b.prototype,"message",[Ke,De,Pe],Object.getOwnPropertyDescriptor(b.prototype,"message"),b.prototype),Ue=pe("interactionCreate"),Be=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),Ne=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof f.Interaction=="undefined"?Object:f.Interaction]),Le(b.prototype,"interaction",[Ue,Be,Ne],Object.getOwnPropertyDescriptor(b.prototype,"interaction"),b.prototype),b);var ie=class{execute(e,t){return this.run.apply(e,t)}get checks(){return Reflect.getMetadata(Z,this.module,this.key)||[]}constructor(e,t,r,o,s,c){this.run=e,this.argTypes=t,this.name=r,this.aliases=o,this.module=s,this.key=c}};i(ie,"Command");var ae=class{execute(e,t,r){return this.run.apply(e,[t,r])}constructor(e,t,r){this.type=e,this.run=t,this.withoutParameter=r}};i(ae,"ArgumentConverter");var ce=class{execute(e,t){return this.run.apply(e,[t])}constructor(e,t){this.type=e,this.run=t}};i(ce,"ApplicationCommandArgumentConverter");var M=i((n,e)=>(t,r)=>{if(n){let o=Reflect.getMetadata(Z,t,r);o?o.push(n):(o=[n],Reflect.defineMetadata(Z,o,t,r))}if(e){let o=Reflect.getMetadata(ee,t,r);o?o.push(e):(o=[e],Reflect.defineMetadata(ee,o,t,r))}},"createCheckDecorator");var T=require("discord.js");var wt=i((n={})=>(e,t)=>{var l;w(e);let r=Reflect.getMetadata(q,e),o=(l=n.optionTypes)!=null?l:Reflect.getMetadata("design:paramtypes",e,t),s=Reflect.getMetadata(Re,e,t)||-1,c=Reflect.getMetadata(be,e,t)||-1,a=new ie(Reflect.get(e,t),o.map((u,g)=>({type:u,optional:s===-1?!1:s<=g,rest:c===-1?!1:c===g})),n.name||t,n.aliases||[],e,t);r?r.push(a):(r=[a],Reflect.defineMetadata(q,r,e))},"command"),S=i((n,e=!0)=>(t,r)=>{w(t);let o=Reflect.getMetadata(V,t),s=new ae(n,Reflect.get(t,r),!e);o?o.push(s):(o=[s],Reflect.defineMetadata(V,o,t))},"argumentConverter"),xt=i(n=>(e,t)=>{w(e);let r=Reflect.getMetadata(X,e),o=new ce(n,Reflect.get(e,t));r?r.push(o):(r=[o],Reflect.defineMetadata(X,r,e))},"applicationCommandArgumentConverter"),Ct=i((n,e,t)=>{w(n),Reflect.defineMetadata(Re,t,n,e)},"optional"),Rt=i((n,e,t)=>{w(n);let r=Reflect.getMetadata("design:paramtypes",n,e);if(r.length-1!==t)throw new Error("Rest decorator must be used at last argument.");if(r[t]!==String)throw new Error('Rest argument type must be "String"');Reflect.defineMetadata(be,t,n,e)},"rest"),bt=M(n=>{if(n.data.cts.owners.includes(n.author.id))return!0;throw new B},n=>{if(n.data.cts.owners.includes(n.user.id))return!0;throw new B}),Mt=M(n=>{if(n.guild)return!0;throw new N},n=>{if(n.guildId)return!0;throw new N}),Et=M(n=>{if(!n.guild)return!0;throw new H},n=>{if(!n.guildId)return!0;throw new H}),St=i(n=>M(e=>{if(!e.guild||!e.member)throw new Error("This command must be used in guild.");if(e.member.permissionsIn(e.channel).has(n))return!0;throw new P(e.member,new T.Permissions(n))},e=>{if(!e.guild||!e.member)throw new Error("This command must be used in guild.");if(!(e.member instanceof T.GuildMember)||e.member.permissionsIn(e.channel).has(n))return!0;throw new P(e.member,new T.Permissions(n))}),"requireUserPermissions"),vt=i(n=>M(e=>{if(!e.guild)throw new Error("This command must be used in guild.");if(e.guild.me.permissionsIn(e.channel).has(n))return!0;throw new U(new T.Permissions(n))},e=>{if(!e.guild)throw new Error("This command must be used in guild.");if(e.guild.me.permissionsIn(e.channel).has(n))return!0;throw new U(new T.Permissions(n))}),"requireClientPermissions");var y;(function(n){n[n.USER=0]="USER",n[n.CHANNEL=1]="CHANNEL",n[n.GUILD=2]="GUILD",n[n.ROLE=3]="ROLE",n[n.CATEGORY=4]="CATEGORY",n[n.MEMBER=5]="MEMBER"})(y||(y={}));var Me=require("discord.js");var G=class extends Error{constructor(e){super();this.endsAt=e}};i(G,"CoolDownError");var Ot=i((n,e)=>M(async t=>{let r=t.data.cts.coolDownAdapter,s=i(()=>{var l;switch(n){case y.USER:return t.author.id;case y.GUILD:return(t.guild||t.author).id;case y.CHANNEL:return t.channel.id;case y.MEMBER:return`${(l=t.guild)==null?void 0:l.id}.${t.author.id}`;case y.ROLE:return(t.channel instanceof Me.DMChannel?t.channel:t.member.roles.highest).id;case y.CATEGORY:return(t.channel.parent||t.channel).id}},"getKey")(),c=await r.get(s),a=Date.now();if(!c||!(a-c<e*1e3))return await r.set(s,a),!0;throw new G(new Date(c+e*1e3))},async t=>{let r=t.data.cts.coolDownAdapter,s=i(()=>{var l;switch(n){case y.USER:return t.user.id;case y.GUILD:return(t.guild||t.user).id;case y.CHANNEL:return t.channel.id;case y.MEMBER:return`${(l=t.guild)==null?void 0:l.id}.${t.user.id}`;case y.ROLE:return(t.channel instanceof Me.DMChannel?t.channel:t.member.roles.highest).id;case y.CATEGORY:return(t.channel.parent||t.channel).id}},"getKey")(),c=await r.get(s),a=Date.now();if(!c||!(a-c<e*1e3))return await r.set(s,a),!0;throw new G(new Date(c+e*1e3))}),"coolDown");var Ge=require("discord.js"),le=class{async get(e){return this.map.get(e)}async set(e,t){this.map.set(e,t)}constructor(){this.map=new Ge.Collection}};i(le,"DefaultCoolDownAdapter");var h=require("discord.js");function z(n,e,t,r,o){var s={};Object.keys(r).forEach(function(a){s[a]=r[a]}),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=t.slice().reverse().reduce(function(a,l){return l&&l(n,e,a)||a},s),o&&s.initializer!==void 0&&(s.value=s.initializer?s.initializer.call(o):void 0,s.initializer=void 0);var c=Object.getOwnPropertyDescriptor(n,e);return c&&(c.get||c.set)&&(delete s.writable,delete s.initializer),s.initializer===void 0&&(Object.defineProperty(n,e,s),s=null),s}i(z,"_applyDecoratedDescriptor");var p,ze,Fe,$e,We,qe,Ye,Je,Qe,Ve,Xe,Ze,et,tt,rt,nt,ot,st,it,at=(p=i(class extends R{constructor(e){super();this.cts=e,this.client=e.client}message(e){return e}string(e,t){return t}getUserIDByMention(e){if(!!e&&e.startsWith("<@")&&e.endsWith(">"))return e=e.slice(2,-1),e.startsWith("!")&&(e=e.slice(1)),e}user(e,t){let r=this.client.users.cache.get(t);if(r||(r=this.client.users.cache.find(s=>s.tag===t||s.username===t),r))return r;let o=this.getUserIDByMention(t);return o?(r=this.client.users.cache.get(o),r||null):null}member(e,t){var s,c,a;let r=(s=e.guild)==null?void 0:s.members.cache.get(t);if(!r||(r=(c=e.guild)==null?void 0:c.members.cache.find(l=>l.user.tag===t),r))return r;let o=this.getUserIDByMention(t);if(!!o)return r=(a=e.guild)==null?void 0:a.members.cache.get(o),r||void 0}number(e,t){let r=Number(t);return isNaN(r)?void 0:r}getRoleIDByMention(e){if(!!e&&e.startsWith("<@")&&e.endsWith(">"))return e=e.slice(2,-1),e.startsWith("&")&&(e=e.slice(1)),e}role(e,t){var s;let r=this.getRoleIDByMention(t);return r&&((s=e.guild)==null?void 0:s.roles.cache.get(r))||void 0}},"BuiltinCommandConverters"),ze=S(h.Message,!1),Fe=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),$e=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message]),z(p.prototype,"message",[ze,Fe,$e],Object.getOwnPropertyDescriptor(p.prototype,"message"),p.prototype),We=S(String),qe=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),Ye=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message,String]),z(p.prototype,"string",[We,qe,Ye],Object.getOwnPropertyDescriptor(p.prototype,"string"),p.prototype),Je=S(h.User),Qe=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),Ve=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message,String]),z(p.prototype,"user",[Je,Qe,Ve],Object.getOwnPropertyDescriptor(p.prototype,"user"),p.prototype),Xe=S(h.GuildMember),Ze=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),et=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message,String]),z(p.prototype,"member",[Xe,Ze,et],Object.getOwnPropertyDescriptor(p.prototype,"member"),p.prototype),tt=S(Number),rt=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),nt=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message,String]),z(p.prototype,"number",[tt,rt,nt],Object.getOwnPropertyDescriptor(p.prototype,"number"),p.prototype),ot=S(h.Role),st=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:type",Function),it=typeof Reflect!="undefined"&&typeof Reflect.metadata=="function"&&Reflect.metadata("design:paramtypes",[typeof h.Message=="undefined"?Object:h.Message,String]),z(p.prototype,"role",[ot,st,it],Object.getOwnPropertyDescriptor(p.prototype,"role"),p.prototype),p);var ge=class extends R{constructor(e){super();this.cts=e,this.client=e.client}};i(ge,"BuiltinApplicationCommandConverters");var mt=require("tslog"),Ee=class{async fetchOwners(){var t,r;await((t=this.client.application)==null?void 0:t.fetch());let e=(r=this.client.application)==null?void 0:r.owner;return e?e instanceof lt.User?[e.id]:e.members.map(o=>o.id):[]}async ready(){if(!this._isReady){if(this._isReady=!0,this.options.owners==="auto"){let e=await this.fetchOwners();this.owners.push(...e)}this.options.applicationCommands.autoSync&&await this.registry.syncCommands()}}constructor(s){var c=s,{client:e,coolDownAdapter:t,logger:r}=c,o=Ae(c,["client","coolDownAdapter","logger"]);this.owners=[],this.registry=new oe(this),this._isReady=!1,this.client=e,this.coolDownAdapter=t||new le,this.options=ct.default.merge({command:{prefix:"!",check:()=>!0,globalAliases:()=>[]},owners:"auto",slashCommands:{check:()=>!0},applicationCommands:{autoSync:!1,beforeRunCheck:()=>{}}},o),this.logger=r!=null?r:new mt.Logger({name:"Command.TS"}),this.options.owners!=="auto"&&(this.owners=this.options.owners),this.client.once("ready",()=>this.ready()),this.registry.registerModule(new He(this.registry)),this.registry.registerModule(new at(this)),this.registry.registerModule(new ge(this))}};i(Ee,"CommandClient");var Se=require("discord.js");var me=class{get checks(){return Reflect.getMetadata(ee,this.module,this.key)||[]}execute(e,t){return this.run.apply(e,t)}constructor(e,t,r,o,s,c){this.command=e,this.run=t,this.module=r,this.params=o,this.guild=s,this.key=c}};i(me,"AppCommand");var kt=i(n=>(e,t)=>{var a;w(e);let r=Reflect.getMetadata(Y,e),o=(a=n.optionTypes)!=null?a:Reflect.getMetadata("design:paramtypes",e,t),s=Reflect.getMetadata(ue,e,t)||new Se.Collection,c=new me(n.command,Reflect.get(e,t),e,o.map((l,u)=>({type:l,name:s.get(u)})),n.guild,t);r?r.push(c):(r=[c],Reflect.defineMetadata(Y,r,e))},"applicationCommand"),At=i(n=>(e,t,r)=>{w(e);let o=Reflect.getMetadata(ue,e,t);o||(o=new Se.Collection,Reflect.defineMetadata(ue,o,e,t)),o.set(r,n)},"option");var F=class{constructor(e,t,r){this.componentId=e,this.componentType=t,this.execute=r}run(e,t){return this.execute.apply(e,[t])}};i(F,"MessageComponentHandler");var ye=class extends F{constructor(e,t){super(e,"BUTTON",t)}};i(ye,"ButtonInteractionHandler");var Tt=i(n=>(e,t)=>{w(e);let r=new ye(n,Reflect.get(e,t)),o=Reflect.getMetadata(E,e);o?o.push(r):(o=[r],Reflect.defineMetadata(E,o,e))},"messageButton");var we=class extends F{constructor(e,t){super(e,"SELECT_MENU",t)}};i(we,"SelectMenuInteractionHandler");var _t=i(n=>(e,t)=>{w(e);let r=new we(n,Reflect.get(e,t)),o=Reflect.getMetadata(E,e);o?o.push(r):(o=[r],Reflect.defineMetadata(E,o,e))},"messageSelectMenu");module.exports=yt(jt);0&&(module.exports={AppCommand,ApplicationCommandArgumentConverter,ApplicationCommandArgumentConverterNotFound,ApplicationCommandCheckFailed,ArgumentConverter,ArgumentConverterNotFound,ArgumentNotProvided,BuiltInModule,ButtonInteractionHandler,ClientPermissionRequired,Command,CommandCheckFailed,CommandClient,CoolDownError,CoolDownType,DMOnlyCommandError,DefaultCoolDownAdapter,GuildOnlyCommandError,InvalidModuleError,InvalidTargetError,Listener,Module,ModuleLoadError,OwnerOnlyCommandError,Registry,SelectMenuInteractionHandler,UserPermissionRequired,applicationCommand,applicationCommandArgumentConverter,argumentConverter,command,coolDown,createCheckDecorator,dmOnly,guildOnly,listener,messageButton,messageSelectMenu,option,optional,ownerOnly,requireClientPermissions,requireUserPermissions,rest});
|
|
22
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAAyB;AACzB,qBAAkB;AAElB,8CAA2B;AAC3B,+CAA4B;AAC5B,0CAAuB;AACvB,4CAAyB;AACzB,6CAA0B;AAC1B,iEAA8C;AAC9C,iDAA8B"}
|
|
1
|
+
{"version":3,"sources":["../src/home/runner/work/command.ts/command.ts/src/index.ts","../src/home/runner/work/command.ts/command.ts/src/constants.ts","../src/structures/home/runner/work/command.ts/command.ts/src/structures/Module.ts","../src/structures/home/runner/work/command.ts/command.ts/src/structures/CommandClient.ts","../src/structures/home/runner/work/command.ts/command.ts/src/structures/Registry.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/InvalidTargetError.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/ModuleError.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/ArgumentNotProvided.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/ArgumentConverterNotFound.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/CommandCheckFailed.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/PermissionRequired.ts","../src/error/checks/home/runner/work/command.ts/command.ts/src/error/checks/OwnerOnlyCommand.ts","../src/error/checks/home/runner/work/command.ts/command.ts/src/error/checks/GuildOnlyCommand.ts","../src/error/checks/home/runner/work/command.ts/command.ts/src/error/checks/DMOnlyCommand.ts","../src/builtinModules/home/runner/work/command.ts/command.ts/src/builtinModules/BuiltInModule.ts","../src/listener/home/runner/work/command.ts/command.ts/src/listener/Listener.ts","../src/home/runner/work/command.ts/command.ts/src/utils.ts","../src/listener/home/runner/work/command.ts/command.ts/src/listener/decorator.ts","../src/builtinModules/home/runner/work/command.ts/command.ts/src/builtinModules/CommandHandler.ts","../src/error/home/runner/work/command.ts/command.ts/src/error/CommandNotFound.ts","../src/error/checks/home/runner/work/command.ts/command.ts/src/error/checks/SlashCommandGlobalCheckError.ts","../src/command/home/runner/work/command.ts/command.ts/src/command/Command.ts","../src/command/home/runner/work/command.ts/command.ts/src/command/ArgumentConverter.ts","../src/command/home/runner/work/command.ts/command.ts/src/command/utils.ts","../src/command/home/runner/work/command.ts/command.ts/src/command/decorator.ts","../src/command/cooldown/home/runner/work/command.ts/command.ts/src/command/cooldown/type.ts","../src/command/cooldown/home/runner/work/command.ts/command.ts/src/command/cooldown/decorator.ts","../src/command/cooldown/home/runner/work/command.ts/command.ts/src/command/cooldown/error.ts","../src/command/cooldown/home/runner/work/command.ts/command.ts/src/command/cooldown/adapter.ts","../src/builtinModules/home/runner/work/command.ts/command.ts/src/builtinModules/BuiltinCommandConverters.ts","../src/builtinModules/home/runner/work/command.ts/command.ts/src/builtinModules/BuiltinApplicationCommandConverters.ts","../src/applicationCommand/home/runner/work/command.ts/command.ts/src/applicationCommand/decorator.ts","../src/applicationCommand/home/runner/work/command.ts/command.ts/src/applicationCommand/AppCommand.ts","../src/messageComponents/home/runner/work/command.ts/command.ts/src/messageComponents/base.ts","../src/messageComponents/home/runner/work/command.ts/command.ts/src/messageComponents/button.ts","../src/messageComponents/home/runner/work/command.ts/command.ts/src/messageComponents/selectMenu.ts"],"sourcesContent":["/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport 'reflect-metadata'\nimport './typings'\n\nexport * from './interface'\nexport * from './structures'\nexport * from './error'\nexport * from './command'\nexport * from './listener'\nexport * from './builtinModules/BuiltInModule'\nexport * from './applicationCommand'\nexport * from './messageComponents'\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport const KCommands = Symbol('Command.TS Commands')\n\nexport const KApplicationCommands = Symbol('Command.TS Slash Commands')\n\nexport const KSlashCommandOptions = Symbol('Command.TS Slash Command Options')\n\nexport const KListeners = Symbol('Command.TS Listeners')\n\nexport const KModulePath = Symbol('Command.TS Module Path')\n\nexport const KListenerExecuteCache = Symbol('Command.TS Module Identifier')\n\nexport const KBuiltInModule = Symbol('Command.TS Built-In Module')\n\nexport const KOptionals = Symbol('Command.TS Optional Parameters')\n\nexport const KRest = Symbol('Command.TS Rest Parameter')\n\nexport const KArgumentConverters = Symbol('Command.TS Argument Converter')\n\nexport const KSlashArgumentConverters = Symbol('Command.TS Slash Argument Converter')\n\nexport const KCommandChecks = Symbol('Command.TS Command Checks')\n\nexport const KApplicationCommandChecks = Symbol('Command.TS Slash Command Checks')\n\nexport const KMessageComponentHandlers = Symbol('Command.TS Message Component Handlers')\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { KArgumentConverters, KCommands, KListeners, KMessageComponentHandlers, KModulePath, KSlashArgumentConverters, KApplicationCommands } from '../constants'\nimport type { Command } from '../command'\nimport { Listener } from '../listener'\nimport { ArgumentConverter, ApplicationCommandArgumentConverter } from '../command'\nimport { AppCommand } from '../applicationCommand'\nimport { CommandClient } from './CommandClient'\nimport { MessageComponentHandler } from '../messageComponents/base'\n\nexport abstract class Module {\n commandClient!: CommandClient\n\n get logger() {\n return this.commandClient.logger.getChildLogger({\n name: this.constructor.name,\n })\n }\n\n get commands(): Command[] {\n return Reflect.getMetadata(KCommands, this) || []\n }\n\n get listeners(): Listener[] {\n return Reflect.getMetadata(KListeners, this) || []\n }\n\n get argumentConverters(): ArgumentConverter[] {\n return Reflect.getMetadata(KArgumentConverters, this) || []\n }\n\n get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[] {\n return Reflect.getMetadata(KSlashArgumentConverters, this) || []\n }\n\n get applicationCommands(): AppCommand[] {\n return Reflect.getMetadata(KApplicationCommands, this) || []\n }\n\n get messageComponentHandlers(): MessageComponentHandler[] {\n return Reflect.getMetadata(KMessageComponentHandlers, this) || []\n }\n\n get path(): string | undefined {\n return Reflect.getMetadata(KModulePath, this)\n }\n\n load() {}\n unload() {}\n beforeReload() {}\n afterReload() {}\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport _ from 'lodash'\nimport { Registry } from './Registry'\nimport { Client, CommandInteraction, Interaction, Message, Snowflake, User } from 'discord.js'\nimport { BuiltinCommandConverters, BuiltinApplicationCommandConverters, CommandHandler } from '../builtinModules'\nimport { CoolDownAdapter, DefaultCoolDownAdapter } from '../command'\nimport { Logger } from 'tslog'\n\nexport interface CommandOptions {\n prefix: string | ((msg: any) => string | Promise<string | string[]> | string[]) | string[]\n check: (msg: Message) => boolean | Promise<boolean>\n globalAliases: (cmd: string, msg: Message) => string[] | Promise<string[]>\n}\n\nexport interface SlashCommandOptions {\n check: (i: CommandInteraction) => boolean | Promise<boolean>\n}\n\nexport interface ApplicationCommandOptions {\n guild?: Snowflake | Snowflake[]\n autoSync: boolean\n beforeRunCheck: (i: Interaction) => void | Promise<void>\n}\n\nexport interface CommandClientOptions {\n command: CommandOptions\n owners: 'auto' | Snowflake[]\n slashCommands: SlashCommandOptions\n applicationCommands: ApplicationCommandOptions\n}\n\nexport interface CommandClientOptionsParam {\n command: Partial<CommandOptions>\n owners: 'auto' | string[]\n slashCommands: Partial<SlashCommandOptions>\n applicationCommands: Partial<ApplicationCommandOptions>\n}\n\nexport class CommandClient {\n options: CommandClientOptions\n owners: string[] = []\n registry = new Registry(this)\n client: Client\n coolDownAdapter: CoolDownAdapter\n logger: Logger\n\n private _isReady = false\n\n private async fetchOwners(): Promise<string[]> {\n await this.client.application?.fetch()\n const o = this.client.application?.owner\n if (!o) return []\n if (o instanceof User) return [o.id]\n else return o.members.map((x) => x.id)\n }\n\n async ready() {\n if (this._isReady) return\n this._isReady = true\n if (this.options.owners === 'auto') {\n const owners = await this.fetchOwners()\n this.owners.push(...owners)\n }\n if (this.options.applicationCommands.autoSync) {\n await this.registry.syncCommands()\n }\n }\n\n constructor({ client, coolDownAdapter, logger, ...options }: Partial<CommandClientOptionsParam> & { client: Client; coolDownAdapter?: CoolDownAdapter; logger?: Logger }) {\n this.client = client\n this.coolDownAdapter = coolDownAdapter || new DefaultCoolDownAdapter()\n this.options = _.merge<CommandClientOptions, Partial<CommandClientOptionsParam>>(\n {\n command: {\n prefix: '!',\n check: () => true,\n globalAliases: () => [],\n },\n owners: 'auto',\n slashCommands: {\n check: () => true,\n },\n applicationCommands: {\n autoSync: false,\n beforeRunCheck: () => {},\n },\n },\n options,\n )\n\n this.logger = logger ?? new Logger({ name: 'Command.TS' })\n\n if (this.options.owners !== 'auto') {\n this.owners = this.options.owners\n }\n\n this.client.once('ready', () => this.ready())\n this.registry.registerModule(new CommandHandler(this.registry))\n this.registry.registerModule(new BuiltinCommandConverters(this))\n this.registry.registerModule(new BuiltinApplicationCommandConverters(this))\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { CommandClient } from './CommandClient'\nimport { Module } from './Module'\nimport { Command, ApplicationCommandArgumentConverter } from '../command'\nimport { KBuiltInModule, KListenerExecuteCache, KModulePath } from '../constants'\nimport path from 'path'\nimport { InvalidModuleError, InvalidTargetError, ModuleLoadError } from '../error'\nimport { Collection, Guild } from 'discord.js'\nimport walkSync from 'walk-sync'\nimport { ArgumentConverter } from '../command'\nimport { AppCommand } from '../applicationCommand'\nimport * as fs from 'fs'\nimport { MessageComponentHandler } from '../messageComponents/base'\n\ntype ListenerExecutor = {\n event: string\n execute: any\n}\n\nexport class Registry {\n constructor(public client: CommandClient) {}\n\n modules: Collection<symbol, Module> = new Collection()\n\n private get logger() {\n return this.client.logger.getChildLogger({\n name: 'Registry',\n })\n }\n\n get commands(): Command[] {\n const result: Command[] = []\n\n for (const [, module] of this.modules) {\n result.push(...module.commands)\n }\n\n return result\n }\n\n get argumentConverters(): ArgumentConverter[] {\n const result: ArgumentConverter[] = []\n\n for (const [, module] of this.modules) {\n result.push(...module.argumentConverters)\n }\n\n return result\n }\n\n get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[] {\n const result: ApplicationCommandArgumentConverter[] = []\n\n for (const [, module] of this.modules) {\n result.push(...module.applicationCommandArgumentConverters)\n }\n\n return result\n }\n\n get applicationCommands(): AppCommand[] {\n const result: AppCommand[] = []\n\n for (const [, module] of this.modules) {\n result.push(...module.applicationCommands)\n }\n\n return result\n }\n\n get messageComponentHandlers(): MessageComponentHandler[] {\n const result: MessageComponentHandler[] = []\n\n for (const [, module] of this.modules) {\n result.push(...module.messageComponentHandlers)\n }\n\n return result\n }\n\n registerModule(module: Module) {\n module.commandClient = this.client\n\n this.modules.set(Symbol(module.constructor.name), module)\n\n const list: ListenerExecutor[] = []\n\n for (const listener of module.listeners) {\n const bound = listener.execute.bind(module)\n list.push({ event: listener.name, execute: bound })\n this.client.client.on(listener.name, bound)\n }\n\n Reflect.defineMetadata(KListenerExecuteCache, list, module)\n\n return module\n }\n\n async loadModulesIn(dir: string, absolute = false) {\n let p = absolute ? dir : path.join(require.main!.path, dir)\n\n for (const i of walkSync(p)) {\n if (fs.lstatSync(path.join(p, i)).isFile()) {\n if (i.endsWith('.map')) continue\n await this.loadModule(path.join(p, i), true)\n }\n }\n }\n\n async loadModule(file: string, absolute: boolean = false) {\n let p = absolute ? file : path.join(require.main!.path, file)\n\n let m\n\n try {\n m = require(p)\n } catch (e: any) {\n throw new ModuleLoadError(p, e)\n }\n\n if (m.loaded) throw new Error('MODULE_ALREADY_LOADED')\n\n if (!m.install) throw new InvalidModuleError('Install function not found.')\n\n const mod = m.install(this.client)\n\n if (!(mod instanceof Module)) throw new InvalidTargetError()\n\n Reflect.defineMetadata(KModulePath, require.resolve(p), mod)\n\n this.registerModule(mod)\n\n await mod.load()\n\n m.loaded = true\n\n return mod\n }\n\n async syncCommands() {\n this.logger.debug(`Syncing commands...`)\n const commands = this.applicationCommands.filter((x) => !x.guild)\n const guild = this.client.options.applicationCommands.guild\n const syncForGuild = async (g: Guild, commands: AppCommand[]) => {\n this.logger.debug(`Syncing for guild ${g.name}(${g.id})`)\n const commandsToRegister = [\n ...commands.map((x) => x.command),\n ...this.applicationCommands.filter((y) => y.guild === g.id || y.guild?.includes(g.id) || false).map((x) => x.command),\n ]\n this.logger.debug(`Command List: ${commandsToRegister.map((x) => x.name).join(', ')}`)\n await g.commands.set(commandsToRegister)\n }\n if (guild) {\n if (typeof guild === 'string') {\n await syncForGuild(await this.client.client.guilds.fetch(guild), commands)\n } else {\n for (const g of guild) {\n await syncForGuild(await this.client.client.guilds.fetch(g), commands)\n }\n }\n } else {\n this.logger.debug('Syncing global...')\n await this.client.client.application?.commands.set(commands.map((x) => x.command))\n }\n const commandsWithGuild = this.applicationCommands.filter((x) => x.guild)\n\n const guilds = new Set<string>()\n\n for (const command of commandsWithGuild) {\n if (!command.guild) continue\n if (typeof command.guild === 'string') {\n guilds.add(command.guild)\n } else {\n for (const guild of command.guild) {\n guilds.add(guild)\n }\n }\n }\n\n for (const guild of guilds) {\n await syncForGuild(\n await this.client.client.guilds.fetch(guild),\n commandsWithGuild.filter((x) => x.guild && (typeof x.guild === 'string' ? guild === x.guild : x.guild.includes(guild))),\n )\n }\n\n this.logger.debug('Syncing ended.')\n }\n\n async unregisterModule(module: Module) {\n if (Reflect.getMetadata(KBuiltInModule, module)) throw new Error('Built-in modules cannot be unloaded')\n const symbol = this.modules.findKey((x) => x === module)\n if (!symbol) return module\n await module.unload()\n const list: ListenerExecutor[] = Reflect.getMetadata(KListenerExecuteCache, module)\n for (const listener of list) {\n this.client.client.removeListener(listener.event, listener.execute)\n }\n this.modules.delete(symbol)\n return module\n }\n\n async unloadModule(module: Module) {\n const p = Reflect.getMetadata(KModulePath, module)\n\n if (!p) throw new InvalidModuleError('This module is not loaded by loadModule.')\n\n await this.unregisterModule(module)\n delete require.cache[p]\n }\n\n async reloadModule(module: Module) {\n await module.beforeReload()\n const p = Reflect.getMetadata(KModulePath, module)\n await this.unloadModule(module)\n const mod = await this.loadModule(p, true)\n await mod.afterReload()\n return true\n }\n\n async reloadAll() {\n const results: {\n path: string\n success: boolean\n error?: Error\n }[] = []\n\n for (const [, module] of this.modules.filter((x) => !!x.path && !Reflect.getMetadata(KBuiltInModule, x))) {\n try {\n await this.reloadModule(module)\n results.push({\n path: module.path!,\n success: true,\n })\n } catch (e: any) {\n results.push({\n error: e,\n path: module.path!,\n success: false,\n })\n }\n }\n return results\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class InvalidTargetError extends Error {\n constructor() {\n super('Class does not extend \"Module\" class.')\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class ModuleLoadError extends Error {\n constructor(file: string, public error: Error) {\n super('Failed to load module ' + file)\n }\n}\n\nexport class InvalidModuleError extends Error {}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Message } from 'discord.js'\nimport { Command } from '../command'\n\nexport class ArgumentNotProvided extends Error {\n constructor(public index: number, public command: Command, public msg: Message) {\n super(`Required argument #${index} not provided.`)\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js'\nimport type { Argument } from '../command'\nimport type { AppCommandArgument } from '../applicationCommand'\n\nexport class ArgumentConverterNotFound extends Error {\n constructor(public type: Argument, public msg: Message) {\n super(`Argument converter ${type.type.name} not found.`)\n }\n}\nexport class ApplicationCommandArgumentConverterNotFound extends Error {\n constructor(public type: AppCommandArgument, public interaction: CommandInteraction | ContextMenuInteraction) {\n super(`Argument converter ${type.type.name} not found.`)\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js'\nimport { Command } from '../command'\nimport { AppCommand } from '../applicationCommand'\n\nexport class CommandCheckFailed extends Error {\n constructor(public msg: Message, public command: Command) {\n super()\n }\n}\n\nexport class ApplicationCommandCheckFailed extends Error {\n constructor(public interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction, public command: AppCommand) {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { GuildMember, Permissions } from 'discord.js'\n\nexport class UserPermissionRequired extends Error {\n constructor(public user: GuildMember, public permissions: Permissions) {\n super()\n }\n}\n\nexport class ClientPermissionRequired extends Error {\n constructor(public permissions: Permissions) {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class OwnerOnlyCommandError extends Error {\n constructor() {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class GuildOnlyCommandError extends Error {\n constructor() {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class DMOnlyCommandError extends Error {\n constructor() {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Module } from '../structures'\nimport { KBuiltInModule } from '../constants'\n\nexport class BuiltInModule extends Module {\n constructor() {\n super()\n Reflect.defineMetadata(KBuiltInModule, true, this)\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class Listener {\n constructor(public name: string, public execute: Function) {}\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Module } from './structures'\nimport { InvalidTargetError } from './error'\n\nexport const checkTarget = (target: Object) => {\n if (!(target instanceof Module)) throw new InvalidTargetError()\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { checkTarget } from '../utils'\nimport { KListeners } from '../constants'\nimport { Listener } from './Listener'\nimport { Module } from '../structures'\n\nexport const listener = (event: string) => {\n return (\n target: Module,\n propertyKey: string,\n // descriptor: TypedPropertyDescriptor<any>,\n ) => {\n checkTarget(target)\n\n let properties: Listener[] = Reflect.getMetadata(KListeners, target)\n\n const listener = new Listener(event, Reflect.get(target, propertyKey))\n\n if (properties) {\n properties.push(listener)\n } else {\n properties = [listener]\n Reflect.defineMetadata(KListeners, properties, target)\n }\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { BuiltInModule } from './BuiltInModule'\nimport { Registry } from '../structures'\nimport { listener } from '../listener'\nimport {\n CommandInteraction,\n CommandInteractionOptionResolver,\n GuildMember,\n Interaction,\n Message,\n MessageComponentInteraction,\n MessageContextMenuInteraction,\n Role,\n User,\n UserContextMenuInteraction,\n} from 'discord.js'\nimport { CommandClient } from '../structures'\nimport { Command } from '../command'\nimport { ArgumentConverterNotFound, ArgumentNotProvided, CommandCheckFailed, ApplicationCommandArgumentConverterNotFound, ApplicationCommandCheckFailed } from '../error'\nimport { CommandNotFound } from '../error/CommandNotFound'\nimport { SlashCommandGlobalCheckError } from '../error/checks/SlashCommandGlobalCheckError'\nimport { MessageComponentHandler } from '../messageComponents/base'\n\nexport class CommandHandler extends BuiltInModule {\n private readonly client: CommandClient\n\n constructor(private registry: Registry) {\n super()\n this.client = registry.client\n }\n\n // region message command handler\n @listener('messageCreate')\n async message(msg: Message) {\n const error = (error: Error) => this.client.client.emit('commandError', error, msg)\n\n try {\n const prefixList: string[] | string =\n typeof this.client.options.command.prefix === 'string'\n ? this.client.options.command.prefix\n : typeof this.client.options.command.prefix === 'function'\n ? await this.client.options.command.prefix(msg)\n : this.client.options.command.prefix\n let prefix: string\n if (typeof prefixList === 'object') {\n const res = prefixList.find((x) => msg.content.includes(x))\n\n if (!res) return\n\n prefix = res\n } else {\n if (!msg.content.includes(prefixList)) return\n prefix = prefixList\n }\n\n if (!msg.content.startsWith(prefix)) return\n\n const args = msg.content.slice(prefix.length).split(' ')\n\n const command = args.shift()\n\n if (!command) return\n\n let cmd: Command | null = null\n\n const globalAliases = await this.client.options.command.globalAliases(command, msg)\n\n for (const c of this.registry.commands) {\n const globalAliases2 = await this.client.options.command.globalAliases(c.name, msg)\n const aliases = typeof c.aliases === 'function' ? await c.aliases(msg) : c.aliases\n if ([...aliases, c.name].some((x) => x === command)) {\n cmd = c\n break\n }\n if (globalAliases.every((x, i) => globalAliases2[i] === x)) {\n cmd = c\n break\n }\n }\n\n msg.data = {\n cts: this.client,\n command: cmd,\n prefix: prefix,\n }\n\n if (!(await this.client.options.command.check(msg))) {\n return\n }\n\n if (!cmd) return error(new CommandNotFound(command, msg, args))\n\n const module = this.registry.modules.find((x) => x.commands.includes(cmd!))\n\n if (!module) return\n\n const argList: any[] = []\n\n for (const check of cmd.checks) {\n if (!(await check(msg))) return error(new CommandCheckFailed(msg, cmd))\n }\n\n for (let i = 0; i < cmd.argTypes.length; i++) {\n const argType = cmd.argTypes[i]\n const converter = this.registry.argumentConverters.find((x) => x.type === argType.type)\n\n if (argType.rest) {\n const i = args.join(' ')\n if (!i) break\n argList.push(i)\n break\n }\n\n if (!converter) return error(new ArgumentConverterNotFound(argType, msg))\n\n const converterModule = this.registry.modules.find((x) => x.argumentConverters.includes(converter))\n\n if (!converterModule) return error(new ArgumentConverterNotFound(argType, msg))\n\n if (converter.withoutParameter) {\n argList.push(await converter.execute(converterModule, msg))\n continue\n }\n const arg = args.shift()\n if (argType.optional && !arg) {\n break\n }\n if (!arg) {\n return error(new ArgumentNotProvided(i, cmd, msg))\n }\n const executed = await converter.execute(converterModule, msg, arg)\n if ((executed === undefined || executed === null) && !argType.optional) {\n return error(new ArgumentNotProvided(i, cmd, msg))\n }\n argList.push(executed)\n }\n\n try {\n await cmd.execute(module, argList)\n } catch (e: any) {\n return error(e)\n }\n } catch (e) {\n return error(e)\n }\n }\n // endregion\n\n // region slash command handler\n private async command(i: CommandInteraction) {\n const error = (error: Error) => this.client.client.emit('applicationCommandError', error, i)\n try {\n const cmd = this.registry.applicationCommands.find((x) => x.command.type === 'CHAT_INPUT' && x.command.name === i.commandName)\n\n if (!cmd) return\n\n const module = this.registry.modules.find((x) => x.applicationCommands.includes(cmd))\n\n if (!module) return\n\n const argList: any[] = []\n\n i.data = {\n cts: this.client,\n command: cmd,\n }\n\n if (!(await this.client.options.slashCommands.check(i))) {\n return error(new SlashCommandGlobalCheckError(i))\n }\n for (const check of cmd.checks) {\n if (!(await check(i))) return error(new ApplicationCommandCheckFailed(i, cmd))\n }\n\n for (let j = 0; j < cmd.params.length; j++) {\n const argType = cmd.params[j]\n const converter = this.registry.applicationCommandArgumentConverters.find((x) => x.type === argType.type)\n\n if (argType.type === CommandInteraction) {\n argList.push(i)\n continue\n }\n\n if (argType.type === CommandInteractionOptionResolver) {\n argList.push(i.options)\n continue\n }\n\n if (argType.name) {\n switch (argType.type) {\n case String:\n argList.push(i.options.getString(argType.name, false) || undefined)\n break\n case Role:\n argList.push(i.options.getRole(argType.name, false) || undefined)\n break\n case User:\n argList.push(i.options.getUser(argType.name, false) || undefined)\n break\n case GuildMember:\n argList.push(i.options.getMember(argType.name, false) || undefined)\n break\n case Boolean:\n argList.push(i.options.getBoolean(argType.name, false) || undefined)\n break\n case Number:\n const opt = i.options.get(argType.name, false)\n if (!opt) {\n argList.push(undefined)\n break\n }\n if (opt.type == 'NUMBER') {\n argList.push(i.options.getNumber(argType.name, false) ?? undefined)\n break\n }\n if (opt.type == 'INTEGER') {\n argList.push(i.options.getInteger(argType.name, false) ?? undefined)\n break\n }\n }\n continue\n }\n\n if (!converter) return error(new ApplicationCommandArgumentConverterNotFound(argType, i))\n\n argList.push(await converter.execute(module, i))\n }\n\n await cmd.execute(module, argList)\n } catch (e) {\n return error(e)\n }\n }\n // endregion\n\n private async messageComponent(i: MessageComponentInteraction) {\n const error = (e: any) => this.client.client.emit('messageComponentError', e)\n\n try {\n const handlers: MessageComponentHandler[] = []\n\n for (const handler of this.registry.messageComponentHandlers) {\n if (handler.componentId === handler.componentId && handler.componentType === i.componentType) {\n handlers.push(handler)\n }\n }\n\n for (const handler of handlers) {\n const module = this.registry.modules.find((x) => x.messageComponentHandlers.includes(handler))\n if (!module) continue\n await handler.run(module, i)\n }\n } catch (e) {\n error(e)\n }\n }\n\n private async userContextMenu(i: UserContextMenuInteraction) {\n const error = (error: Error) => this.client.client.emit('applicationCommandError', error, i)\n try {\n const cmd = this.registry.applicationCommands.find((x) => x.command.type === 'USER' && x.command.name === i.commandName)\n\n if (!cmd) return\n\n const module = this.registry.modules.find((x) => x.applicationCommands.includes(cmd))\n\n if (!module) return\n\n i.data = {\n cts: this.client,\n command: cmd,\n }\n\n for (const check of cmd.checks) {\n if (!(await check(i))) return error(new ApplicationCommandCheckFailed(i, cmd))\n }\n\n let argList: any[] = []\n\n for (let j = 0; j < cmd.params.length; j++) {\n const argType = cmd.params[j]\n const converter = this.registry.applicationCommandArgumentConverters.find((x) => x.type === argType.type)\n\n if (argType.type === UserContextMenuInteraction) {\n argList.push(i)\n continue\n }\n\n if (!converter) return error(new ApplicationCommandArgumentConverterNotFound(argType, i))\n\n argList.push(await converter.execute(module, i))\n }\n\n await cmd.execute(module, argList)\n } catch (e) {\n return error(e)\n }\n }\n\n private async messageContextMenu(i: MessageContextMenuInteraction) {\n const error = (error: Error) => this.client.client.emit('applicationCommandError', error, i)\n try {\n const cmd = this.registry.applicationCommands.find((x) => x.command.type === 'MESSAGE' && x.command.name === i.commandName)\n\n if (!cmd) return\n\n const module = this.registry.modules.find((x) => x.applicationCommands.includes(cmd))\n\n if (!module) return\n\n i.data = {\n cts: this.client,\n command: cmd,\n }\n\n for (const check of cmd.checks) {\n if (!(await check(i))) return error(new ApplicationCommandCheckFailed(i, cmd))\n }\n\n let argList: any[] = []\n\n for (let j = 0; j < cmd.params.length; j++) {\n const argType = cmd.params[j]\n const converter = this.registry.applicationCommandArgumentConverters.find((x) => x.type === argType.type)\n\n if (argType.type === MessageContextMenuInteraction) {\n argList.push(i)\n continue\n }\n\n if (!converter) return error(new ApplicationCommandArgumentConverterNotFound(argType, i))\n\n argList.push(await converter.execute(module, i))\n }\n\n await cmd.execute(module, argList)\n } catch (e) {\n return error(e)\n }\n }\n\n @listener('interactionCreate')\n async interaction(i: Interaction) {\n const error = (e: any) => this.client.client.emit('interactionError', e, i)\n\n try {\n await this.client.options.applicationCommands.beforeRunCheck(i)\n if (i.isCommand()) {\n await this.command(i)\n return\n }\n if (i.isMessageComponent()) {\n await this.messageComponent(i)\n return\n }\n if (i.isMessageContextMenu()) {\n await this.messageContextMenu(i)\n return\n }\n if (i.isUserContextMenu()) {\n await this.userContextMenu(i)\n return\n }\n } catch (e) {\n return error(e)\n }\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Message } from 'discord.js'\n\nexport class CommandNotFound extends Error {\n constructor(public commandName: string, public msg: Message, public args: string[]) {\n super(`Command ${commandName} not found.`)\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { CommandInteraction } from 'discord.js'\n\nexport class SlashCommandGlobalCheckError extends Error {\n constructor(public i: CommandInteraction) {\n super('Slash command before-run check failed.')\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Module } from '../structures'\nimport { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js'\nimport { KCommandChecks } from '../constants'\n\nexport type Argument = {\n optional: boolean\n type: any\n rest: boolean\n}\n\nexport type CheckFunction = (msg: Message) => boolean | Promise<boolean>\nexport type ApplicationCommandCheckFunction = (i: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction) => boolean | Promise<boolean>\n\nexport class Command {\n execute(module: Module, args: any[]) {\n return this.run.apply(module, args)\n }\n\n get checks(): CheckFunction[] {\n return Reflect.getMetadata(KCommandChecks, this.module, this.key) || []\n }\n\n constructor(\n private run: Function,\n public argTypes: Argument[],\n public name: string,\n public aliases: string[] | ((msg: Message) => string[] | Promise<string[]>),\n public module: Module,\n public key: symbol | string,\n ) {}\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Module } from '../structures'\nimport { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js'\n\nexport class ArgumentConverter {\n execute(module: Module, msg: Message, arg?: string) {\n return this.run.apply(module, [msg, arg])\n }\n\n constructor(public type: object, private run: Function, public withoutParameter: boolean) {}\n}\n\nexport class ApplicationCommandArgumentConverter {\n execute(module: Module, interaction: CommandInteraction | ContextMenuInteraction) {\n return this.run.apply(module, [interaction])\n }\n\n constructor(public type: object, private run: Function) {}\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js'\nimport type { CheckFunction, ApplicationCommandCheckFunction } from './Command'\nimport { KCommandChecks, KApplicationCommandChecks } from '../constants'\n\nexport const createCheckDecorator = (\n execute: ((msg: Message) => boolean | Promise<boolean>) | null,\n executeApplicationCommand?: (i: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction) => boolean | Promise<boolean>,\n): MethodDecorator => {\n return (target, propertyKey) => {\n if (execute) {\n let properties: CheckFunction[] = Reflect.getMetadata(KCommandChecks, target, propertyKey)\n if (properties) {\n properties.push(execute)\n } else {\n properties = [execute]\n Reflect.defineMetadata(KCommandChecks, properties, target, propertyKey)\n }\n }\n if (executeApplicationCommand) {\n let properties: ApplicationCommandCheckFunction[] = Reflect.getMetadata(KApplicationCommandChecks, target, propertyKey)\n if (properties) {\n properties.push(executeApplicationCommand)\n } else {\n properties = [executeApplicationCommand]\n Reflect.defineMetadata(KApplicationCommandChecks, properties, target, propertyKey)\n }\n }\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { KArgumentConverters, KCommands, KOptionals, KRest, KSlashArgumentConverters } from '../constants'\nimport { Command } from './Command'\nimport { checkTarget } from '../utils'\nimport { ArgumentConverter, ApplicationCommandArgumentConverter } from './ArgumentConverter'\nimport { Module } from '../structures'\nimport { createCheckDecorator } from './utils'\nimport { GuildMember, Message, PermissionResolvable, Permissions, TextChannel } from 'discord.js'\nimport { ClientPermissionRequired, DMOnlyCommandError, GuildOnlyCommandError, OwnerOnlyCommandError, UserPermissionRequired } from '../error'\n\ntype CommandOptions = {\n name: string\n aliases: string[] | ((msg: Message) => string[])\n optionTypes?: any[]\n}\n\nexport const command = (options: Partial<CommandOptions> = {}) => {\n return (\n target: Object,\n propertyKey: string,\n // descriptor: TypedPropertyDescriptor<any>,\n ) => {\n checkTarget(target)\n\n let properties: Command[] = Reflect.getMetadata(KCommands, target)\n\n const params: any[] = options.optionTypes ?? Reflect.getMetadata('design:paramtypes', target, propertyKey)\n\n const optionals: number = Reflect.getMetadata(KOptionals, target, propertyKey) || -1\n\n const rest = Reflect.getMetadata(KRest, target, propertyKey) || -1\n\n const command = new Command(\n Reflect.get(target, propertyKey),\n params.map((x, i) => ({\n type: x,\n optional: optionals === -1 ? false : optionals <= i,\n rest: rest === -1 ? false : rest === i,\n })),\n options.name || propertyKey,\n options.aliases || [],\n target as Module,\n propertyKey,\n )\n\n if (properties) {\n properties.push(command)\n } else {\n properties = [command]\n Reflect.defineMetadata(KCommands, properties, target)\n }\n }\n}\n\nexport const argumentConverter = (type: object, requireParameter = true) => {\n return (\n target: Object,\n propertyKey: string,\n // descriptor: TypedPropertyDescriptor<any>,\n ) => {\n checkTarget(target)\n\n let properties: ArgumentConverter[] = Reflect.getMetadata(KArgumentConverters, target)\n\n const converter = new ArgumentConverter(type, Reflect.get(target, propertyKey), !requireParameter)\n\n if (properties) {\n properties.push(converter)\n } else {\n properties = [converter]\n Reflect.defineMetadata(KArgumentConverters, properties, target)\n }\n }\n}\n\nexport const applicationCommandArgumentConverter = (type: object) => {\n return (\n target: Object,\n propertyKey: string,\n // descriptor: TypedPropertyDescriptor<any>,\n ) => {\n checkTarget(target)\n\n let properties: ApplicationCommandArgumentConverter[] = Reflect.getMetadata(KSlashArgumentConverters, target)\n\n const converter = new ApplicationCommandArgumentConverter(type, Reflect.get(target, propertyKey))\n\n if (properties) {\n properties.push(converter)\n } else {\n properties = [converter]\n Reflect.defineMetadata(KSlashArgumentConverters, properties, target)\n }\n }\n}\n\nexport const optional: ParameterDecorator = (target, propertyKey, parameterIndex) => {\n checkTarget(target)\n\n Reflect.defineMetadata(KOptionals, parameterIndex, target, propertyKey)\n}\n\nexport const rest: ParameterDecorator = (target, propertyKey, parameterIndex) => {\n checkTarget(target)\n\n const params: any[] = Reflect.getMetadata('design:paramtypes', target, propertyKey)\n\n if (params.length - 1 !== parameterIndex) throw new Error('Rest decorator must be used at last argument.')\n\n if (params[parameterIndex] !== String) throw new Error('Rest argument type must be \"String\"')\n\n Reflect.defineMetadata(KRest, parameterIndex, target, propertyKey)\n}\n\nexport const ownerOnly = createCheckDecorator(\n (msg) => {\n if (msg.data.cts.owners.includes(msg.author.id)) return true\n throw new OwnerOnlyCommandError()\n },\n (i) => {\n if (i.data.cts.owners.includes(i.user.id)) return true\n throw new OwnerOnlyCommandError()\n },\n)\n\nexport const guildOnly = createCheckDecorator(\n (msg) => {\n if (!!msg.guild) return true\n throw new GuildOnlyCommandError()\n },\n (i) => {\n if (!!i.guildId) return true\n throw new GuildOnlyCommandError()\n },\n)\n\nexport const dmOnly = createCheckDecorator(\n (msg) => {\n if (!msg.guild) return true\n throw new DMOnlyCommandError()\n },\n (i) => {\n if (!i.guildId) return true\n throw new DMOnlyCommandError()\n },\n)\n\nexport const requireUserPermissions = (permission: PermissionResolvable) =>\n createCheckDecorator(\n (msg) => {\n if (!msg.guild || !msg.member) throw new Error('This command must be used in guild.')\n if (msg.member.permissionsIn(msg.channel as TextChannel).has(permission)) {\n return true\n }\n throw new UserPermissionRequired(msg.member, new Permissions(permission))\n },\n (i) => {\n if (!i.guild || !i.member) throw new Error('This command must be used in guild.')\n if (!(i.member instanceof GuildMember) || i.member.permissionsIn(i.channel as TextChannel).has(permission)) {\n return true\n }\n throw new UserPermissionRequired(i.member, new Permissions(permission))\n },\n )\n\nexport const requireClientPermissions = (permission: PermissionResolvable) =>\n createCheckDecorator(\n (msg) => {\n if (!msg.guild) throw new Error('This command must be used in guild.')\n if (msg.guild.me!.permissionsIn(msg.channel as TextChannel).has(permission)) {\n return true\n }\n throw new ClientPermissionRequired(new Permissions(permission))\n },\n (i) => {\n if (!i.guild) throw new Error('This command must be used in guild.')\n if (i.guild.me!.permissionsIn(i.channel as TextChannel).has(permission)) {\n return true\n }\n throw new ClientPermissionRequired(new Permissions(permission))\n },\n )\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport enum CoolDownType {\n USER,\n CHANNEL,\n GUILD,\n ROLE,\n CATEGORY,\n MEMBER,\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { createCheckDecorator } from '../utils'\nimport { CoolDownType } from './type'\nimport { DMChannel, GuildMember, TextChannel } from 'discord.js'\nimport { CoolDownError } from './error'\n\nexport const coolDown = (type: CoolDownType, seconds: number) =>\n createCheckDecorator(\n async (msg) => {\n const a = msg.data.cts.coolDownAdapter\n const getKey = (): string => {\n switch (type) {\n case CoolDownType.USER:\n return msg.author.id\n case CoolDownType.GUILD:\n return (msg.guild || msg.author).id\n case CoolDownType.CHANNEL:\n return msg.channel.id\n case CoolDownType.MEMBER:\n return `${msg.guild?.id}.${msg.author.id}`\n case CoolDownType.ROLE:\n return (msg.channel instanceof DMChannel ? msg.channel : msg.member!.roles.highest).id\n case CoolDownType.CATEGORY:\n return ((msg.channel as TextChannel).parent || msg.channel).id\n }\n }\n const key = getKey()\n const data = await a.get(key)\n const now = Date.now()\n if (!data || !(now - data < seconds * 1000)) {\n await a.set(key, now)\n return true\n }\n throw new CoolDownError(new Date(data + seconds * 1000))\n },\n async (i) => {\n const a = i.data.cts.coolDownAdapter\n const getKey = (): string => {\n switch (type) {\n case CoolDownType.USER:\n return i.user.id\n case CoolDownType.GUILD:\n return (i.guild || i.user).id\n case CoolDownType.CHANNEL:\n return i.channel!.id\n case CoolDownType.MEMBER:\n return `${i.guild?.id}.${i.user.id}`\n case CoolDownType.ROLE:\n return (i.channel instanceof DMChannel ? i.channel : (i.member as GuildMember)!.roles.highest).id\n case CoolDownType.CATEGORY:\n return ((i.channel as TextChannel).parent || i.channel!).id\n }\n }\n const key = getKey()\n const data = await a.get(key)\n const now = Date.now()\n if (!data || !(now - data < seconds * 1000)) {\n await a.set(key, now)\n return true\n }\n throw new CoolDownError(new Date(data + seconds * 1000))\n },\n )\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nexport class CoolDownError extends Error {\n constructor(public endsAt: Date) {\n super()\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Collection } from 'discord.js'\n\nexport interface CoolDownAdapter {\n get(id: string): Promise<number | undefined>\n set(id: string, value: number): Promise<void>\n}\n\nexport class DefaultCoolDownAdapter implements CoolDownAdapter {\n map = new Collection<string, number>()\n async get(id: string): Promise<number | undefined> {\n return this.map.get(id)\n }\n\n async set(id: string, value: number) {\n this.map.set(id, value)\n return\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { BuiltInModule } from './BuiltInModule'\nimport { argumentConverter } from '../command'\nimport { Client, GuildMember, Message, User, Role } from 'discord.js'\nimport { CommandClient } from '../structures'\n\nexport class BuiltinCommandConverters extends BuiltInModule {\n client: Client\n\n constructor(private cts: CommandClient) {\n super()\n this.client = cts.client\n }\n\n @argumentConverter(Message, false)\n message(msg: Message) {\n return msg\n }\n\n @argumentConverter(String)\n string(msg: Message, arg: string) {\n return arg\n }\n\n getUserIDByMention(mention: string): `${bigint}` | undefined {\n if (!mention) return\n if (mention.startsWith('<@') && mention.endsWith('>')) {\n mention = mention.slice(2, -1)\n if (mention.startsWith('!')) {\n mention = mention.slice(1)\n }\n return mention as `${bigint}`\n }\n }\n\n @argumentConverter(User)\n user(msg: Message, value: string): User | null {\n let user = this.client.users.cache.get(value)\n if (user) return user\n user = this.client.users.cache.find((x) => x.tag === value || x.username === value)\n if (user) return user\n const id = this.getUserIDByMention(value)\n if (!id) return null\n user = this.client.users.cache.get(id)\n return user || null\n }\n\n @argumentConverter(GuildMember)\n member(msg: Message, value: string): GuildMember | undefined {\n let user = msg.guild?.members.cache.get(value)\n if (!user) return user\n user = msg.guild?.members.cache.find((x) => x.user.tag === value)\n if (user) return user\n const id = this.getUserIDByMention(value)\n if (!id) return\n user = msg.guild?.members.cache.get(id)\n return user || undefined\n }\n\n @argumentConverter(Number)\n number(msg: Message, value: string) {\n const n = Number(value)\n return isNaN(n) ? undefined : n\n }\n\n getRoleIDByMention(mention: string): `${bigint}` | undefined {\n if (!mention) return\n if (mention.startsWith('<@') && mention.endsWith('>')) {\n mention = mention.slice(2, -1)\n if (mention.startsWith('&')) {\n mention = mention.slice(1)\n }\n return mention as `${bigint}`\n }\n }\n\n @argumentConverter(Role)\n role(msg: Message, value: string): Role | undefined {\n const id = this.getRoleIDByMention(value)\n if (!id) return\n const role = msg.guild?.roles.cache.get(id)\n return role || undefined\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { BuiltInModule } from './BuiltInModule'\nimport { Client } from 'discord.js'\nimport { CommandClient } from '../structures'\n\nexport class BuiltinApplicationCommandConverters extends BuiltInModule {\n client: Client\n\n constructor(private cts: CommandClient) {\n super()\n this.client = cts.client\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { ApplicationCommandDataResolvable, Collection, Snowflake } from 'discord.js'\nimport { checkTarget } from '../utils'\nimport { KSlashCommandOptions, KApplicationCommands } from '../constants'\nimport { Module } from '../structures'\nimport { AppCommand } from './AppCommand'\n\ntype ApplicationCommandOptions = {\n guild: Snowflake | Snowflake[]\n optionTypes?: any[]\n}\n\nexport const applicationCommand = (opt: Partial<ApplicationCommandOptions> & { command: ApplicationCommandDataResolvable }) => {\n return (\n target: Object,\n propertyKey: string,\n // descriptor: TypedPropertyDescriptor<any>,\n ) => {\n checkTarget(target)\n\n let properties: AppCommand[] = Reflect.getMetadata(KApplicationCommands, target)\n\n const params: any[] = opt.optionTypes ?? Reflect.getMetadata('design:paramtypes', target, propertyKey)\n\n const options: Collection<number, string> = Reflect.getMetadata(KSlashCommandOptions, target, propertyKey) || new Collection<number, string>()\n\n const command = new AppCommand(\n opt.command,\n Reflect.get(target, propertyKey),\n target as Module,\n params.map((x, i) => ({\n type: x,\n name: options.get(i),\n })),\n opt.guild,\n propertyKey,\n )\n\n if (properties) {\n properties.push(command)\n } else {\n properties = [command]\n Reflect.defineMetadata(KApplicationCommands, properties, target)\n }\n }\n}\n\nexport const option = (key: string): ParameterDecorator => (target, propertyKey, parameterIndex) => {\n checkTarget(target)\n\n let properties: Collection<number, string> = Reflect.getMetadata(KSlashCommandOptions, target, propertyKey)\n\n if (!properties) {\n properties = new Collection<number, string>()\n Reflect.defineMetadata(KSlashCommandOptions, properties, target, propertyKey)\n }\n\n properties.set(parameterIndex, key)\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { Module } from '../structures'\nimport { ApplicationCommandDataResolvable, Snowflake } from 'discord.js'\nimport { KApplicationCommandChecks } from '../constants'\nimport { ApplicationCommandCheckFunction } from '../command'\n\nexport type AppCommandArgument = {\n type: any\n name?: string\n}\n\nexport class AppCommand {\n get checks(): ApplicationCommandCheckFunction[] {\n return Reflect.getMetadata(KApplicationCommandChecks, this.module, this.key) || []\n }\n\n execute(module: Module, args: any[]) {\n return this.run.apply(module, args)\n }\n\n constructor(\n public command: ApplicationCommandDataResolvable,\n private run: Function,\n public module: Module,\n public params: AppCommandArgument[],\n public guild: Snowflake | Snowflake[] | undefined,\n private key: string | symbol,\n ) {}\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { MessageComponentInteraction, MessageComponentType } from 'discord.js'\nimport { Module } from '../structures'\n\nexport type MessageComponentExecutor = (i: MessageComponentInteraction) => void | Promise<void>\n\nexport class MessageComponentHandler {\n constructor(public componentId: string, public componentType: Exclude<MessageComponentType, 'ACTION_ROW'>, public execute: MessageComponentExecutor) {}\n\n run(module: Module, i: MessageComponentInteraction) {\n return this.execute.apply(module, [i])\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { MessageComponentExecutor, MessageComponentHandler } from './base'\nimport { checkTarget } from '../utils'\nimport { KMessageComponentHandlers } from '../constants'\n\nexport class ButtonInteractionHandler extends MessageComponentHandler {\n constructor(id: string, execute: MessageComponentExecutor) {\n super(id, 'BUTTON', execute)\n }\n}\n\nexport const messageButton = (id: string): MethodDecorator => {\n return (target, propertyKey) => {\n checkTarget(target)\n\n const handler = new ButtonInteractionHandler(id, Reflect.get(target, propertyKey))\n\n let properties: MessageComponentHandler[] = Reflect.getMetadata(KMessageComponentHandlers, target)\n\n if (properties) {\n properties.push(handler)\n } else {\n properties = [handler]\n Reflect.defineMetadata(KMessageComponentHandlers, properties, target)\n }\n }\n}\n","/*\n * Copyright (c) 2022 pikokr. Licensed under the MIT license\n */\n\nimport { MessageComponentExecutor, MessageComponentHandler } from './base'\nimport { checkTarget } from '../utils'\nimport { KMessageComponentHandlers } from '../constants'\n\nexport class SelectMenuInteractionHandler extends MessageComponentHandler {\n constructor(id: string, execute: MessageComponentExecutor) {\n super(id, 'SELECT_MENU', execute)\n }\n}\n\nexport const messageSelectMenu = (id: string): MethodDecorator => {\n return (target, propertyKey) => {\n checkTarget(target)\n\n const handler = new SelectMenuInteractionHandler(id, Reflect.get(target, propertyKey))\n\n let properties: MessageComponentHandler[] = Reflect.getMetadata(KMessageComponentHandlers, target)\n\n if (properties) {\n properties.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yB,EAAI,QAAQ,IAAI,EAAQ,IAEjE,EAAwC,QAAQ,YAAY,EAA2B,GAE3F,AAAI,EACF,EAAW,KAAK,GAEhB,GAAa,CAAC,GACd,QAAQ,eAAe,EAA2B,EAAY,KAZ1C,iBCNpB,oBAA4C,EAAuB,aAC3D,EAAY,EAAmC,CACzD,MAAM,EAAI,cAAe,KAFvB,qCAMC,GAAM,IAAiB,EAAI,GAC1B,CAAE,EAAQ,IAAgB,CAC9B,EAAY,GAEZ,GAAM,GAAU,GAAI,IAA6B,EAAI,QAAQ,IAAI,EAAQ,IAErE,EAAwC,QAAQ,YAAY,EAA2B,GAE3F,AAAI,EACF,EAAW,KAAK,GAEhB,GAAa,CAAC,GACd,QAAQ,eAAe,EAA2B,EAAY,KAZtC","names":[]}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikokr/command.ts",
|
|
3
3
|
"description": "Discord.js command framework for typescript.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.1-dev.1c9fbc0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@discordjs/rest": "^0.1.0-canary.0",
|
|
9
|
+
"@swc/core": "^1.2.135",
|
|
11
10
|
"@types/lodash": "^4.14.172",
|
|
12
11
|
"all-contributors-cli": "^6.20.0",
|
|
13
|
-
"discord.js": "^13.
|
|
12
|
+
"discord.js": "^13.6.0",
|
|
14
13
|
"prettier": "^2.2.1",
|
|
15
14
|
"ts-node": "^10.1.0",
|
|
15
|
+
"tsup": "^5.11.12",
|
|
16
16
|
"typedoc": "^0.20.35"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
"url": "https://github.com/pikokr/command.ts-v2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"prepack": "
|
|
32
|
+
"prepack": "yarn build",
|
|
33
|
+
"build": "tsup-node",
|
|
33
34
|
"docs:dev": "typedoc",
|
|
34
35
|
"docs:build": "typedoc"
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
}
|