-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.ts
45 lines (39 loc) · 899 Bytes
/
types.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
import { AppCommand } from './command/command.app';
import { FuncResult } from './command';
import { BaseSession } from './session';
/**
* MenuCommand and AppCommand comes from this.
*
* @export
* @interface BaseCommand
*/
export interface BaseCommand {
readonly code: string;
readonly trigger: string;
readonly type: CommandTypes;
exec(...args: any): unknown;
}
export type ResultHandler<T extends BaseSession> = (
data: T,
type: string | number
) => Promise<FuncResult<T>>;
export enum CommandTypes {
MENU = 'MENU',
HELP = 'HELP',
APP = 'FUNCTION',
}
export enum ResultTypes {
PENDING = 'PENDING',
SUCCESS = 'SUCCESS',
FAIL = 'FAIL',
ERROR = 'ERROR',
HELP = 'HELP',
WRONG_ARGS = 'WRONG_ARGS',
}
export interface MenuCommandParams {
code: string;
trigger: string;
help: string;
apps: AppCommand[];
}
export {};