-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcommandapi.ts
54 lines (38 loc) · 1014 Bytes
/
commandapi.ts
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
49
50
51
52
53
54
//% color=190 weight=100 icon="\f209" block="SadAPI Commands"
namespace SadApiCommands {
/**
* Function for creating new commands by name
*/
//% block
export function createCommand(name: string, args: Array<string>, permission: string, todo: () => any): void {
//TODO
}
/**
* Function for registering commands by executor
*/
//% block
export function registerCommand(executor: CommandExecutor): void {
//TODO
}
}
interface CommandExecutor {
(name: string, args: Array<string>, permission: string): void;
}
class Permission {
permissionName: string
public Permission(permissionName: string, forCommand: Command) {
this.permissionName = permissionName;
}
}
class Command {
name: string
args: Array<String>
permission: Permission
public Command(name: string) {
this.name = name;
new CommandUtils().commands.push(this)
}
}
class CommandUtils {
commands: Array<Command>
}