@@ -2,7 +2,8 @@ import Command from "./commands/command";
2
2
import { Listener } from "./listeners/listener" ;
3
3
import Looker from "./looker" ;
4
4
import LookQueryRunner from "./repliers/look_query_runner" ;
5
- import QueryRunner from "./repliers/query_runner" ;
5
+ import { QueryRunner } from "./repliers/query_runner" ;
6
+ import ReplyContext from "./reply_context" ;
6
7
import SlackService from "./services/slack_service" ;
7
8
8
9
export default class Commander {
@@ -13,10 +14,10 @@ export default class Commander {
13
14
constructor ( opts : { listeners : Array < typeof Listener > , commands : Array < typeof Command > } ) {
14
15
this . service = new SlackService ( {
15
16
listeners : opts . listeners ,
16
- messageHandler : ( context ) => {
17
+ messageHandler : ( context : ReplyContext ) => {
17
18
return this . handleMessage ( context ) ;
18
19
} ,
19
- urlHandler : ( context , url ) => {
20
+ urlHandler : ( context : ReplyContext , url : string ) => {
20
21
return this . handleUrlExpansion ( context , url ) ;
21
22
} ,
22
23
} ) ;
@@ -25,7 +26,7 @@ export default class Commander {
25
26
this . commands = opts . commands . map ( ( c ) => new c ( ) ) ;
26
27
}
27
28
28
- private handleMessage ( context ) {
29
+ private handleMessage ( context : ReplyContext ) {
29
30
30
31
const message = context . sourceMessage ;
31
32
@@ -42,7 +43,7 @@ export default class Commander {
42
43
43
44
}
44
45
45
- private handleUrlExpansion ( context , url ) {
46
+ private handleUrlExpansion ( context : ReplyContext , url : string ) {
46
47
for ( const looker of Looker . all ) {
47
48
// Starts with Looker base URL?
48
49
if ( url . lastIndexOf ( looker . url , 0 ) === 0 ) {
@@ -54,7 +55,7 @@ export default class Commander {
54
55
55
56
}
56
57
57
- private annotateLook ( context , url ) {
58
+ private annotateLook ( context : ReplyContext , url : string ) {
58
59
const matches = url . match ( / \/ l o o k s \/ ( [ 0 - 9 ] + ) $ / ) ;
59
60
if ( matches ) {
60
61
console . log ( `Expanding Look URL ${ url } ` ) ;
@@ -63,7 +64,7 @@ export default class Commander {
63
64
}
64
65
}
65
66
66
- private annotateShareUrl ( context , url ) {
67
+ private annotateShareUrl ( context : ReplyContext , url : string ) {
67
68
const matches = url . match ( / \/ x \/ ( [ A - Z a - z 0 - 9 ] + ) $ / ) ;
68
69
if ( matches ) {
69
70
console . log ( `Expanding Share URL ${ url } ` ) ;
0 commit comments