UNPKG

1.25 kBPlain TextView Raw
1import { BaseComponent } from '@maildots/sdk';
2import { Message } from '@maildots/sdk';
3import { Intent } from '@maildots/sdk';
4
5import { SayHello } from './SayHello';
6import { Reply } from './Reply';
7
8class Index extends BaseComponent {
9
10 constructor() {
11 super();
12 }
13
14 async onNewMessage(message: Message)
15 {
16 console.log(message)
17 }
18
19 async onInstall(accountAddress: string)
20 {
21 console.log('onInstall')
22 let sayHello = new SayHello();
23 let args = new SayHello.Args(accountAddress);
24 sayHello.execute(args);
25 }
26
27 async onUninstall(accountAddress: string)
28 {
29 console.log('onUninstall')
30 }
31
32 async onCommand(command: string, message: Message)
33 {
34 console.log('onCommand')
35 let reply = new Reply();
36 let args = new Reply.Args(message);
37 reply.execute(args);
38 }
39
40 async onCall(command: string, message: Message)
41 {
42 console.log('onCall')
43 let reply = new Reply();
44 let args = new Reply.Args(message);
45 reply.execute(args);
46 }
47
48 async onInteraction(input_id: string, message: Message, inputs: Map<string, string>)
49 {
50 console.log('onInteraction')
51 let reply = new Reply();
52 let args = new Reply.Args(message);
53 reply.execute(args);
54 }
55}
56
57let index = new Index();