reciple 6.0.0-dev.19 → 6.0.0-dev.20
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/LICENSE +674 -674
- package/README.md +183 -183
- package/dist/lib/bin.mjs +65 -65
- package/dist/lib/esm.mjs +1 -1
- package/dist/lib/index.js +35 -35
- package/dist/lib/reciple/classes/RecipleClient.js +296 -296
- package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
- package/dist/lib/reciple/classes/RecipleModule.js +94 -94
- package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +242 -242
- package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +85 -85
- package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +216 -216
- package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -172
- package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +100 -100
- package/dist/lib/reciple/classes/managers/{ClientCommandManager.js → CommandManager.js} +59 -62
- package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
- package/dist/lib/reciple/classes/managers/{ClientModuleManager.js → ModuleManager.js} +179 -183
- package/dist/lib/reciple/flags.js +31 -31
- package/dist/lib/reciple/permissions.js +30 -30
- package/dist/lib/reciple/types/builders.js +11 -11
- package/dist/lib/reciple/types/commands.js +15 -15
- package/dist/lib/reciple/types/paramOptions.js +2 -2
- package/dist/lib/reciple/util.js +68 -68
- package/dist/lib/reciple/version.js +47 -47
- package/dist/types/bin.d.mts +2 -2
- package/dist/types/esm.d.mts +1 -1
- package/dist/types/index.d.ts +19 -19
- package/dist/types/reciple/classes/RecipleClient.d.ts +103 -103
- package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
- package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
- package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +150 -150
- package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +43 -43
- package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +88 -88
- package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -51
- package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
- package/dist/types/reciple/classes/managers/{ClientCommandManager.d.ts → CommandManager.d.ts} +36 -37
- package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
- package/dist/types/reciple/classes/managers/{ClientModuleManager.d.ts → ModuleManager.d.ts} +49 -49
- package/dist/types/reciple/flags.d.ts +17 -17
- package/dist/types/reciple/permissions.d.ts +19 -19
- package/dist/types/reciple/types/builders.d.ts +197 -197
- package/dist/types/reciple/types/commands.d.ts +81 -81
- package/dist/types/reciple/types/paramOptions.d.ts +101 -101
- package/dist/types/reciple/util.d.ts +23 -23
- package/dist/types/reciple/version.d.ts +25 -25
- package/package.json +1 -1
- package/resource/reciple.yml +120 -120
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ClientOptions, PermissionResolvable } from 'discord.js';
|
|
2
|
-
/**
|
|
3
|
-
* Command permissions config object interface
|
|
4
|
-
*/
|
|
5
|
-
export interface ConfigCommandPermissions {
|
|
6
|
-
/**
|
|
7
|
-
* Command name
|
|
8
|
-
*/
|
|
9
|
-
command: string;
|
|
10
|
-
/**
|
|
11
|
-
* Override command builder permissions
|
|
12
|
-
*/
|
|
13
|
-
permissions: PermissionResolvable[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Reciple config object interface
|
|
17
|
-
*/
|
|
18
|
-
export interface Config {
|
|
19
|
-
token: string;
|
|
20
|
-
commands: {
|
|
21
|
-
slashCommand: {
|
|
22
|
-
enabled: boolean;
|
|
23
|
-
replyOnError: boolean;
|
|
24
|
-
registerCommands: boolean;
|
|
25
|
-
allowRegisterEmptyCommandList: boolean;
|
|
26
|
-
enableCooldown: boolean;
|
|
27
|
-
setRequiredPermissions: boolean;
|
|
28
|
-
acceptRepliedInteractions: boolean;
|
|
29
|
-
guilds?: string[] | string;
|
|
30
|
-
permissions: {
|
|
31
|
-
enabled: boolean;
|
|
32
|
-
commands: ConfigCommandPermissions[];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
messageCommand: {
|
|
36
|
-
enabled: boolean;
|
|
37
|
-
prefix?: string;
|
|
38
|
-
replyOnError: boolean;
|
|
39
|
-
allowCommandAlias: boolean;
|
|
40
|
-
enableCooldown: boolean;
|
|
41
|
-
commandArgumentSeparator: string;
|
|
42
|
-
permissions: {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
commands: ConfigCommandPermissions[];
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
fileLogging: {
|
|
49
|
-
enabled: boolean;
|
|
50
|
-
debugmode: boolean;
|
|
51
|
-
clientLogs: boolean;
|
|
52
|
-
stringifyLoggedJSON: boolean;
|
|
53
|
-
logFilePath: string;
|
|
54
|
-
};
|
|
55
|
-
client: ClientOptions;
|
|
56
|
-
messages: {
|
|
57
|
-
[messageKey: string]: any;
|
|
58
|
-
};
|
|
59
|
-
ignoredFiles: string[];
|
|
60
|
-
modulesFolder: string | string[];
|
|
61
|
-
disableVersionCheck: boolean;
|
|
62
|
-
version: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Create/parse reciple config
|
|
66
|
-
*/
|
|
67
|
-
export declare class RecipleConfig {
|
|
68
|
-
config: Config;
|
|
69
|
-
configPath: string;
|
|
70
|
-
static defaultConfigPath: string;
|
|
71
|
-
/**
|
|
72
|
-
* @param configPath Path to config
|
|
73
|
-
*/
|
|
74
|
-
constructor(configPath: string);
|
|
75
|
-
/**
|
|
76
|
-
* Parse the config file
|
|
77
|
-
*/
|
|
78
|
-
parseConfig(): this;
|
|
79
|
-
/**
|
|
80
|
-
* Returns the parsed config file
|
|
81
|
-
*/
|
|
82
|
-
getConfig(): Config;
|
|
83
|
-
/**
|
|
84
|
-
* Parse token from config
|
|
85
|
-
* @param askIfEmpty Ask for token if the token is undefined
|
|
86
|
-
*/
|
|
87
|
-
parseToken(askIfEmpty?: boolean): string | null;
|
|
88
|
-
/**
|
|
89
|
-
* Check if the config version is supported
|
|
90
|
-
*/
|
|
91
|
-
protected _isSupportedConfig(): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Ask for a token
|
|
94
|
-
*/
|
|
95
|
-
protected _askToken(): string | null;
|
|
96
|
-
/**
|
|
97
|
-
* Get default config
|
|
98
|
-
*/
|
|
99
|
-
static getDefaultConfig(): Config;
|
|
100
|
-
}
|
|
1
|
+
import { ClientOptions, PermissionResolvable } from 'discord.js';
|
|
2
|
+
/**
|
|
3
|
+
* Command permissions config object interface
|
|
4
|
+
*/
|
|
5
|
+
export interface ConfigCommandPermissions {
|
|
6
|
+
/**
|
|
7
|
+
* Command name
|
|
8
|
+
*/
|
|
9
|
+
command: string;
|
|
10
|
+
/**
|
|
11
|
+
* Override command builder permissions
|
|
12
|
+
*/
|
|
13
|
+
permissions: PermissionResolvable[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reciple config object interface
|
|
17
|
+
*/
|
|
18
|
+
export interface Config {
|
|
19
|
+
token: string;
|
|
20
|
+
commands: {
|
|
21
|
+
slashCommand: {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
replyOnError: boolean;
|
|
24
|
+
registerCommands: boolean;
|
|
25
|
+
allowRegisterEmptyCommandList: boolean;
|
|
26
|
+
enableCooldown: boolean;
|
|
27
|
+
setRequiredPermissions: boolean;
|
|
28
|
+
acceptRepliedInteractions: boolean;
|
|
29
|
+
guilds?: string[] | string;
|
|
30
|
+
permissions: {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
commands: ConfigCommandPermissions[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
messageCommand: {
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
prefix?: string;
|
|
38
|
+
replyOnError: boolean;
|
|
39
|
+
allowCommandAlias: boolean;
|
|
40
|
+
enableCooldown: boolean;
|
|
41
|
+
commandArgumentSeparator: string;
|
|
42
|
+
permissions: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
commands: ConfigCommandPermissions[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
fileLogging: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
debugmode: boolean;
|
|
51
|
+
clientLogs: boolean;
|
|
52
|
+
stringifyLoggedJSON: boolean;
|
|
53
|
+
logFilePath: string;
|
|
54
|
+
};
|
|
55
|
+
client: ClientOptions;
|
|
56
|
+
messages: {
|
|
57
|
+
[messageKey: string]: any;
|
|
58
|
+
};
|
|
59
|
+
ignoredFiles: string[];
|
|
60
|
+
modulesFolder: string | string[];
|
|
61
|
+
disableVersionCheck: boolean;
|
|
62
|
+
version: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create/parse reciple config
|
|
66
|
+
*/
|
|
67
|
+
export declare class RecipleConfig {
|
|
68
|
+
config: Config;
|
|
69
|
+
configPath: string;
|
|
70
|
+
static defaultConfigPath: string;
|
|
71
|
+
/**
|
|
72
|
+
* @param configPath Path to config
|
|
73
|
+
*/
|
|
74
|
+
constructor(configPath: string);
|
|
75
|
+
/**
|
|
76
|
+
* Parse the config file
|
|
77
|
+
*/
|
|
78
|
+
parseConfig(): this;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the parsed config file
|
|
81
|
+
*/
|
|
82
|
+
getConfig(): Config;
|
|
83
|
+
/**
|
|
84
|
+
* Parse token from config
|
|
85
|
+
* @param askIfEmpty Ask for token if the token is undefined
|
|
86
|
+
*/
|
|
87
|
+
parseToken(askIfEmpty?: boolean): string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the config version is supported
|
|
90
|
+
*/
|
|
91
|
+
protected _isSupportedConfig(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Ask for a token
|
|
94
|
+
*/
|
|
95
|
+
protected _askToken(): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Get default config
|
|
98
|
+
*/
|
|
99
|
+
static getDefaultConfig(): Config;
|
|
100
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { GuildResolvable, RestOrArray } from 'discord.js';
|
|
2
|
-
import { AnyCommandBuilder, AnyCommandData } from '../types/builders';
|
|
3
|
-
import { RecipleClient } from './RecipleClient';
|
|
4
|
-
/**
|
|
5
|
-
* Reciple script object
|
|
6
|
-
*/
|
|
7
|
-
export interface RecipleScript {
|
|
8
|
-
/**
|
|
9
|
-
* Supported reciple versions
|
|
10
|
-
*/
|
|
11
|
-
versions: string | string[];
|
|
12
|
-
/**
|
|
13
|
-
* Module commands
|
|
14
|
-
*/
|
|
15
|
-
commands?: (AnyCommandBuilder | AnyCommandData)[];
|
|
16
|
-
/**
|
|
17
|
-
* Action on module start
|
|
18
|
-
* @param client Bot client
|
|
19
|
-
*/
|
|
20
|
-
onStart(client: RecipleClient<false>): boolean | Promise<boolean>;
|
|
21
|
-
/**
|
|
22
|
-
* Action on bot ready
|
|
23
|
-
* @param client Bot client
|
|
24
|
-
*/
|
|
25
|
-
onLoad?(client: RecipleClient<true>): void | Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Action when unloading this module
|
|
28
|
-
* @param reason Unload reason
|
|
29
|
-
* @param client Bot client
|
|
30
|
-
*/
|
|
31
|
-
onUnload?(reason: unknown, client: RecipleClient<true>): void | Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
export interface RecipleModuleOptions<M = unknown> {
|
|
34
|
-
client: RecipleClient;
|
|
35
|
-
script: RecipleScript;
|
|
36
|
-
filePath?: string;
|
|
37
|
-
metadata?: M;
|
|
38
|
-
}
|
|
39
|
-
export declare class RecipleModule<M = unknown> {
|
|
40
|
-
readonly id: string;
|
|
41
|
-
readonly client: RecipleClient;
|
|
42
|
-
readonly commands: AnyCommandBuilder[];
|
|
43
|
-
readonly script: RecipleScript;
|
|
44
|
-
readonly filePath?: string;
|
|
45
|
-
metadata?: M;
|
|
46
|
-
get displayName(): string;
|
|
47
|
-
constructor(options: RecipleModuleOptions<M>);
|
|
48
|
-
start(): Promise<boolean>;
|
|
49
|
-
load(resolveCommands?: boolean): Promise<void>;
|
|
50
|
-
unload(reason?: any): Promise<void>;
|
|
51
|
-
registerSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
52
|
-
unregisterSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
53
|
-
updateSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
54
|
-
resolveCommands(): AnyCommandBuilder[];
|
|
55
|
-
toString(): string;
|
|
56
|
-
}
|
|
1
|
+
import { GuildResolvable, RestOrArray } from 'discord.js';
|
|
2
|
+
import { AnyCommandBuilder, AnyCommandData } from '../types/builders';
|
|
3
|
+
import { RecipleClient } from './RecipleClient';
|
|
4
|
+
/**
|
|
5
|
+
* Reciple script object
|
|
6
|
+
*/
|
|
7
|
+
export interface RecipleScript {
|
|
8
|
+
/**
|
|
9
|
+
* Supported reciple versions
|
|
10
|
+
*/
|
|
11
|
+
versions: string | string[];
|
|
12
|
+
/**
|
|
13
|
+
* Module commands
|
|
14
|
+
*/
|
|
15
|
+
commands?: (AnyCommandBuilder | AnyCommandData)[];
|
|
16
|
+
/**
|
|
17
|
+
* Action on module start
|
|
18
|
+
* @param client Bot client
|
|
19
|
+
*/
|
|
20
|
+
onStart(client: RecipleClient<false>): boolean | Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Action on bot ready
|
|
23
|
+
* @param client Bot client
|
|
24
|
+
*/
|
|
25
|
+
onLoad?(client: RecipleClient<true>): void | Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Action when unloading this module
|
|
28
|
+
* @param reason Unload reason
|
|
29
|
+
* @param client Bot client
|
|
30
|
+
*/
|
|
31
|
+
onUnload?(reason: unknown, client: RecipleClient<true>): void | Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface RecipleModuleOptions<M = unknown> {
|
|
34
|
+
client: RecipleClient;
|
|
35
|
+
script: RecipleScript;
|
|
36
|
+
filePath?: string;
|
|
37
|
+
metadata?: M;
|
|
38
|
+
}
|
|
39
|
+
export declare class RecipleModule<M = unknown> {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly client: RecipleClient;
|
|
42
|
+
readonly commands: AnyCommandBuilder[];
|
|
43
|
+
readonly script: RecipleScript;
|
|
44
|
+
readonly filePath?: string;
|
|
45
|
+
metadata?: M;
|
|
46
|
+
get displayName(): string;
|
|
47
|
+
constructor(options: RecipleModuleOptions<M>);
|
|
48
|
+
start(): Promise<boolean>;
|
|
49
|
+
load(resolveCommands?: boolean): Promise<void>;
|
|
50
|
+
unload(reason?: any): Promise<void>;
|
|
51
|
+
registerSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
52
|
+
unregisterSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
53
|
+
updateSlashCommands(...guilds: RestOrArray<GuildResolvable>): Promise<void>;
|
|
54
|
+
resolveCommands(): AnyCommandBuilder[];
|
|
55
|
+
toString(): string;
|
|
56
|
+
}
|
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
|
|
2
|
-
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
3
|
-
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
4
|
-
import { MessageCommandOptionManager } from '../managers/MessageCommandOptionManager';
|
|
5
|
-
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
6
|
-
import { Command } from 'fallout-utility';
|
|
7
|
-
/**
|
|
8
|
-
* Execute data for message command
|
|
9
|
-
*/
|
|
10
|
-
export interface MessageCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
11
|
-
/**
|
|
12
|
-
* Command message
|
|
13
|
-
*/
|
|
14
|
-
message: Message;
|
|
15
|
-
/**
|
|
16
|
-
* Command option args
|
|
17
|
-
*/
|
|
18
|
-
options: MessageCommandOptionManager;
|
|
19
|
-
/**
|
|
20
|
-
* Command parsed args
|
|
21
|
-
*/
|
|
22
|
-
command: Command;
|
|
23
|
-
/**
|
|
24
|
-
* Command builder
|
|
25
|
-
*/
|
|
26
|
-
builder: MessageCommandBuilder<T>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Validated message command option
|
|
30
|
-
*/
|
|
31
|
-
export interface MessageCommandValidatedOption {
|
|
32
|
-
/**
|
|
33
|
-
* Option name
|
|
34
|
-
*/
|
|
35
|
-
name: string;
|
|
36
|
-
/**
|
|
37
|
-
* Option value
|
|
38
|
-
*/
|
|
39
|
-
value?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Is the option required
|
|
42
|
-
*/
|
|
43
|
-
required: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Is the option invalid
|
|
46
|
-
*/
|
|
47
|
-
invalid: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Is the option missing
|
|
50
|
-
*/
|
|
51
|
-
missing: boolean;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Halt data for message command
|
|
55
|
-
*/
|
|
56
|
-
export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandType.MessageCommand, T>;
|
|
57
|
-
/**
|
|
58
|
-
* Message command halt function
|
|
59
|
-
*/
|
|
60
|
-
export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.MessageCommand, T>;
|
|
61
|
-
/**
|
|
62
|
-
* Message command execute function
|
|
63
|
-
*/
|
|
64
|
-
export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.MessageCommand, T>;
|
|
65
|
-
/**
|
|
66
|
-
* Reciple builder for message command
|
|
67
|
-
*/
|
|
68
|
-
export declare class MessageCommandBuilder<T = unknown> implements SharedCommandBuilderProperties<T> {
|
|
69
|
-
readonly type = CommandType.MessageCommand;
|
|
70
|
-
name: string;
|
|
71
|
-
description: string;
|
|
72
|
-
cooldown: number;
|
|
73
|
-
aliases: string[];
|
|
74
|
-
validateOptions: boolean;
|
|
75
|
-
options: MessageCommandOptionBuilder[];
|
|
76
|
-
requiredBotPermissions: PermissionResolvable[];
|
|
77
|
-
requiredMemberPermissions: PermissionResolvable[];
|
|
78
|
-
allowExecuteInDM: boolean;
|
|
79
|
-
allowExecuteByBots: boolean;
|
|
80
|
-
halt?: MessageCommandHaltFunction<T>;
|
|
81
|
-
execute: MessageCommandExecuteFunction<T>;
|
|
82
|
-
metadata?: T;
|
|
83
|
-
constructor(data?: Partial<Omit<MessageCommandData<T>, 'type'>>);
|
|
84
|
-
/**
|
|
85
|
-
* Sets the command name
|
|
86
|
-
* @param name Command name
|
|
87
|
-
*/
|
|
88
|
-
setName(name: string): this;
|
|
89
|
-
/**
|
|
90
|
-
* Sets the command description
|
|
91
|
-
* @param description Command description
|
|
92
|
-
*/
|
|
93
|
-
setDescription(description: string): this;
|
|
94
|
-
/**
|
|
95
|
-
* Add aliases to the command
|
|
96
|
-
* @param aliases Command aliases
|
|
97
|
-
*/
|
|
98
|
-
addAliases(...aliases: RestOrArray<string>): this;
|
|
99
|
-
/**
|
|
100
|
-
* Set if command can be executed in dms
|
|
101
|
-
* @param allowExecuteInDM `true` if the command can execute in DMs
|
|
102
|
-
*/
|
|
103
|
-
setAllowExecuteInDM(allowExecuteInDM: boolean): this;
|
|
104
|
-
/**
|
|
105
|
-
* Allow command to be executed by bots
|
|
106
|
-
* @param allowExecuteByBots `true` if the command can be executed by bots
|
|
107
|
-
*/
|
|
108
|
-
setAllowExecuteByBots(allowExecuteByBots: boolean): this;
|
|
109
|
-
/**
|
|
110
|
-
* Add option to the command
|
|
111
|
-
* @param option Message option builder
|
|
112
|
-
*/
|
|
113
|
-
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)): this;
|
|
114
|
-
/**
|
|
115
|
-
* Validate options before executing
|
|
116
|
-
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
117
|
-
*/
|
|
118
|
-
setValidateOptions(validateOptions: boolean): this;
|
|
119
|
-
setCooldown(cooldown: number): this;
|
|
120
|
-
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
121
|
-
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
122
|
-
setHalt(halt?: MessageCommandHaltFunction<T> | null): this;
|
|
123
|
-
setExecute(execute: MessageCommandExecuteFunction<T>): this;
|
|
124
|
-
setMetadata(metadata?: T): this;
|
|
125
|
-
/**
|
|
126
|
-
* Returns JSON object of this builder
|
|
127
|
-
*/
|
|
128
|
-
toJSON(): MessageCommandData<T>;
|
|
129
|
-
/**
|
|
130
|
-
* Resolve message command data/builder
|
|
131
|
-
* @param commandData Command data to resolve
|
|
132
|
-
*/
|
|
133
|
-
static resolveMessageCommand<T = unknown>(commandData: MessageCommandData<T> | MessageCommandBuilder<T>): MessageCommandBuilder<T>;
|
|
134
|
-
/**
|
|
135
|
-
* Is a message command builder
|
|
136
|
-
* @param builder data to check
|
|
137
|
-
*/
|
|
138
|
-
static isMessageCommandBuilder<T>(builder: unknown): builder is MessageCommandBuilder<T>;
|
|
139
|
-
/**
|
|
140
|
-
* Is a message command execute data
|
|
141
|
-
* @param executeData data to check
|
|
142
|
-
*/
|
|
143
|
-
static isMessageCommandExecuteData(executeData: unknown): executeData is MessageCommandExecuteData;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Validate message command options
|
|
147
|
-
* @param builder Command builder
|
|
148
|
-
* @param options Parsed command args
|
|
149
|
-
*/
|
|
150
|
-
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: Command): Promise<MessageCommandOptionManager>;
|
|
1
|
+
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
|
|
2
|
+
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
3
|
+
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
4
|
+
import { MessageCommandOptionManager } from '../managers/MessageCommandOptionManager';
|
|
5
|
+
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
6
|
+
import { Command } from 'fallout-utility';
|
|
7
|
+
/**
|
|
8
|
+
* Execute data for message command
|
|
9
|
+
*/
|
|
10
|
+
export interface MessageCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
11
|
+
/**
|
|
12
|
+
* Command message
|
|
13
|
+
*/
|
|
14
|
+
message: Message;
|
|
15
|
+
/**
|
|
16
|
+
* Command option args
|
|
17
|
+
*/
|
|
18
|
+
options: MessageCommandOptionManager;
|
|
19
|
+
/**
|
|
20
|
+
* Command parsed args
|
|
21
|
+
*/
|
|
22
|
+
command: Command;
|
|
23
|
+
/**
|
|
24
|
+
* Command builder
|
|
25
|
+
*/
|
|
26
|
+
builder: MessageCommandBuilder<T>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validated message command option
|
|
30
|
+
*/
|
|
31
|
+
export interface MessageCommandValidatedOption {
|
|
32
|
+
/**
|
|
33
|
+
* Option name
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Option value
|
|
38
|
+
*/
|
|
39
|
+
value?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Is the option required
|
|
42
|
+
*/
|
|
43
|
+
required: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Is the option invalid
|
|
46
|
+
*/
|
|
47
|
+
invalid: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Is the option missing
|
|
50
|
+
*/
|
|
51
|
+
missing: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Halt data for message command
|
|
55
|
+
*/
|
|
56
|
+
export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandType.MessageCommand, T>;
|
|
57
|
+
/**
|
|
58
|
+
* Message command halt function
|
|
59
|
+
*/
|
|
60
|
+
export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.MessageCommand, T>;
|
|
61
|
+
/**
|
|
62
|
+
* Message command execute function
|
|
63
|
+
*/
|
|
64
|
+
export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.MessageCommand, T>;
|
|
65
|
+
/**
|
|
66
|
+
* Reciple builder for message command
|
|
67
|
+
*/
|
|
68
|
+
export declare class MessageCommandBuilder<T = unknown> implements SharedCommandBuilderProperties<T> {
|
|
69
|
+
readonly type = CommandType.MessageCommand;
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
cooldown: number;
|
|
73
|
+
aliases: string[];
|
|
74
|
+
validateOptions: boolean;
|
|
75
|
+
options: MessageCommandOptionBuilder[];
|
|
76
|
+
requiredBotPermissions: PermissionResolvable[];
|
|
77
|
+
requiredMemberPermissions: PermissionResolvable[];
|
|
78
|
+
allowExecuteInDM: boolean;
|
|
79
|
+
allowExecuteByBots: boolean;
|
|
80
|
+
halt?: MessageCommandHaltFunction<T>;
|
|
81
|
+
execute: MessageCommandExecuteFunction<T>;
|
|
82
|
+
metadata?: T;
|
|
83
|
+
constructor(data?: Partial<Omit<MessageCommandData<T>, 'type'>>);
|
|
84
|
+
/**
|
|
85
|
+
* Sets the command name
|
|
86
|
+
* @param name Command name
|
|
87
|
+
*/
|
|
88
|
+
setName(name: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the command description
|
|
91
|
+
* @param description Command description
|
|
92
|
+
*/
|
|
93
|
+
setDescription(description: string): this;
|
|
94
|
+
/**
|
|
95
|
+
* Add aliases to the command
|
|
96
|
+
* @param aliases Command aliases
|
|
97
|
+
*/
|
|
98
|
+
addAliases(...aliases: RestOrArray<string>): this;
|
|
99
|
+
/**
|
|
100
|
+
* Set if command can be executed in dms
|
|
101
|
+
* @param allowExecuteInDM `true` if the command can execute in DMs
|
|
102
|
+
*/
|
|
103
|
+
setAllowExecuteInDM(allowExecuteInDM: boolean): this;
|
|
104
|
+
/**
|
|
105
|
+
* Allow command to be executed by bots
|
|
106
|
+
* @param allowExecuteByBots `true` if the command can be executed by bots
|
|
107
|
+
*/
|
|
108
|
+
setAllowExecuteByBots(allowExecuteByBots: boolean): this;
|
|
109
|
+
/**
|
|
110
|
+
* Add option to the command
|
|
111
|
+
* @param option Message option builder
|
|
112
|
+
*/
|
|
113
|
+
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)): this;
|
|
114
|
+
/**
|
|
115
|
+
* Validate options before executing
|
|
116
|
+
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
117
|
+
*/
|
|
118
|
+
setValidateOptions(validateOptions: boolean): this;
|
|
119
|
+
setCooldown(cooldown: number): this;
|
|
120
|
+
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
121
|
+
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
122
|
+
setHalt(halt?: MessageCommandHaltFunction<T> | null): this;
|
|
123
|
+
setExecute(execute: MessageCommandExecuteFunction<T>): this;
|
|
124
|
+
setMetadata(metadata?: T): this;
|
|
125
|
+
/**
|
|
126
|
+
* Returns JSON object of this builder
|
|
127
|
+
*/
|
|
128
|
+
toJSON(): MessageCommandData<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Resolve message command data/builder
|
|
131
|
+
* @param commandData Command data to resolve
|
|
132
|
+
*/
|
|
133
|
+
static resolveMessageCommand<T = unknown>(commandData: MessageCommandData<T> | MessageCommandBuilder<T>): MessageCommandBuilder<T>;
|
|
134
|
+
/**
|
|
135
|
+
* Is a message command builder
|
|
136
|
+
* @param builder data to check
|
|
137
|
+
*/
|
|
138
|
+
static isMessageCommandBuilder<T>(builder: unknown): builder is MessageCommandBuilder<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Is a message command execute data
|
|
141
|
+
* @param executeData data to check
|
|
142
|
+
*/
|
|
143
|
+
static isMessageCommandExecuteData(executeData: unknown): executeData is MessageCommandExecuteData;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Validate message command options
|
|
147
|
+
* @param builder Command builder
|
|
148
|
+
* @param options Parsed command args
|
|
149
|
+
*/
|
|
150
|
+
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: Command): Promise<MessageCommandOptionManager>;
|