forked from aichaos/rivescript-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rivescript.d.ts
72 lines (40 loc) · 1.96 KB
/
rivescript.d.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
declare module "rivescript" {
interface RivescriptOptions {
utf8?: boolean;
debug?: boolean;
onDebug?: (message: string) => void;
errors?: { [key: string]: string};
}
interface MacroObjectHandler {
load(name: string, code: string[]): void;
call(rs: RiveScript, name: string, fields: any, scope: any): string;
}
class RiveScript {
constructor(options?: RivescriptOptions);
version(): string;
Promise(callback: (resolve: (any) => void, reject: (any) => void) => void): void;
loadDirectory(brain: string, loadingDone: (batchNumber: number) => void, loadingError: (error: Error, batchNumber: number) => void);
loadFile(path: string, loadingDone: (batchNumber: number) => void, loadingError: (error: Error, batchNumber: number) => void);
loadFile(paths: string[], loadingDone: (batchNumber: number) => void, loadingError: (error: Error, batchNumber: number) => void);
sortReplies();
reply(user: string, message: string): string;
replyAsync(user: string, message: string, scope?: any): Promise<string>;
replyAsync(user: string, message: string, scope: any, callback: (error: Error, reply: string) => void);
setHandler(lang: string, handler: MacroObjectHandler): void;
setSubroutine(name: string, handler: (rs: RiveScript, args: string[]) => string | Promise<string>): void;
setGlobal(name: string, value: string): void;
setVariable(name: string, value: string): void;
setSubstitution(name: string, value: string): void;
setPerson(name: string, value: string): void;
setUservar(user: string, name: string, value: any): void;
setUservars(user: string, data: Object): void;
getVariable(user: string, name: string): string;
getUservar(user: string, name: string): string;
getUservars(user: string): Object;
clearUservars(user: string): void;
lastMatch(user: string): string;
initialMatch(user: string): string;
currentUser(): string;
}
export = RiveScript;
}