-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommand.d.ts
More file actions
48 lines (45 loc) · 1.51 KB
/
command.d.ts
File metadata and controls
48 lines (45 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @since 2.0.0
*/
interface CommandEvents {
/**
* Called on any command being used.
* @param label The beginning of the command line (for example, `'test'` in '.test 123')
* @param args The list of arguments of the command line (for example, `['123']` in '.test 123')
* @param commandLine The command line (for example, `'.test 123 test'` in '.test 123 test')
* @returns Whether the command usage is successful or not (return `false` if the user misused the command)
* @since 2.0.0
*/
"execute" : (label: string, args: string[], commandLine: string) => boolean;
}
/**
* A class representing a Latite Client command.
* @since 2.0.0
*/
declare class Command {
/**
* @since 2.0.0
*/
readonly name: string;
/**
* @since 2.0.0
*/
readonly description: string;
/**
* @since 2.0.0
*/
readonly aliases: string[];
/**
*
* @param name The name of the command
* @param description A short description of what the command does
* @param usage The usage of the command put '$' in place of the actual command name and preifx. Example: usage: "$ <name>" -> ".commandname <name>"
* @param aliases Alternative command names the user can use the execute the same command. Can be empty
* @since 2.0.0
*/
constructor(name: string, description: string, usage: string, aliases: string[]);
/**
* @since 2.0.0
*/
on: <K extends keyof CommandEvents>(eventName: K, handler: CommandEvents[K]) => void;
}